From a60dcd10c22e0e2afce189a4c7a64473a633bdd5 Mon Sep 17 00:00:00 2001 From: topkoa Date: Mon, 13 Jul 2026 01:23:59 -0400 Subject: [PATCH] ci: legible errors for a missing baseline and an unparseable reader MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two review nits: check_allowlist_closed() raised a traceback when --baseline-exceptions pointed at a missing file (the error now says CI derives it from the base branch and local runs should omit the flag), and check_key_coverage() would traceback on a reader with a SyntaxError (now a ::error:: naming the module — belt-and-braces, since such a module can't pass pytest either, but this job may run first). Signed-off-by: topkoa --- tools/check_spec_conformance.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tools/check_spec_conformance.py b/tools/check_spec_conformance.py index 3d99696..72f4815 100644 --- a/tools/check_spec_conformance.py +++ b/tools/check_spec_conformance.py @@ -249,6 +249,12 @@ def check_allowlist_closed(baseline: Path | None, bootstrap: bool) -> bool: print(" allowlist-closed: no baseline supplied (local run) — skipped") return True + if not baseline.is_file(): + _fail( + f"--baseline-exceptions {baseline} does not exist. CI derives this from the base " + f"branch; for a local run, omit the flag to skip the allowlist diff." + ) + return False base_keys = set( _parse_exceptions(baseline.read_text(encoding="utf-8"), f"{EXCEPTIONS_FILE.name} (base)") ) @@ -323,7 +329,14 @@ def check_key_coverage(spec: Path) -> bool: if not path.exists(): _fail(f"reader {rel} not found — was it renamed? Update READERS in {Path(__file__).name}.") return False - r, w = keys_touched(path) + try: + r, w = keys_touched(path) + except SyntaxError as e: + # A module that doesn't parse can't be scanned — but it also can't + # pass pytest, so this is belt-and-braces for a CI-legible message + # rather than a traceback if this job runs first. + _fail(f"could not scan {rel}: {e}") + return False reads |= r writes |= w