#6896

code-modernization: proof_pack.py reads only the first 50 canaries, later modules get "No canary is recorded"

Openpiotrlaczykowskiopened 4d ago

Plugin: code-modernization 1.0.0, scripts/proof_pack.py

load_runs (line 161) reads only the first 50 entries of canaries in equivalence/test-runs.json:

for c in (obj.get("canaries") if isinstance(obj.get("canaries"), list) else [])[:50]:

Repro: a reimagine with 54 judged modules and 53 canaries (one per module). Every canary was run and each made at least one test fail. Modules whose canary is at positions 51-53 get Canary: No canary is recorded (a deliberate one-line break that makes tests fail), so the tests were never shown able to fail. and are PARTLY PROVEN.

Expected: all recorded canaries are read, or the pack says it stopped at N and names the dropped modules. Silently dropping evidence produces a wrong reason in VERIFICATION.md, and the command forbids hand-editing to work around it (reordering the file just moves the problem to other modules).

Activity

1
piotrlaczykowski3d ago

Proposed minimal fix (seen again on a re-run with 53 canaries: the last three modules were reported as "No canary is recorded" although their canary result files exist and show failing tests):

--- a/plugins/code-modernization/scripts/proof_pack.py
+++ b/plugins/code-modernization/scripts/proof_pack.py
@@ def load_test_runs(adir):
-    for c in (obj.get("canaries") if isinstance(obj.get("canaries"), list) else [])[:50]:
+    for c in (obj.get("canaries") if isinstance(obj.get("canaries"), list) else [])[:200]:

suites are already read up to 200, and every module needs its own canary, so the canary cap should be at least the suite cap. If a cap is kept for safety, the pack should say so when it truncates (e.g. a problems entry "test-runs.json lists N canaries, only the first 200 were read") instead of silently reporting "No canary is recorded" for the modules that fell off the end.