Repository navigation
repair: opt-in ForeignPolicy::Hold keeps a fold on a foreign incarnation - #55
Merged
Merged
Conversation
…ion; adopt_incarnation re-anchors it
A fold that is the only full copy (its consumer is the bucket's only writer) is
destroyed by the foreign-cursor repair: the new stream starts empty and the
key-listing diff deletes every key it lacks. BatchConfig::on_foreign chooses:
Repair (default, unchanged) or Hold, under which the watch ends with the typed
KvError::Foreign { old_incarnation, new_incarnation } and never touches the fold.
WatchCursor::adopt_incarnation(new) resumes on the new stream afterwards.
The decision is protocol::foreign_action, proven in Verus with hold_proofs.rs;
mutants mut_hold_repairs, mut_repair_holds, mut_adopt_unrecorded go red.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… a structure pin; drop circular proofs - adopt_incarnation is an order: run_watch repairs the fold to the new stream's listing (the repair Hold deferred) before following it, so the fold is the new stream and exports no phantom key. - Delete hold_proofs.rs (its lemmas restated their premise); the no-write half is tests/hold_structure.rs with fixture mutants. - Live tests: export after adoption, second recreate, stale adoption. Document known limits. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…aking; default unchanged) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.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.
A consumer whose fold is the only full copy loses it when its bucket is deleted and recreated: the foreign-cursor repair deletes every key the new stream lacks.
BatchConfig::on_foreign: ForeignPolicy::{Repair (default, unchanged), Hold}.KvError::Foreign { old_incarnation, new_incarnation }; no key is deleted or overwritten, and the fold stays complete at its old cursor.WatchCursor::adopt_incarnation(new)is the resume cursor that re-anchors the fold on the new stream. From then on it folds normally, and keys the new stream deletes are deleted. Keys it never wrote stay: removing them is the caller's job.protocol::foreign_action, called byrepair::run_watch. Proven in Verus inprotocol.rsandhold_proofs.rs. Mutants:mut_hold_repairs,mut_repair_holds,mut_adopt_unrecorded.tests/recreated_stream.rsrun against a real nats-server.🤖 Generated with Claude Code
Note: the no-write-before-return half of Hold is a capability-style structure pin (tests/hold_structure.rs: a source check with fixture mutants), not a Verus property.