Schema version 5: platform-independent hash that covers custom types - #82
Merged
Conversation
The schema hash is now FNV-1a 64 of the schema text without its own hash line. It is the same on every platform, any decoder can recompute it to verify a file, and it changes whenever anything in the schema changes, including custom type bodies; two schemas that differ only inside a struct no longer collide in a sink's hash-to-channel map. - library: SchemaTextHash()/ComputeSchemaHash() replace AddFieldToHash; the hash is recomputed at every registration and custom type addition. - header-only parser: accepts version 4 and 5, takes Schema::hash from the declared line, check_hash verifies version 5 texts against the FNV value. - python: schema_hash(text), parse_schema(..., verify_hash=True). - golden test compares schema.txt byte for byte, including the hash, and checks Schema::hash == SchemaTextHash(text); fixture regenerated. - spec section 5 rewritten as normative; version history added. Parsers older than this release reject version 5 files explicitly instead of decoding them wrongly; PlotJuggler needs its data_tamer dependency bumped. Closes #73. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…files AddFieldToHash stays in the header-only parser; version 4 texts are matched by their declared hash and, with check_hash, verified with the version 4 recipe exactly as before. Version 5 texts use SchemaTextHash. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
facontidavide
force-pushed
the
fix/schema-hash-fnv
branch
from
September 12, 2026 18:00
c5bf84c to
6683d5a
Compare
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.
Resolves the remaining item of #73 and the "implementation-defined hash" caveat introduced in #78.
What changes
The schema hash becomes FNV-1a 64 of the schema text with its own
### hash:line removed. Consequences:std::hash), so any decoder can recompute and verify it;SCHEMA_VERSIONbumps to 5.Compatibility
check_hash/verify_hash=True).data_tamerdependency bumped for the 2.0 release.Code
SchemaTextHash()/ComputeSchemaHash()replaceAddFieldToHash(library and parser).schema.txtbyte for byte including the hash and checksSchema::hash == SchemaTextHash(text); fixture regenerated. The Python test verifies the hash independently, so both implementations of FNV-1a agree on the real fixture.Targets
V2together with #75.🤖 Generated with Claude Code