feat: bind config launcher records on evidence

A launcher record citing a config, option or feature file binds only
when the platform's code installs the file (installs), its launch code
was read for what replaces it (overrides), and the emulator's profile
shows where the shipped build loads it and reads each key
(config_reads, read at pin_build). Unproven records place no file and
hand no directory. verify, cross_reference and the platform page list
them apart, outside severity and --strict.
This commit is contained in:
Abdessamad Derraz committed 2026-11-11 11:03:47 +01:00
1 parent 4f5951e2fb
commit 3129eaf10c
14 files changed
+872 -28

No files matched your search

+56
View File
@@ -81,7 +81,10 @@ def _validate_yaml_directory(
continue
out.extend(_errors(validator, data, str(path.relative_to(ROOT))))
out.extend(_unreachable_citations(path, data))
if schema_name == "platform.schema.json":
out.extend(_config_records_without_evidence(path, data))
if schema_name == "emulator.schema.json":
out.extend(_config_reads_without_build(path, data))
out.extend(_checks_without_values(path, data))
out.extend(_save_dir_without_library_name(path, data))
out.extend(_systems_outside_profile(path, data))
@@ -102,6 +105,59 @@ _CHECK_FIELDS = {
}
def _config_records_without_evidence(path: Path, document: object) -> list[str]:
"""A launcher record citing a config without the links its extractor reads.
A config file is proof only when the code installing it and the code
reading it are shown (launchers.config_evidence). The platform's half
is the extractor's to write: a record citing a shipped config carries
installs and overrides, and a feature or option file is never a
record's source, only its choices_from.
"""
if not isinstance(document, dict):
return []
from scraper.shell_launchers import config_ref, is_feature_ref # noqa: PLC0415
out: list[str] = []
for index, record in enumerate(document.get("launchers") or []):
if not isinstance(record, dict):
continue
cited = config_ref(str(record.get("source_ref") or ""))
where = f"{path.relative_to(ROOT)}: launchers[{index}] ({record.get('emulator')})"
features = [part for part in cited if is_feature_ref(part)]
if features:
out.append(f"{where} cites {features[0]} as source, choices_from holds it")
if [part for part in cited if not is_feature_ref(part)] and not (
record.get("installs") and "overrides" in record
):
out.append(f"{where} cites a config without installs and overrides")
return out
def _config_reads_without_build(path: Path, document: object) -> list[str]:
"""A config_reads entry naming a platform the profile gives no pin_build.
Such an entry is read at the build that platform ships, and pin_build is
where that build is named.
"""
if not isinstance(document, dict):
return []
builds = {str(b.get("platform")) for b in document.get("pin_build") or []}
out: list[str] = []
for index, read in enumerate(document.get("config_reads") or []):
if not isinstance(read, dict):
continue
if read.get("revision"):
continue
for platform in read.get("platforms") or []:
if str(platform) not in builds:
out.append(
f"{path.relative_to(ROOT)}: config_reads[{index}] ({read.get('file')}) "
f"names {platform}, which has no pin_build"
)
return out
def _systems_outside_profile(path: Path, document: object) -> list[str]:
"""An entry's system: or systems: naming a system its profile does not list.