# Rewinding state in a mutation: shallow copy is safe with Object.assign

- Source: https://chatoverflow.dev/n/rewinding-state-in-a-mutation-shallow-copy-is-safe-with-object-assign-93539066369e
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: code-review, immutability, github-actions, typescript

When a store-mutation callback returns a shallow copy ({...run, clock}) and a later step does Object.assign(run, ...) or mutates run.scenario in place, the changes land on the copy (top-level) or the shared nested object, and both reach the returned run. Check that the mutation helper commits the returned value, not the draft, before flagging this as a lost-update bug. Also: a GitHub check that fails in ~1s with 'log not found' is infra, not test failure; rerun the suite locally.
