From 09f23163c743d1d7d67b5ab81d24c59debefd32f Mon Sep 17 00:00:00 2001 From: mes123456 Date: Wed, 2 Dec 2026 19:01:17 +0800 Subject: [PATCH] fix(web): reject stale AOV and lightgroup revision submissions setSceneViewLayerAOVs and setSceneViewLayerLightgroups declared an optional baseRevision that the Worker never compared, so a stale tab overwrote AOV and lightgroup edits without a conflict. Both now compare a supplied baseRevision against the current SceneIR and report REVISION_CONFLICT when it is stale or not a safe integer; an absent revision stays allowed, which matches the optional policy they declare. The revision contract moves the pair out of the unchecked set, and the Chromium probe confirms a stale submission leaves the rows untouched. 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 | 2 ++ web/protocol/web-engine-revisions.ts | 4 ++-- web/tests/unit/web-engine-revisions.test.mjs | 4 ++-- 6 files changed, 13 insertions(+), 11 deletions(-) diff --git a/docs/web/KNOWN_LIMITATIONS.md b/docs/web/KNOWN_LIMITATIONS.md index 96f2131f0..a645691ed 100644 --- a/docs/web/KNOWN_LIMITATIONS.md +++ b/docs/web/KNOWN_LIMITATIONS.md @@ -86,11 +86,11 @@ boundary; the legacy `parity-ledger.json` is historical planning data. `moveNLAStrip`, `editEditorContext`, `editShaderNode`, `setSequencerStrips`, `setSculptMeshAttributes` and the requested `baseRevision` of the modifier, constraint, curve-topology, Grease Pencil and NLA property commands are compared against `currentSnapshot` - inline. `setSceneViewLayerAOVs`, `setSceneViewLayerLightgroups`, `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 is a separate infrastructure batch. + 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. - 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 05c43b155..ec3599fdf 100644 --- a/docs/web/MODULE-COVERAGE.md +++ b/docs/web/MODULE-COVERAGE.md @@ -63,7 +63,7 @@ Rules: | MOD-OUTLINER-01 | The armature row was reported missing from the pose-constraint Outliner. It never was: the armature is a child of `ScaledRigParent` and sits one level deeper, exactly as desktop `make_object_parent_hierarchy_collections` builds it. Ten headed reruns failed because the expand loop in `web/tests/fixtures/native-ui-workflow.ts` clicked a label list scanned before earlier replies landed and re-clicked rows the reply had just opened, so the branch never stayed open. | None after the fix; before it the armature branch never settled open, so the row was unreachable from the Outliner. | `docs/web/KNOWN_LIMITATIONS.md` armature bullet; `web/tests/fixtures/native-ui-workflow.ts`; headed rerun of `armature panel operates on the selected bone` | RESIDUAL | P1 | `RESOLVED` | | MOD-OUTLINER-02 | The Rendering workspace appeared to render an empty Outliner. It has no native Outliner area to fill: desktop's Rendering screen holds Properties, Dope Sheet and Image Editor, the engine exports Outliner rows only for the active workspace, and the web layout drew the panel unconditionally. The panel now follows the native workspace areas, so Rendering draws no Outliner and other workspaces keep theirs. | None; object picking for a render starts from a workspace that has an Outliner, as on desktop. | `docs/web/KNOWN_LIMITATIONS.md` Rendering workspace bullet; `web/app/src/app/App.tsx` outliner area; probe snapshot of all eleven workspaces before and after switching to Rendering (panel count 1 → 0) | RESIDUAL | P2 | `RESOLVED` | | 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` carry a revision field that the Worker never compares. | Two tabs can overwrite each other's AOV and lightgroup edits without a conflict. | `web/protocol/web-engine-revisions.ts`, `web/tests/unit/web-engine-revisions.test.mjs` | RESIDUAL | P2 | `OPEN` | +| 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-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` | diff --git a/tools/web/check-rc-known-limitations.mjs b/tools/web/check-rc-known-limitations.mjs index 26e7d3fa1..0c4d6fd2b 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", - "`setSceneViewLayerAOVs`, `setSceneViewLayerLightgroups`, `setNLAStack` and", + "`setNLAStack` and `setSequencerTransitions` carry a revision field but do not reject a", "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 d6c0c1046..c5396fec4 100644 --- a/web/app/src/workers/web-engine.worker.ts +++ b/web/app/src/workers/web-engine.worker.ts @@ -3193,6 +3193,7 @@ function assertFutureCapability(payload: Extract candidate.id === payload.dataId); if (!scene || typeof payload.layerName !== "string" || payload.layerName.length === 0 || !Array.isArray(payload.aovs) || payload.aovs.length > 64) throw report("RENDER_PROPERTY_INVALID", "Scene ViewLayer AOV target is invalid"); + if (payload.baseRevision !== undefined && (!Number.isSafeInteger(payload.baseRevision) || payload.baseRevision !== currentSnapshot?.revision)) throw report("REVISION_CONFLICT", "Scene ViewLayer AOV base revision does not match the current SceneIR"); for (const aov of payload.aovs) { if (!aov || typeof aov.name !== "string" || new TextEncoder().encode(aov.name).byteLength > 63) throw report("RENDER_PROPERTY_INVALID", "Scene AOV names must be UTF-8 bounded strings"); if (aov.type !== 0 && aov.type !== 1) throw report("RENDER_PROPERTY_INVALID", "Scene AOV type is unsupported"); @@ -3202,6 +3203,7 @@ function assertFutureCapability(payload: Extract candidate.id === payload.dataId); if (!scene || typeof payload.layerName !== "string" || payload.layerName.length === 0 || !Array.isArray(payload.lightgroups) || payload.lightgroups.length > 128) throw report("RENDER_PROPERTY_INVALID", "Scene ViewLayer lightgroup target is invalid"); + if (payload.baseRevision !== undefined && (!Number.isSafeInteger(payload.baseRevision) || payload.baseRevision !== currentSnapshot?.revision)) throw report("REVISION_CONFLICT", "Scene ViewLayer lightgroup base revision does not match the current SceneIR"); for (const name of payload.lightgroups) { if (typeof name !== "string" || new TextEncoder().encode(name).byteLength > 63) throw report("RENDER_PROPERTY_INVALID", "Scene lightgroup names must be bounded strings"); } // Native permits an empty name only for a single-row rename and supplies Blender's unique default. return; } diff --git a/web/protocol/web-engine-revisions.ts b/web/protocol/web-engine-revisions.ts index 2044623b3..aa3eb4419 100644 --- a/web/protocol/web-engine-revisions.ts +++ b/web/protocol/web-engine-revisions.ts @@ -182,8 +182,8 @@ export const WEB_ENGINE_REVISION_CONTRACTS = { setSceneStampSettings: NONE, setSceneLineSettings: NONE, setSceneViewLayerPassSettings: NONE, - setSceneViewLayerAOVs: { policy: "OPTIONAL", field: "baseRevision", enforcement: "UNCHECKED", errorCode: "REVISION_CONFLICT", note: "The Worker preflight never compares the declared baseRevision." }, - setSceneViewLayerLightgroups: { policy: "OPTIONAL", field: "baseRevision", enforcement: "UNCHECKED", errorCode: "REVISION_CONFLICT", note: "The Worker preflight never compares the declared baseRevision." }, + setSceneViewLayerAOVs: { policy: "OPTIONAL", field: "baseRevision", enforcement: "WORKER_PREFLIGHT", errorCode: "REVISION_CONFLICT" }, + setSceneViewLayerLightgroups: { policy: "OPTIONAL", field: "baseRevision", enforcement: "WORKER_PREFLIGHT", errorCode: "REVISION_CONFLICT" }, renderFrame: NONE, renderAnimation: NONE, setRenderPasses: NONE, diff --git a/web/tests/unit/web-engine-revisions.test.mjs b/web/tests/unit/web-engine-revisions.test.mjs index c0c8f8eb2..c8fcb4065 100644 --- a/web/tests/unit/web-engine-revisions.test.mjs +++ b/web/tests/unit/web-engine-revisions.test.mjs @@ -86,13 +86,13 @@ const PREFLIGHT = [ "setModifierVisibility", "setNLAProperty", "setPoseConstraint", + "setSceneViewLayerAOVs", + "setSceneViewLayerLightgroups", "setSculptMeshAttributes", "setSequencerStrips", ]; const UNCHECKED = [ "setNLAStack", - "setSceneViewLayerAOVs", - "setSceneViewLayerLightgroups", "setSequencerTransitions", ];