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 <noreply@anthropic.com>
This commit is contained in:
mes123456
2026-12-02 20:12:37 +08:00
parent d3260cb0cb
commit 192b13901d
7 changed files with 17 additions and 10 deletions

View File

@@ -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}`);

View File

@@ -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();