fix: make repository metadata updates conflict-safe - #7090
Open
mo0ooo wants to merge 1 commit into
Open
Conversation
Signed-off-by: GPT <9d2d69e45be446edf9645e5b4dd62801ce14ea9cd0ae43467cc48a663e6dae5f@buzz.local>
🔐 Codex Security Review
|
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.
Summary
Repository metadata updates currently stamp
created_atas the observedannouncement plus one second. Once that announcement is more than 15 minutes
old, the relay's timestamp-drift gate permanently rejects
repos protect set,repos protect remove, andrepos bind.This change:
max(now, observed + 1);buzz-expected-revisiontag naming the announcement the CLI read;existing Postgres coordinate lock;
The revision precondition closes the lost-update hole left by a timestamp-only
max(now, head + 1)fix: a delayed Buzz writer cannot use the fresh timestampto overwrite metadata that changed after its read.
Related issue
Fixes #2876
Fixes #4431
Fixes #4432
This supersedes the timestamp-only approaches in #2901, #4363, #4509, and
#6282 by pairing wall-clock freshness with an atomic revision check.
Testing
origin/main@c3132c3; exact PR tip5af1be774ffc22722eb6c48c89c38b551987bacbcargo fmt --all -- --check(Rust 1.95.0): passedRUST_TEST_THREADS=2 cargo test --locked -p buzz-core -p buzz-cli -p buzz-db -p buzz-relay: passed; relay library 997passed, relay binary 13 passed, all doc tests passed
cargo test --locked -p buzz-db conditional_parameterized_replacement_allows_one_concurrent_writer_and_replay -- --ignored: 1 passedcargo clippy --locked -p buzz-core -p buzz-cli -p buzz-db -p buzz-relay --all-targets -- -D warnings: passedconformance trace for conditional exact replay
2026-08-28;
repos protect setsucceeded and stored a current timestamp,the original metadata, one protection rule, and exactly one expected
revision tag;
conflict with process exit 5;
exactly one expected-revision tag.
With Redis enabled, the full relay suite also exposed a pre-existing
demo_join_forwarded_arm_round_trips_echocancellation bug on unmodifiedorigin/main: a 100ms drain tick can drop an in-progress framed receive. TheCAS files do not overlap that path; it is being fixed and reviewed separately
on
codex/mesh-recv-cancel-safeinstead of being folded into this PR.No production relay deployment, PR merge, branch deletion, or external-account
call was performed.