fix: check every romfolders source_ref

model.romfolders.source_refs walks every ref a setup carries, offers[]
and searched_by[] included, which the three hand lists in
validate_schemas and the tests skipped: 4176 refs were never matched
against the declared sources. validate_schemas parses them with
split_refs and reports a malformed part.
This commit is contained in:
Abdessamad Derraz committed 2026-11-21 06:04:31 +01:00
1 parent ed19ae4198
commit 3467b80b38
4 files changed
+29 -26

No files matched your search

+10 -9
View File
@@ -879,6 +879,8 @@ def _romfolder_errors() -> list[str]:
"""Every scraped setup against its schema, and every source_ref against
the sources the file declares: a ref naming no declared repository can
never be read back at a pin."""
from model.romfolders import source_refs, split_refs
directory = REPO_ROOT / PLATFORMS_DIR / "romfolders"
if not directory.is_dir():
return []
@@ -893,16 +895,15 @@ def _romfolder_errors() -> list[str]:
if errors:
continue
declared = set(data["sources"])
refs = [data["roms_root"]["source_ref"]]
refs += [data["case_ref"]] if data.get("case_ref") else []
refs += [r["source_ref"] for key in ("skip", "hidden", "media") for r in data.get(key, [])]
for row in data["folders"]:
refs.append(row["source_ref"])
refs += [b["source_ref"] for b in (row.get("board_defaults") or {}).values()]
for ref in refs:
for part in ref.split("; "):
key = part.split(" ", 1)[0]
for ref in source_refs(data):
try:
parts = split_refs(ref)
except ValueError as exc:
out.append(f"{label}: {exc}")
continue
for key, path, lines in parts:
if key not in declared:
part = f"{key} {path}" + (f":{lines}" if lines else "")
out.append(f"{label}: source_ref {part!r} names undeclared source {key!r}")
return out