Repository navigation
SR-4c: pack hash v2 (engine) - #336
Merged
Merged
Conversation
compute_pack_hash frames each file as a u64be-length-prefixed name and content under a domain prefix, so a NUL byte in a file can no longer make two packs collide. pack_hash_matches accepts v2, and v1 only while no file in the pack holds a NUL byte. --verify-sha, selection pins, --trust-local, the install marker, chock.lock verify and provenance, and chock-market.lock all compare through it. chock.lock and chock-market.lock are version 2. Signed-off-by: Jothi Mani Rajendran <250249270+jothimani-rajendran@users.noreply.github.com>
…ent v1 end in 2.0 Signed-off-by: Jothi Mani Rajendran <250249270+jothimani-rajendran@users.noreply.github.com>
jothimani-rajendran
marked this pull request as ready for review
October 27, 2026 03:05
The base ruleset requires the head to be up to date before a merge. Signed-off-by: Jothi Mani Rajendran <250249270+jothimani-rajendran@users.noreply.github.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.
What
Engine step of pack hash v2 (org-plan
plan/pack-hash-v2.md, item SR-4c, decision D19).compute_pack_hashis v2:sha256("chock-pack-hash-v2\n" || per file: u64be(len(name)) name u64be(len(content)) content), files in UTF-8 byte order of the posix path. Specified in the docstring for a JS port._hash_v1), used only to recognise old hashes; accepted for all of 1.x, removed in 2.0.pack_hash_matches(dir, expected): v2, or v1 only while no file in the pack holds a NUL byte.--verify-shaand selection pins (verified_pack), local selection pins,--trust-local, the install marker's accepted hash,chock.lockverify (pack and compiled-artifacts hashes), provenance carry-over inbuild_lock, andchock-market.lock(v1 lock accepted while unambiguous).chock.locklockfile_versionis"2";chock-market.lockis2. Every writer writes v2.tests/fixtures/pack_hash_v2_vectors.json(includes a NUL pair that collides under v1, not v2).Tests
tests/test_pack_hash_v2.py(vectors, v1 accepted/refused by NUL, every site via a spy, v1 to v2 lock migration keepingsource_commit, a market lock with foreign keys refused unread).test_pack_hash_platform.pyandtest_marketplace.pyupdated to v2.Runtime goldens
No vendored runtime or
gate/file changed, so no golden file changes. The repo-rootchock.lockis untouched and still verifies under v1 (no NUL bytes); the owner'schock syncrewrites it as v2.Not in this PR:
docs/registry-and-lockfile.mdstill shows"lockfile_version": "1"(generated docs).