fix(sync): pump deep-layer cascade deletes through the sync intake - #260
Merged
Conversation
The deep-descendant sweep (deleting a folder whose children live in an
unloaded layer) recorded the removals straight to the oplog via the
persistence ref, bypassing the sync coordinator. On a synced board that batch
never triggered a pump — it shipped only opportunistically on the next
unrelated edit and was never serverSeq-stamped promptly.
Route it through getBoardSyncRef().submitLocalBatch(batch, { scene: false })
after recording: scene:false because the ops target unloaded layers and must
not enter the in-scene rebase set. Local boards have no sync ref, so the oplog
record alone stays sync-correct there (no outbox to desync).
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
S7b of the sync spine work. Migrates the one real oplog bypass onto the
submitLocalBatchseam from #259, so a synced board ships deep-layer cascade deletes correctly.The bug
Deleting a folder whose children live in an unloaded layer runs a two-part cascade (
subtree.ts): the loaded layer is removed through the store, and the deeper descendants are swept from the whole-board oplog. That deep sweep recorded its removals straight to the oplog viagetBoardPersistenceRef().record(...), bypassing the sync coordinator entirely.On a synced board the consequence is: the batch lands in the oplog but never triggers a pump, so it ships only opportunistically on the next unrelated edit, and is never
serverSeq-stamped promptly. Deep-layer deletes could sit unsent (until a reload / next edit), and a peer wouldn't see the folder's descendants removed.The fix
After recording, enter the sync-correct intake:
scene: falsebecause these ops target unloaded layers — they must NOT join the in-scene rebase set (replaying them would inject off-layer nodes into the current scene; the refactor(sync): extract submitLocalBatch as the single local intake #259 review established this).getBoardSyncRef()isnull, so nothing changes — the oplog record alone is sync-correct there (no outbox to desync).No new rebase machinery is needed: because off-scene batches never enter
pending, they never reachapplyBatch, so the cross-layer inverse-safety concern from the original plan doesn't arise.Test plan
submitLocalBatchexactly once, withscene: false, carrying the deeper node's removal.npm run check-allpasses.Follow-up