Repository navigation
Check stamp inputs after taking their history fingerprint - #4376
Merged
Merged
Conversation
An event could land after the unlocked stamp read its log but before _checked captured the source/history fingerprints. The final comparison then accepted a check against the older log. An agent message claiming an authored ID in that gap let the stamp publish duplicate identities. Take the fingerprint before reading the log on the unlocked path; transaction callers retain their held events. The existing fingerprint comparison now rechecks that append without extending the lock or adding retries. The regression admits a real agent message at the read boundary. It failed before the fix because the stamp succeeded, and passes after because the ID collision is refused before publishing a second note. All 10 stamp/publication checks in test_interact_document pass.
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.
A
leaf page stampcould validate an outdated log while treating its fingerprint as current. If an agent message landed after the log read but before the fingerprint, the stamp could publish authored markup using an ID that the message had just claimed. This fixes the read order so the existing transaction check detects that append and validates again before publishing.The unlocked check now takes its source/history fingerprint before reading events. Checks already holding the transaction continue using its event list. This preserves #3878’s behavior: a tab can activate a save while the stamp checks it, and publication alone holds the transaction.
Validation: the new regression deterministically admits a message in the read/fingerprint gap; it fails before the fix because stamping succeeds, and passes afterward because the ID collision is refused without a second version note. All 10 tests selected by
tests/model/test_interact_document.py -k "stamp or publish"pass. No browser behavior changes.