Skip to content

test(fixtures): run the byte check on every matching builder - #109

Merged
abrichr merged 2 commits into
mainfrom
codex/fixture-byte-check-all-lanes
Aug 27, 2026
Merged

test(fixtures): run the byte check on every matching builder#109
abrichr merged 2 commits into
mainfrom
codex/fixture-byte-check-all-lanes

Conversation

@abrichr

@abrichr abrichr commented Aug 27, 2026

Copy link
Copy Markdown
Member

test_public_fixtures_match_the_source_generator_byte_for_byte gated the regeneration on Python 3.12:

if sys.version_info[:2] != (3, 12):
    actual = (sqlite3.sqlite_version, sqlalchemy.__version__)
    expected = (REQUIRED_SQLITE_VERSION, REQUIRED_SQLALCHEMY_VERSION)
    if actual != expected:
        with pytest.raises(RuntimeError, ...):
            check_generated(...)
    return

That return was 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 exactly REQUIRED_SQLITE_VERSION and REQUIRED_SQLALCHEMY_VERSION. So actual == expected there, 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_builder carried the same sys.version_info clause, 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:

interpreter result wall clock
CPython 3.10.20 5 passed, 6 skipped 0.48s
CPython 3.11.15 5 passed, 6 skipped 0.43s
CPython 3.12.13 11 passed 4.24s

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_all into a scratch directory:

interpreter SQLite SQLAlchemy all 10 artifacts match the committed bytes
CPython 3.10.20 3.53.1 2.0.52 yes
CPython 3.11.15 3.53.1 2.0.52 yes
CPython 3.12.13 3.53.1 2.0.52 yes

Every sha256 agrees across the three interpreters and with what is committed. demo_new/recording.db comes out bcd9d62065ab9bfca346a43a0fd347a6321dd2c2de69e44ef8e9e2475afa65b9 on all of them. So the Python version is not a determinant of the bytes, and the provenance builder block is complete as written. It needs no new field.

Canvas.png explains why. It compresses with strategy=zlib.Z_FIXED at level=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_builder loses its Python clause as well, so the tamper tests now run wherever the byte check runs.

Verification

Both branches, locally:

  • 3.10.20, 3.11.15 and 3.12.13 with the required libraries: 11 passed, 0 skipped on each.
  • 3.12.13 with SQLAlchemy 2.0.51 held back deliberately: 5 passed, 6 skipped. The byte check takes the pytest.raises branch 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

abrichr and others added 2 commits August 27, 2026 18:29
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>
@abrichr
abrichr merged commit 86e6419 into main Aug 27, 2026
12 checks passed
@abrichr
abrichr deleted the codex/fixture-byte-check-all-lanes branch August 27, 2026 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant