tooling(scratch): decode-check run-to-run changes and a one-event view

Each run is diffed against the previous one (--compare-to, or the newest
other run in ~/dl2-archive/checker-runs): changes.md lists every
(event, field) that matched before and no longer does, how many now
match, and how each field's counts moved; summary.md leads with the
regression count.  --file NAME checks one event and prints its table,
writing no run folder.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
This commit is contained in:
serversdownandClaude Opus 5.5 committed 2026-10-29 19:30:53 -04:00
1 parent 5e85cf1018
commit c8fc649568
3 files changed
+111

No files matched your search

+32
View File
@@ -97,3 +97,35 @@ def test_summary_counts_fields_fully_matching(tmp_path):
def test_a_run_writes_both_reports(tmp_path):
assert run.main([str(FIX), str(FIX), "--out", str(tmp_path / "run"), "--jobs", "1"]) == 0
assert (tmp_path / "run/summary.md").exists() and (tmp_path / "run/details.json").exists()
# ── Task 7: run-to-run changes and the one-event view ───────────────────────
def _one(name, field, verdict):
return {"file": name, "attrs": {}, "results": [[field, verdict, "x", "y", "", None]]}
def test_compare_runs_finds_regressions_and_fixes(tmp_path):
prev, cur = tmp_path / "prev.jsonl.gz", tmp_path / "cur.jsonl.gz"
_write_results(prev, [_one("A.W", "SampleRate", "match"), _one("B.W", "notes", "sfm_blank")])
_write_results(cur, [_one("A.W", "SampleRate", "mismatch"), _one("B.W", "notes", "match")])
chg = report.compare_runs(prev, cur)
assert chg["regressions"] == [{"file": "A.W", "field": "SampleRate",
"before": "match", "after": "mismatch"}]
assert chg["fixed"] == 1
report.write_changes(chg, tmp_path / "changes.md")
assert "A.W" in (tmp_path / "changes.md").read_text()
def test_compare_to_marks_the_summary(tmp_path):
assert run.main([str(FIX), str(FIX), "--out", str(tmp_path / "a"), "--jobs", "1"]) == 0
assert run.main([str(FIX), str(FIX), "--out", str(tmp_path / "b"), "--jobs", "1",
"--compare-to", str(tmp_path / "a")]) == 0
assert "**0 regressions**" in (tmp_path / "b/summary.md").read_text()
assert (tmp_path / "b/changes.md").exists()
def test_file_prints_one_event(tmp_path, capsys):
assert run.main([str(FIX), str(FIX), "--file", "M007HVWF.K30W"]) == 0
out = capsys.readouterr().out
assert any("TranPPV" in line and "mismatch" in line for line in out.splitlines())