Problem
applySimSpecChange in src/diagram/Editor.tsx (currently around lines 1166-1190) performs a full-payload read-modify-write on sim specs: it reads the CURRENT project.simSpecs from the controller snapshot and builds a complete setSimSpecs payload (all six fields) with the one updated field substituted.
ProjectController.applyPatch calls are not queued/serialized against each other. If a second sim-specs commit fires while the first one's engine round-trip + snapshot refresh is still in flight, the second payload is built from a stale snapshot: it carries the first field's OLD value and silently reverts it (classic lost update).
Why it matters
Correctness: a user edit can be silently discarded with no error and no visible indication, leaving the model with a stale sim-spec value (e.g. reverted dt or stop time).
Severity / reachability
Currently only reachable in a sub-second window (WASM applyPatch + serialize round-trip) that a human tabbing between fields realistically cannot hit -- which is why this is tracked rather than hotfixed. The window would widen if patch application ever becomes slower or genuinely async (e.g. worker offload), so it should not be left to rot.
History
Component
src/diagram -- Editor.tsx (applySimSpecChange), ProjectController.applyPatch.
Possible approaches
- Send a partial
setSimSpecs patch containing only the changed field, so concurrent payloads compose instead of overwriting each other.
- Serialize
applyPatch calls in ProjectController (queue them so each read-modify-write observes the previous patch's result).
Context
Identified during the interactive-editing burndown (branch interactive-editing-burndown, PR forthcoming), flagged by the adversarial reviewer of the #55 change and confirmed pre-existing.
Problem
applySimSpecChangeinsrc/diagram/Editor.tsx(currently around lines 1166-1190) performs a full-payload read-modify-write on sim specs: it reads the CURRENTproject.simSpecsfrom the controller snapshot and builds a completesetSimSpecspayload (all six fields) with the one updated field substituted.ProjectController.applyPatchcalls are not queued/serialized against each other. If a second sim-specs commit fires while the first one's engine round-trip + snapshot refresh is still in flight, the second payload is built from a stale snapshot: it carries the first field's OLD value and silently reverts it (classic lost update).Why it matters
Correctness: a user edit can be silently discarded with no error and no visible indication, leaving the model with a stale sim-spec value (e.g. reverted
dtor stop time).Severity / reachability
Currently only reachable in a sub-second window (WASM
applyPatch+ serialize round-trip) that a human tabbing between fields realistically cannot hit -- which is why this is tracked rather than hotfixed. The window would widen if patch application ever becomes slower or genuinely async (e.g. worker offload), so it should not be left to rot.History
Component
src/diagram--Editor.tsx(applySimSpecChange),ProjectController.applyPatch.Possible approaches
setSimSpecspatch containing only the changed field, so concurrent payloads compose instead of overwriting each other.applyPatchcalls inProjectController(queue them so each read-modify-write observes the previous patch's result).Context
Identified during the interactive-editing burndown (branch
interactive-editing-burndown, PR forthcoming), flagged by the adversarial reviewer of the #55 change and confirmed pre-existing.