From 192b13901df066efa95d0b08ffd2c28447e607cd Mon Sep 17 00:00:00 2001 From: mes123456 Date: Wed, 2 Dec 2026 20:12:37 +0800 Subject: [PATCH] fix(web): reject stale sequencer transition timelines setSequencerTransitions parsed the submitted timeline without comparing timeline.revision, so a stale submission replaced the sequencer timeline instead of conflicting. It now compares timeline.revision against the current SceneIR and reports REVISION_CONFLICT, which is the check setSequencerStrips already makes. The revision contract moves the command out of the unchecked set, and the authoring probe takes its timeline from a snapshot read after its edits and records a stale submission next to an accepted one. Co-Authored-By: Claude Fable 5.2 --- docs/web/KNOWN_LIMITATIONS.md | 10 ++++++---- docs/web/MODULE-COVERAGE.md | 2 +- tools/web/check-rc-known-limitations.mjs | 2 +- web/app/src/workers/web-engine.worker.ts | 3 ++- web/protocol/web-engine-revisions.ts | 2 +- web/tests/e2e/b3-sequencer-authoring-probe.spec.ts | 6 +++++- web/tests/unit/web-engine-revisions.test.mjs | 2 +- 7 files changed, 17 insertions(+), 10 deletions(-) diff --git a/docs/web/KNOWN_LIMITATIONS.md b/docs/web/KNOWN_LIMITATIONS.md index a645691ed..bf1461301 100644 --- a/docs/web/KNOWN_LIMITATIONS.md +++ b/docs/web/KNOWN_LIMITATIONS.md @@ -87,10 +87,12 @@ boundary; the legacy `parity-ledger.json` is historical planning data. `setSculptMeshAttributes` and the requested `baseRevision` of the modifier, constraint, curve-topology, Grease Pencil and NLA property commands are compared against `currentSnapshot` inline, and so are `setSceneViewLayerAOVs` and `setSceneViewLayerLightgroups` when they carry one. - `setNLAStack` and `setSequencerTransitions` carry a revision field but do not reject a stale value, - and `editShaderNode` reports staleness as `INVALID_ARGUMENT`. The shared contract and its tests live - in `web/protocol/web-engine-revisions.ts` and `web/tests/unit/web-engine-revisions.test.mjs`; Worker - adoption for the remaining two commands is a separate infrastructure batch. + `setSequencerTransitions` compares `timeline.revision` against `currentSnapshot` the way + `setSequencerStrips` does. `setNLAStack` still carries a revision field but does not reject a stale + value, and `editShaderNode` reports staleness as `INVALID_ARGUMENT`. The shared contract and its + tests live in `web/protocol/web-engine-revisions.ts` and + `web/tests/unit/web-engine-revisions.test.mjs`; Worker adoption for the remaining command is a + separate infrastructure batch. - Keyframe evidence stays PARTIAL: the Outliner keyframe case `outliner-keyframe-keys-web` proves the native keyframing operators ran and an action datablock appeared. The Outliner tree does not expose fcurve or keyframe counts, so no count assertion is made. No new engine evidence is claimed. diff --git a/docs/web/MODULE-COVERAGE.md b/docs/web/MODULE-COVERAGE.md index ec3599fdf..b1947ef32 100644 --- a/docs/web/MODULE-COVERAGE.md +++ b/docs/web/MODULE-COVERAGE.md @@ -65,7 +65,7 @@ Rules: | MOD-PROPERTIES-01 | The armature panel case could not run because its first step selects the armature row. Same cause as MOD-OUTLINER-01. | None after the fix. | `web/tests/e2e/armature-editor-coverage-ui-production.spec.ts` | RESIDUAL | P1 | `RESOLVED` | | MOD-PROPERTIES-02 | `setSceneViewLayerAOVs` and `setSceneViewLayerLightgroups` carried a revision field that the Worker never compared, so a stale submission was accepted and two tabs could overwrite each other's AOV and lightgroup edits. Both now compare a supplied `baseRevision` against the current SceneIR revision and reject staleness with `REVISION_CONFLICT`; an absent revision stays allowed, matching the declared `OPTIONAL` policy. | None after the fix; a stale tab now gets `REVISION_CONFLICT` instead of silently winning. | `web/protocol/web-engine-revisions.ts`; `web/tests/unit/web-engine-revisions.test.mjs`; Chromium probe: fresh revision applied, stale and non-integer rejected without changing the AOV or lightgroup rows | RESIDUAL | P2 | `RESOLVED` | | MOD-NLA-01 | `setNLAStack` carries a revision field that the Worker never compares. | A stale NLA stack submission is accepted instead of rejected. | `web/protocol/web-engine-revisions.ts` | RESIDUAL | P3 | `OPEN` | -| MOD-SEQUENCER-01 | `setSequencerTransitions` parses the timeline without comparing `timeline.revision`. | Stale transition edits are accepted. | `web/protocol/web-engine-revisions.ts` | RESIDUAL | P2 | `OPEN` | +| MOD-SEQUENCER-01 | `setSequencerTransitions` parsed the timeline without comparing `timeline.revision`, so a stale transition edit was accepted. It now compares `timeline.revision` against the current SceneIR and rejects staleness with `REVISION_CONFLICT`, the same check `setSequencerStrips` makes. | None after the fix; a stale submission now fails instead of overwriting the sequencer timeline. | `web/protocol/web-engine-revisions.ts`; `web/tests/unit/web-engine-revisions.test.mjs`; Chromium probe on `sequencer_scene.blend`: stale timeline rejected, current snapshot's timeline applied | RESIDUAL | P2 | `RESOLVED` | | MOD-SPREADSHEET-01 | The Spreadsheet browses, filters and exports but offers no edit path. | Dataset editing stays in the desktop editor. | `web/tests/e2e/web-spreadsheet-readonly.spec.ts` | RESIDUAL | P3 | `PARTIAL` | | MOD-ANIM-01 | Keyframe evidence stops at "an action datablock appeared": the Outliner tree exposes no fcurve or keyframe counts, so no count assertion is made. | Reviewers cannot confirm key counts from the tree. | `docs/web/KNOWN_LIMITATIONS.md` keyframe bullet; `outliner-keyframe-keys-web` | RESIDUAL | P3 | `FROZEN` | | MOD-DOPESHEET-01 | The Dope Sheet is exercised only through animation specs that assert on other surfaces. | A Dope Sheet regression could pass the suite. | `web/tests/e2e/b5-animation-ui-production.spec.ts` | RESIDUAL | P3 | `PARTIAL` | diff --git a/tools/web/check-rc-known-limitations.mjs b/tools/web/check-rc-known-limitations.mjs index 0c4d6fd2b..622a67029 100644 --- a/tools/web/check-rc-known-limitations.mjs +++ b/tools/web/check-rc-known-limitations.mjs @@ -37,7 +37,7 @@ for (const required of [ "the armature object was never missing from the Outliner", "The Rendering workspace Outliner gap is closed by desktop parity", "Revision-conflict handling is per command in the engine Worker", - "`setNLAStack` and `setSequencerTransitions` carry a revision field but do not reject a", + "`setNLAStack` still carries a revision field but does not reject a stale", "fcurve or keyframe counts, so no count assertion is made", ]) { assert.ok(limitations.includes(required), `known limitations omit: ${required}`); diff --git a/web/app/src/workers/web-engine.worker.ts b/web/app/src/workers/web-engine.worker.ts index c5396fec4..0be6a98ed 100644 --- a/web/app/src/workers/web-engine.worker.ts +++ b/web/app/src/workers/web-engine.worker.ts @@ -3310,7 +3310,8 @@ function assertFutureCapability(payload: Extract candidate.id === payload.sceneId)) throw report("SEQUENCER_SCHEMA_INVALID", "Sequencer transition scene is invalid"); - parseSequencerTimeline(payload.timeline); + const timeline = parseSequencerTimeline(payload.timeline); + if (timeline.revision !== currentSnapshot?.revision) throw report("REVISION_CONFLICT", "Sequencer transition timeline revision does not match the current SceneIR"); return; } case "setSequencerColorBalance": { diff --git a/web/protocol/web-engine-revisions.ts b/web/protocol/web-engine-revisions.ts index aa3eb4419..c559d6016 100644 --- a/web/protocol/web-engine-revisions.ts +++ b/web/protocol/web-engine-revisions.ts @@ -206,7 +206,7 @@ export const WEB_ENGINE_REVISION_CONTRACTS = { setNLAProperty: { policy: "OPTIONAL", field: "baseRevision", enforcement: "WORKER_PREFLIGHT", errorCode: "REVISION_CONFLICT" }, setSequencerStrips: { policy: "REQUIRED", field: "timeline.revision", enforcement: "WORKER_PREFLIGHT", errorCode: "REVISION_CONFLICT" }, setSequencerStripModifiers: NONE, - setSequencerTransitions: { policy: "REQUIRED", field: "timeline.revision", enforcement: "UNCHECKED", errorCode: "REVISION_CONFLICT", note: "The Worker parses the timeline without comparing its revision." }, + setSequencerTransitions: { policy: "REQUIRED", field: "timeline.revision", enforcement: "WORKER_PREFLIGHT", errorCode: "REVISION_CONFLICT" }, setSequencerColorBalance: NONE, setCompositorNodeGraph: NONE, setTrackingMarkers: NONE, diff --git a/web/tests/e2e/b3-sequencer-authoring-probe.spec.ts b/web/tests/e2e/b3-sequencer-authoring-probe.spec.ts index 9930045cd..83753153f 100644 --- a/web/tests/e2e/b3-sequencer-authoring-probe.spec.ts +++ b/web/tests/e2e/b3-sequencer-authoring-probe.spec.ts @@ -36,7 +36,11 @@ test("sequencer color balance and modifiers reach native Main", async ({ page }) { id: `${strip.id}:cb`, type: 'COLOR', enabled: true }, { id: `${strip.id}:bc`, type: 'BRIGHT_CONTRAST', enabled: false }, ] }); - log.transitions = await apply({ type: 'setSequencerTransitions', sceneId: scene.id, timeline }); + /* The transition command now rejects a stale timeline revision, so take the + * timeline from a snapshot read after the two edits above. */ + const freshScene = (await send({ type: 'snapshot' })).snapshot.scenes[0]; + log.transitions = await apply({ type: 'setSequencerTransitions', sceneId: scene.id, timeline: freshScene.sequencer ?? freshScene.sequencerTimeline ?? null }); + log.staleTransitions = await apply({ type: 'setSequencerTransitions', sceneId: scene.id, timeline }); log.after = await send({ type: 'snapshot' }).then((r: any) => ({ revision: r.snapshot.revision, strips: (r.snapshot.scenes[0].sequencer?.strips ?? []).length }), (e: Error) => `ERR ${e.message}`); log.undo = await send({ type: 'applyCommand', payload: { type: 'undo' } }).then((r: any) => r?.status ?? 'ok', (e: Error) => `ERR ${e.message}`); log.redo = await send({ type: 'applyCommand', payload: { type: 'redo' } }).then((r: any) => r?.status ?? 'ok', (e: Error) => `ERR ${e.message}`); diff --git a/web/tests/unit/web-engine-revisions.test.mjs b/web/tests/unit/web-engine-revisions.test.mjs index c8fcb4065..efa607fac 100644 --- a/web/tests/unit/web-engine-revisions.test.mjs +++ b/web/tests/unit/web-engine-revisions.test.mjs @@ -90,10 +90,10 @@ const PREFLIGHT = [ "setSceneViewLayerLightgroups", "setSculptMeshAttributes", "setSequencerStrips", + "setSequencerTransitions", ]; const UNCHECKED = [ "setNLAStack", - "setSequencerTransitions", ]; const keysBy = (select) => Object.keys(CONTRACTS).filter((type) => select(CONTRACTS[type])).sort();