Repository navigation
Value-lock raw regeneration tests; keep exact-byte pins on committed artifacts - #62
Merged
Merged
Conversation
…artifacts The two raw regeneration tests asserted regenerated == committed bytes. On 2026-08-14 the Oregon one failed locally while a value-level walk (floats at rel=1e-9) found zero differences: last-ulp float bytes from the optimizer, the same class PR #57 removed from the fixture test. Replace byte equality with a strict structural comparison (shared tests/conftest.py fixture): identical dict key lists, list lengths, and non-float values with exact types; floats at pytest.approx(rel=1e-9). Add planted-drift meta-tests that run in CI: a relative 1e-6 float mutation, a non-float change, a dropped key, an int retyped to float, and a key reorder must each fail the lock, while a one-ulp nudge must pass. Extend the fixture-test docstring rule accordingly: raw regeneration is value-locked, not byte-locked. Committed artifacts keep exact-byte pins: the Oregon SHA-256 test is untouched, and the RI/KY contract test gains the SHA-256 pin it was missing (6b8b9270). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Cross-family review (4-agent workflow + sol) converged on two findings: 1. Parsing both sides of the raw regeneration tests dropped coverage of the serializer's formatting; the SHA tests only pin committed files. Add cache-free round-trip tests (serialize_results(json.loads(raw)) == raw) for both artifacts — they run in CI, which the old byte-equality coverage (local-only, behind skipif) never did. 2. pytest.approx(rel=1e-9) silently kept its default abs=1e-12 floor. Make it explicit, document the max(1e-9 * |expected|, 1e-12) contract (the floor is load-bearing at the 91+294 exact-zero optimizer-clipped donor weights), pin it executably (test_value_lock_tolerance_contract), and plant a 2e-12 lift of a real zero donor weight in the drift meta-test. Docstrings tightened to the observed 2026-08-14 Oregon flake (both studies share the fit_weights optimizer) instead of a generalized claim. Comparator behavior is unchanged: explicit abs=1e-12 equals pytest's default (verified across magnitudes including 0.0), so the in-flight full-tier run against the previous commit remains valid. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…caught it First full value-locked run: 1 failed, 276 passed — the failure was the Oregon raw regeneration, and it was not float noise. build_results serialized the entire module-level CPI_U table; #59 widened that table to 2012-2016 for RI/KY, silently changing Oregon's regeneration output after its artifact was committed. Byte-equality failures had been unreadable (indistinguishable from BLAS last-ulp noise), which is exactly how this regression hid; the value lock failed with the precise path (outcome_definitions.cpi_u_annual_average key lists differ). Fix: emit the panel-years slice, mirroring the RIKY emitter. Verified the scoped dict equals the committed artifact's dict exactly, that the intersection values already matched, and that a regenerated draw passes the value lock against the committed artifact once scoped. Nothing else consumes cpi_u_annual_average. Docstrings updated to carry the verified story instead of the noise attribution. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
Author
Final merge-gate review (sol, gpt-5.6-sol via codex) — verdict on 972fa3dAPPROVE
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
The two raw regeneration tests asserted
regenerated == committed byteson optimizer output. Optimizer floats move in the last ulp across BLAS implementations (the PR #57 lesson) and across reruns, so byte-equality failures were unreadable — indistinguishable from noise. A 2026-08-14 local failure of the Oregon test was attributed to exactly that noise class. It turned out to be masking a real regression (below).What changed
tests/conftest.py(new): sharedassert_artifact_values_matchfixture — a strict structural value lock. Dicts must have identical key lists (same keys, same order), lists identical lengths, non-float leaves must match exactly with exact types (intvsfloatvsboolenforced); floats toleratemax(1e-9 · |expected|, 1e-12). The explicitabs=1e-12floor is load-bearing at the 91+294 exact-zero optimizer-clipped donor weights; every committed nonzero float exceeds 1e-3, sorelgoverns everywhere else.skipifgates unchanged (still local-cache-only).serialize_results(json.loads(raw)) == raw— value-locking the raw tests dropped their incidental coverage of serializer formatting; the round-trip restores it cache-free, which the old local-only byte tests never gave CI.test_value_lock_tolerance_contractexecutably pins the tolerance function.6b8b9270…).build_resultsserialized the entire module-levelCPI_Utable intooutcome_definitions.cpi_u_annual_average; Audit extension to FY2012: RI/KY pre-periods verified, threshold series complete #59 widened that table to 2012–2016 for RI/KY, silently changing Oregon's regeneration output after its artifact was committed. The emission is now scoped to the panel years, mirroring the RIKY emitter. Verified: the scoped dict equals the committed artifact's dict exactly; nothing else consumes the field.Verification
1 failed, 276 passed in 33:27— the one failure was the Oregon raw test flaggingoutcome_definitions.cpi_u_annual_averagewith the exact divergent path: the value lock catching the stale-CPI regression on its first run. The RI/KY raw regeneration (~30 min) passed under the value lock, demonstrating the noise-absorption side.280 passed in 36:34— fully green, both raw regeneration tests included.🤖 Generated with Claude Code