You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make entity merges derive from the latest Zustand state #1158
The current mergeEntities flow derives merged state from a snapshot captured before the Zustand setter executes. If state changes between snapshot capture and commit, the merge can operate on stale data and overwrite or omit concurrent changes.
Scope
Move all state-dependent merge calculation into the functional Zustand setter (or an equivalent serialized transaction that reads the latest state).
Keep merge behavior deterministic for entity fields, aliases, claims, links, tags and revision history.
Preserve referential integrity and existing deletion/merge rules.
Ensure the merge operation remains atomic from the UI/store perspective.
Audit callbacks that close over stale entity arrays in adjacent merge code.
Acceptance criteria
Merge calculation uses the latest state at commit time.
A regression test simulates an intervening state update and proves it is retained.
No claims, links, aliases or unrelated entity changes are silently lost.
Undo/redo and cross-tab merge behavior remain correct.
Export/import round-trip tests preserve the merged corpus.
Existing merge semantics are documented and unchanged except for the stale-state fix.
Related
Plan 214 code-review follow-up. Use the persistence-data-safety skill and real-corpus verification if the change affects canonical persistence.
mergeEntities derives from the latest store state at set() time (functional set + outcome container) so an intervening edit to the survivor is not clobbered (src/lib/studio/merge-entities).
Regression test merge-entities.test.ts ('does not overwrite an intervening edit'); comment states exactly what the test pins.
Activity
d-oit commentedon Nov 19, 2026
Implemented in #1178 (90246d1).
mergeEntitiesderives from the latest store state at set() time (functional set + outcome container) so an intervening edit to the survivor is not clobbered (src/lib/studio/merge-entities).merge-entities.test.ts('does not overwrite an intervening edit'); comment states exactly what the test pins.