Context
In Neo Pro's Workstation demo the grouped 100k matrix sorts its states by value (neomjs/neo-pro#10, sorters: [{property: 'status'}]). Since then, clicking a fleet's expand toggle on first load does nothing: 36 rows stay 36. Neo Pro's grouped e2e records it, red on its dev. Measured:
- With the sorter removed, the same click expands (bisected on the Pro store).
- A Pro unit arm expanding
healthy › Atlas on the store shows the row count unchanged, and the Atlas record no longer in the store (indexOf → -1).
The Problem
In Turbo Mode (autoInitRecords: false), re-adding a key that already exists:
- replaces the node in the Structural Layer (
#allRecordsMap.set; #addChild() swaps the sibling), while
Collection#splice skips keys already in map, so the visible layer keeps its old object.
The two layers now hold different objects for one key. get() hydrates the visible object, and TreeStore#hydrateRecord() heals #childrenMap by identity only (siblings.indexOf(item)). The structural sibling is a different object, so the heal misses silently.
expand() then marks the hydrated Record expanded and splices its children in. A sorted store re-sorts after every add (Collection#splice → doSort()), and TreeStore#doSort() re-projects _items from the Structural Layer. There it meets the stale raw node, still collapsed: the children vanish and the raw object replaces the Record.
Measured in the engine alone (no Pro code): a re-added root expanded in a sorted Turbo store loses its child. The unsorted control passes.
The Architectural Reality
src/data/TreeStore.mjs#hydrateRecord (the identity heal) versus #addChild(), which already falls back to a key scan for "a node whose two map entries have drifted apart".
src/data/TreeStore.mjs#doSort re-projects from #childrenMap; src/collection/Base.mjs#splice sorts after an add when autoSort and sorters are set.
- Neo Pro's
GroupingStore re-applies its projected data once construction finishes, which re-adds every group key. That is how the demo reaches the drift.
The Fix
TreeStore#hydrateRecord: when identity misses, find the sibling by key, the same fallback #addChild() uses, and heal it.
Unit test: test/playwright/unit/data/TreeStoreReAddExpand.spec.mjs re-adds a root as a new object and expands it, with sorters and without (control). The sorted arm fails on dev.
Acceptance Criteria
Out of Scope
- Making
Collection#splice replace the visible object on a re-add. That changes what a re-add means for every store; this ticket only stops the layers from staying split.
- GroupingStore's construct-time re-apply (neomjs/neo-pro#15 / #16), which is legitimate.
Related
#9432 (TreeStore split-brain on clear()), neomjs/neo-pro#10 (the sorter that exposed it), neomjs/neo-pro#23.
Sweeps: latest open engine issues plus all-state searches ("TreeStore hydrateRecord expand", "TreeStore split-brain childrenMap": #9432, #9539, #9411, #20212, #17839, none on this path), the A2A in-flight sweep and my own assignments, at 2026-11-07T17:1xZ. No equivalent found.
Retrieval Hint: "TreeStore hydrateRecord identity heal re-add sorted expand"
Context
In Neo Pro's Workstation demo the grouped 100k matrix sorts its states by value (neomjs/neo-pro#10,
sorters: [{property: 'status'}]). Since then, clicking a fleet's expand toggle on first load does nothing: 36 rows stay 36. Neo Pro's grouped e2e records it, red on itsdev. Measured:healthy › Atlason the store shows the row count unchanged, and the Atlas record no longer in the store (indexOf→ -1).The Problem
In Turbo Mode (
autoInitRecords: false), re-adding a key that already exists:#allRecordsMap.set;#addChild()swaps the sibling), whileCollection#spliceskips keys already inmap, so the visible layer keeps its old object.The two layers now hold different objects for one key.
get()hydrates the visible object, andTreeStore#hydrateRecord()heals#childrenMapby identity only (siblings.indexOf(item)). The structural sibling is a different object, so the heal misses silently.expand()then marks the hydrated Record expanded and splices its children in. A sorted store re-sorts after every add (Collection#splice→doSort()), andTreeStore#doSort()re-projects_itemsfrom the Structural Layer. There it meets the stale raw node, still collapsed: the children vanish and the raw object replaces the Record.Measured in the engine alone (no Pro code): a re-added root expanded in a sorted Turbo store loses its child. The unsorted control passes.
The Architectural Reality
src/data/TreeStore.mjs#hydrateRecord(the identity heal) versus#addChild(), which already falls back to a key scan for "a node whose two map entries have drifted apart".src/data/TreeStore.mjs#doSortre-projects from#childrenMap;src/collection/Base.mjs#splicesorts after an add whenautoSortand sorters are set.GroupingStorere-applies its projected data once construction finishes, which re-adds every group key. That is how the demo reaches the drift.The Fix
TreeStore#hydrateRecord: when identity misses, find the sibling by key, the same fallback#addChild()uses, and heal it.Unit test:
test/playwright/unit/data/TreeStoreReAddExpand.spec.mjsre-adds a root as a new object and expands it, with sorters and without (control). The sorted arm fails ondev.Acceptance Criteria
dev, green at the head; the control passes on both.unit/data,unit/gridandunit/collectionstay green.Out of Scope
Collection#splicereplace the visible object on a re-add. That changes what a re-add means for every store; this ticket only stops the layers from staying split.Related
#9432 (TreeStore split-brain on
clear()), neomjs/neo-pro#10 (the sorter that exposed it), neomjs/neo-pro#23.Sweeps: latest open engine issues plus all-state searches ("TreeStore hydrateRecord expand", "TreeStore split-brain childrenMap": #9432, #9539, #9411, #20212, #17839, none on this path), the A2A in-flight sweep and my own assignments, at 2026-11-07T17:1xZ. No equivalent found.
Retrieval Hint: "TreeStore hydrateRecord identity heal re-add sorted expand"