fix(core): displace a container a migration re-key evicts from its slot#295
Merged
Conversation
put_slot_lww overwrote an occupied slot without displacing the live composite it evicted, unlike Map::set. A migration renaming a leaf field onto a key holding a live container with a higher stamp dropped the container from the slot but left it is_displaced()==false — so a later op targeting the detached container passed the displaced guard and silently mutated it, diverging from the op seam until a snapshot decode healed it. Displace the evicted live composite before the overwriting insert, mirroring Map::evict, skipping a same-handle re-install (the resurrect loop re-landing a container on its own key). Covers all three callers.
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.
Audit fix (cs-crdt-audit MEDIUM, displacement-signal class).
put_slot_lww— the LWW slot installer used by snapshot-migration re-keying — overwrote an occupied slot without displacing the live composite it evicted, unlikeMap::set.Impact: a migration renaming a leaf field onto a key holding a live container (Map/List/Text) with a higher stamp dropped the container from the slot but left it
is_displaced() == false. A later op targeting the detached container passed the displaced guard and silently mutated it — diverging from the op seam (whoseMap::setdisplaces the loser) until a snapshot decode ranmark_displacedand healed it.insert, mirroringMap::evict; skip a same-handle re-install (the resurrect loop re-landing a container on its own key). Fixed input_slot_lwwso all three callers are covered.state_project.rs: a leaf renamed onto a live map/list/text asserts the evicted container reads DISPLACED; a converge test asserts snapshot-seam and op-seam project identical bytes and that an op targeting the detached container is dropped on both seams.Fails before the fix (container reads installed), passes after.
Summary by cubic
Fixes migration re-key behavior so
put_slot_lwwdisplaces any container it evicts, matchingMap::setand preventing silent mutations of detached containers. Snapshot and op seams now converge when a leaf is renamed onto a key holding a liveMap/List/Text.Map::put_slot_lww, displace the evicted live composite before the overwrite; skip displacement on same-handle re-installs.Written for commit 545c5e0. Summary will update on new commits.