Repository navigation
Description
Problem
golden_diff.py is a standalone CLI script (sys.argv, print,
sys.exit), not a pytest test. Even once it's wired into CI (see companion
issue), it only runs as a special-cased shell step -- it's invisible to
pytest, doesn't show up in the existing "GitGalaxy Smoke Tests" workflow,
and produces raw print output instead of standard pytest failure diffs.
Separately, there's currently no committed golden_master.json fixture in
the repo to compare against -- the comparison logic (load_and_sanitize,
generate_deterministic_hash, deep_compare) is solid and should be kept
as-is, it just has nothing checked in to run against yet.
Fix
1. Wrap the existing logic in a real pytest test
New file, e.g. tests/test_golden_diff.py, reusing load_and_sanitize,
generate_deterministic_hash, and deep_compare from golden_diff.py
unchanged:
def test_golden_master_parity():
golden = load_and_sanitize("tests/golden_master/language_crucible_golden.json")
actual = load_and_sanitize("telemetry_out/<output_file>.json")
if generate_deterministic_hash(golden) == generate_deterministic_hash(actual):
return
diffs = deep_compare(golden, actual)
assert not diffs, "\n".join(diffs[:50]) + (f"\n... and {len(diffs)-50} more" if len(diffs) > 50 else "")This gets picked up automatically by the existing test-running workflows
rather than needing a bespoke CLI invocation.
2. Generate and commit a real golden_master.json fixture
- Store under version control, e.g.
tests/golden_master/language_crucible_golden.json. - Generate it from a deliberately-reviewed-correct run -- ideally after the
Two independent, disagreeing implementations of the same risk-scoring logic #249 and GuideStar documentation-coverage ignore filter always empty -- reads IGNORED_DIRECTORIES from the wrong config dict #311-full_api_network_map.py shadow-API discovery is case-sensitive, silently excludes uppercase-extension files #317 fixes land, so the baseline isn't cementing already-known
bugs into the "accepted truth" from day one. - Document in a comment or nearby README how/when this fixture gets
regenerated (ties into the governance issue).
Explicitly out of scope for this issue
- Actually wiring the CI step to call this test (companion issue -- can land
in either order, but both are needed for the full fix). - Golden-master update governance / preventing silent auto-overwrite
(separate issue).
Activity
Convert golden_diff.py's CLI invocation into a real pytest test (#329) (
Require deliberate, reviewable golden master updates (#330) (#399)
squid-protocol commentedon Jul 25, 2026
Resolved by #398: golden_diff.py's comparison is now a real pytest test (tests/test_golden_crucible.py), opt-in via the
golden_cruciblemarker, with the golden master fixtures committed in #395.