Repository navigation
fix(ffi)!: hash a note's tags and links in meta.hash - #2636
Merged
Merged
Conversation
Notes carry tags and links since #2588, but compute_directive_hash left both out of a note's digest, so two notes differing only in tags or links shared an identity. Hash them exactly as a document's are: the tag and link counts always, then each element length-prefixed. Every note's meta.hash changes, untagged ones included (decided on #2598). Closes #2598 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_012nNGPA44Dt32NyxWem26xr
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
📊 Benchmark Results
vs base, measured in this run
A difference counts only when it clears the combined spread of the two measurements, per shape (2σ: What do these numbers mean?
|
Contributor
✅ Compatibility Test Results
What's tested
Full results available in workflow artifacts |
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_012nNGPA44Dt32NyxWem26xr
# Conflicts: # CHANGELOG.md
Member
Author
Review loop
Converged after round 2. The note hash test fails with the fix reverted (all 8 pairs collide). 🤖 Generated with Claude Code |
# Conflicts: # CHANGELOG.md
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
compute_directive_hash(surfaced asmeta.hash) now hashes a note's tags and links, exactly as a document's and a transaction's are: the tag count and the link count always, then each element, length-prefixed (crates/rustledger-ffi-wasi/src/hash.rs, Note arm).Why
Notes carry tags and links since #2588, but the Note arm still left both out of the digest, so two notes differing only in tags or links shared an identity. This implements the decision recorded on the issue (option A): counts always, so every note's hash changes, untagged ones included. That is the same trade the Document fix made; the rejected alternative was a suffix emitted only when non-empty.
Breaking for
meta.hashconsumers: every note'smeta.hashchanges. rustfava's snapshots need regenerating together with the next release (they already need it for the expected 8 failures). CHANGELOG entry under Breaking.How tested
note_tags_and_links_are_part_of_the_identityinhash_identity_properties.rs: a tag vs none, a link vs none, different tag, different link, the same name as a tag vs a link,tags [a,b]vstags [a] links [b],links [a,b]vstags [a] links [b],tag "ab"vstags [a,b]. With the fix reverted, all 8 cases collide (test fails); with it, none do.cargo test -p rustledger-ffi-wasi --all-features, workspace clippy (--all-features --all-targets -D warnings),cargo doc -D warnings.meta.hash(it is computed on conversion), so no CACHE_VERSION bump.Closes #2598
🤖 Generated with Claude Code
https://claude.ai/code/session_012nNGPA44Dt32NyxWem26xr