[atomic-reuse] Preserve concurrent updates arriving during an asynchronous row save #54
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Affected path
Scope: atomic-reuse only for this reproduced defect.
/atomic-reuse(AtomicLibDemo+AtomicTable)db-table-editor-native)db-table-editor-atomiceditor on NG ORMAtomicTable.This scope does not claim that the NG editors have no independent correctness problems. Reproductions used commit
be8938078d97a70519a991ade8b9207d07067c5f, and current main's relevant source was checked to match. Temporary focused tests reproduced the defects; no fix or permanent regression test has been added.Problem
The adapter checks the baseline and clones the current Resource before awaiting its field setters. An external update can arrive after that check. The demo persistence callback then inserts the complete older clone with
skipCommitCompare: true, replacing the updated Resource and losing an unrelated field change.Sources: baseline, clone and asynchronous setters, demo persistence callback.
The NG editor applies changed fields to an observable ORM row instead of persisting a complete Atomic clone through this callback. This reproduction is not evidence of the same mechanism in NG or a claim about Atomic Server commit behavior.
Deterministic reproduction
Using the setup/helper variables in
tests/unit/atomic-table.test.ts:Observed: Count becomes 99 on external insertion, then reverts to 2 after the title save finishes. The final assertion fails. This was reproduced with a controlled adapter-level interleaving, not by sequentially clicking two demo buttons. Existing tests cover an update arriving before save starts, not this window.
Acceptance
Related: #51 is membership; #52 is performance, not this save race.
The React update handling is proposed in #57 for both NG-backed table editors and
/atomic-reuse. Incoming changes update untouched draft fields; overlapping scalar edits retain the draft and expose explicit resolution choices. Native controls preserve invalid intermediate text when an external edit arrives.This is a partial mitigation, not a fix for the asynchronous save race described here. The gap after conflict checking and before persistence remains, so #54 stays open. Closing it still requires a concurrency-safe check-and-apply operation in the persistence path. All 336 unit tests, six typechecks, 12 production builds and 22 focused browser tests passed locally.