Harden remote scene commit convergence - #539
Conversation
…ration-sfx # Conflicts: # packages/core/src/schema/nodes/level.test.ts # packages/core/src/schema/nodes/level.ts # packages/core/src/store/use-scene.ts
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit d0afde1. Configure here.
| !Number.isSafeInteger(change.position) || | ||
| change.position < 0 || | ||
| siblings?.[change.position] !== id || | ||
| !areScenePatchValuesEqual(current, change.node) |
There was a problem hiding this comment.
Strict delete rejects extra fields
High Severity
Remote structural deletes require the delete payload to match the local node with full key-for-key equality. Local nodes that retained forward-compatible or plugin-only fields from earlier host creates/updates often have extra keys the delete payload omits, so valid remote deletes are rejected and the scene cannot converge.
Reviewed by Cursor Bugbot for commit d0afde1. Configure here.


What
Why
Realtime collaborators need deterministic convergence without remote commits corrupting undo/history state or stripping hosted plugin data. The previous package test command also rediscovered compiled test output, adding duplicate work and misleading failures.
Impact
Hosted collaboration can apply exact remote structural, field, and material changes while keeping local interactions safe. CI retains the source tests but avoids duplicate compiled copies.
Checks
bun run test— 11/11 Turbo tasks green from the private monorepobun run typecheck— 10/10 Turbo tasks greenNote
High Risk
Large changes to the scene store’s host/collaboration commit path (structural graph, validation, history, dirty tracking) affect data integrity and realtime convergence.
Overview
Adds
applySceneOperationPatchand exportsSceneOperationPatch/ structural patch types so hosted realtime can apply node creates/deletes together with field and material updates in one atomic host commit.applyScenePatchis now a thin wrapper over that path.Remote/host patch semantics change materially: patches are validated and applied via a single precomputed next state (invalid ops fail without partial writes). Host commits no longer blanket-reject while undo/history is paused—they apply when they don’t touch nodes with live overrides/transforms or structural parents under active live edit; colliding patches still return
false. History pause is scoped so external tool pauses aren’t accidentally resumed. Dirty marking/clearing is extended for structural edits (siblings, deleted subtrees, bounded dirty sets on large scenes).LevelNode.childrenstops enumerating every core child ID in Zod and accepts any string ID, so persisted levels can reference plugin-minted children; child-kind validation stays in the registry.Tooling:
bun testruns onlysrc, andtsconfigexcludes*.test.*from compilation to avoid duplicate/stale compiled tests.Reviewed by Cursor Bugbot for commit d0afde1. Bugbot is set up for automated code reviews on this repo. Configure here.