test(fixtures): run the byte check on every matching builder - #109
Merged
Conversation
test_public_fixtures_match_the_source_generator_byte_for_byte gated the regeneration on Python 3.12 and returned early otherwise. The CI 3.10 and 3.11 lanes carry SQLite 3.53.1 and SQLAlchemy 2.0.52, which are exactly the required versions, so their early return skipped the inner guard assertion too and the test verified nothing on two of the three lanes. The same Python gate skipped both tamper tests there. The committed bytes do not depend on the Python version. CPython 3.10.20, 3.11.15 and 3.12.13, each carrying SQLite 3.53.1 and SQLAlchemy 2.0.52, regenerate all ten committed artifacts with identical sha256 digests, so the determinants the provenance builder block names are complete. Select on those two versions alone: a matching builder always regenerates and compares, and a non-matching builder always asserts that the generator refuses to write. Neither path returns without an assertion. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
test_public_fixtures_match_the_source_generator_byte_for_bytegated the regeneration on Python 3.12:That
returnwas written for lanes that cannot reproduce the committed bytes. The 3.10 and 3.11 CI lanes ship SQLite 3.53.1 and resolve SQLAlchemy 2.0.52, which are exactlyREQUIRED_SQLITE_VERSIONandREQUIRED_SQLALCHEMY_VERSION. Soactual == expectedthere, the inner branch never runs, and the function returns having asserted nothing. Two of the three test lanes checked the fixtures in name only._is_the_reference_buildercarried the samesys.version_infoclause, so both tamper tests from #107 skipped on 3.10 and 3.11 too.The measured baseline on this Mac, running the file on main:
Half a second is the tell. Regenerating both fixtures takes about four seconds, and the 3.10 lane never spent it.
Is generation byte-identical across Python versions?
Yes, and I measured it instead of assuming. Three venvs on macOS arm64, one per interpreter, each pinned to SQLAlchemy 2.0.52, each running
generate_allinto a scratch directory:Every sha256 agrees across the three interpreters and with what is committed.
demo_new/recording.dbcomes outbcd9d62065ab9bfca346a43a0fd347a6321dd2c2de69e44ef8e9e2475afa65b9on all of them. So the Python version is not a determinant of the bytes, and the provenancebuilderblock is complete as written. It needs no new field.Canvas.pngexplains why. It compresses withstrategy=zlib.Z_FIXEDatlevel=9, memLevel=9, wbits=15, which pins fixed Huffman coding and keeps zlib's version-dependent block heuristics out of the output.The change
Select on the two library versions alone. A matching builder always runs
check_generated. A non-matching builder always asserts that the builder guard raises. Neither path returns without an assertion._is_the_reference_builderloses its Python clause as well, so the tamper tests now run wherever the byte check runs.Verification
Both branches, locally:
pytest.raisesbranch and the tamper tests skip, which is correct for a builder that cannot reproduce the bytes.The three CI lanes are the second half of the proof. If 3.10 or 3.11 on Linux x86-64 produced different bytes from macOS arm64, the byte check would now fail there loudly rather than pass in silence.
🤖 Generated with Claude Code