From 8375e1168012c696e0f73348e9fd1a0bae11c6c8 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Sat, 17 Oct 2026 20:43:51 +0200 Subject: [PATCH] fix: check the names a single-target platform runs --- scripts/check_freshness.py | 28 +++++++++++++++++++++++++--- tests/test_check_freshness.py | 13 +++++++++++++ 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/scripts/check_freshness.py b/scripts/check_freshness.py index 9446759f..5ba10aeb 100644 --- a/scripts/check_freshness.py +++ b/scripts/check_freshness.py @@ -482,9 +482,18 @@ def check_targets( (t or {}).get("cores", []) is None for t in targets.values() ): # Every core the platform declares runs on these targets: the list - # is the platform's own and has nothing of its own to age. - return [Finding("targets", platform, OK, local="static", - detail="every declared core")] + # is the platform's own and has nothing of its own to age. Its + # names still need a profile each: RetroBat's winuae, jzintv or + # sudachi without one are BIOS its pack never carries. + out = [Finding("targets", platform, OK, local="static", + detail="every declared core")] + declared = _declared_cores(platform) + missing = unresolved_target_cores( + {"targets": {name: {"cores": declared} for name in targets}}, + index, _platform_overrides(overrides, platform), + ) + out.extend(_unresolved_findings(platform, missing)) + return out if module is None: # No scraper: a hand-written file has no upstream to diff against, # so only its age and its core names can be reported. @@ -532,6 +541,19 @@ def check_targets( return findings +def _declared_cores(platform: str) -> list[str]: + """The cores and standalone emulators a platform's own file names.""" + from common import load_platform_config + + try: + config = load_platform_config(platform, str(REPO_ROOT / "platforms")) + except (FileNotFoundError, OSError): + return [] + cores = config.get("cores") + names = [str(c) for c in cores] if isinstance(cores, list) else [] + return names + [str(c) for c in config.get("standalone_cores") or []] + + def _unresolved_findings(platform: str, missing: dict[str, list[str]]) -> list[Finding]: """One row per platform: the names its targets list that no profile claims. diff --git a/tests/test_check_freshness.py b/tests/test_check_freshness.py index 59f6fb3b..4117a9ea 100644 --- a/tests/test_check_freshness.py +++ b/tests/test_check_freshness.py @@ -368,5 +368,18 @@ class PinsWithExtras(unittest.TestCase): self.assertEqual(pins["jsonschema"], "==4.26.0") + +class AStaticTargetStillNamesItsCores(unittest.TestCase): + """RetroBat's single target is `cores: null`; the check returned OK + before reading the names, and its 50 unprofiled emulators never showed.""" + + def test_declared_names_are_checked(self): + names = cf._declared_cores("retrobat") + self.assertIn("winuae", names) + source = Path(cf.__file__).read_text() + static = source.index('detail="every declared core"') + self.assertLess(static, source.index("_declared_cores(platform)")) + + if __name__ == "__main__": unittest.main()