LearnNewsExamplesConnect
Frontmatter
assigneesTanNghiB2303833
createdAtNov 14, 2026, 1:00 AM
updatedAtNov 15, 2026, 5:21 AM
githubUrlhttps://github.com/neomjs/neo/issues/20913
authorneo-opus-vega
commentsCount2
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined1
signals[]
blockedBy[]
blocking[]
closedAtNov 15, 2026, 5:21 AM

TreeStore loses edits to a numeric parent's children in Turbo Mode

Closed v14.0.0/archive-v14-0-0-chunk-2 bughelp wantedgood first issueaicore
neo-opus-vega
neo-opus-vega commented on Nov 14, 2026, 1:00 AM

Context

Measured on dev a07f581f13 with a throwaway unit spec. A TreeStore in Turbo Mode (autoInitRecords: false) whose model keys records by an Integer id:

data: [
    {id: 1, name: 'a',  parentId: null, isLeaf: false, collapsed: true},
    {id: 2, name: 'a1', parentId: 1,    isLeaf: true}
]
Read Numeric ids (1, 2) String ids ('p', 'c'), control
getChildren(parent)[0] === getChildren(parent)[0] false true
get(child) === getChildren(parent)[0] false true
first.name = 'edited', then get(child).name 'a1' (the edit is lost) 'edited'
after await expand(parent), the visible row for the child the raw object, name: 'a1' the same record, name: 'edited'

Numeric keys are what most server data carries (database ids), and Turbo Mode is the store's documented strategy for large data sets (src/data/Store.mjs, the class JSDoc).

The Problem

In Turbo Mode a raw row becomes a record the first time it is read (hydrateRecord). The TreeStore must then swap that record into its Structural Layer, or the next read hydrates the same raw object again into a second record. For the children of a numeric parent the swap never happens. Every getChildren() call returns a new record, an edit lives only on the record it was made on, and expanding the parent shows the raw row with the old values.

The Architectural Reality

  • Ingestion files each raw row under its raw parentId: parentId = data.parentId || 'root' in TreeStore#splice (src/data/TreeStore.mjs:1109), then #addChild(parentId, …) (:118). The children of parent 1 sit in #childrenMap under the number 1.
  • TreeModel declares parentId as a String field (src/data/TreeModel.mjs:53), so the hydrated record's parentId is the string '1'.
  • TreeStore#hydrateRecord (:877) heals the sibling list under record.parentId (:891). It looks up '1', finds no list, and leaves the raw object in place. getChildren() (:766) hydrates that raw object again on the next call.

Design authority: TreeStore#hydrateRecord's JSDoc, “This acts as the Single Source of Truth for "Soft Hydration" in Turbo Mode, ensuring that when a raw data object becomes a Record, the TreeStore doesn't suffer from a split-brain.”, and getChildren()'s, “Records are hydrated on the way out, so Turbo Mode (autoInitRecords: false) callers receive real records rather than the raw objects held in the map.”

The Fix

In TreeStore#hydrateRecord, look the siblings up under the key ingestion used, the raw row's own parentId:

const parentId = item.parentId || 'root';

instead of record.parentId || 'root' (:891). item is always the raw row there: the block only runs when item is not a record.

Measured with that one line on dev a07f581f13: the numeric case reads like the control in all four rows of the table above, and the six test/playwright/unit/data/TreeStore*.spec.mjs files stay green. Add the numeric case as a unit test beside them.

Run the unit tier with npm run test-unit -- test/playwright/unit/data/TreeStore (the default npx playwright test config is not the unit one).

Acceptance Criteria

  • In Turbo Mode with an Integer key field and numeric parentIds, getChildren(parent)[0] returns the same record on every call, and get(child) returns that record (unit).
  • An edit made on that record is read back through get() and getChildren(), and after expand(parent) the visible row is that record (unit).
  • String ids behave as before: the existing TreeStore*.spec.mjs files pass unchanged.

Out of Scope

  • A key field that converts the raw key itself (a raw id: 1 under a String id field). There the record's own key differs from the key #allRecordsMap holds, which is a different path. Not measured here; file it separately if it reproduces.
  • Raw data that mixes types (numeric id, string parentId).
  • Eager instantiation (autoInitRecords: true, the default): not measured here.

Avoided Traps

  • Converting parentId at ingestion (filing children under String(parentId)). Every #childrenMap key would change, and every getChildren(1) caller would have to pass '1'. The one-line fix keeps the key the list was filed under.
  • Changing TreeModel's parentId field type. That changes the record's public parentId value for every consumer.

Related

#9415 (closed): Turbo Mode for the TreeStore, whose goal this restores, "without suffering from identity fragmentation between the main _items array and its internal tree maps" · #9404 (closed): the Tree Grid epic.

Live latest-open + closed sweep: the latest 20 open read (created descending) and closed searches (TreeStore parentId, TreeStore hydrateRecord, Turbo Mode getChildren, TreeStore numeric id; Out of Scope read on #20568, #9415's goal and #9539's body) at 2026-11-13T23:58Z; no equivalent and no exclusion of numeric keys. Backlog: 45 open (orange); no open ticket owns the TreeStore. A2A in-flight claim sweep: the last 30 messages, all read states, at 2026-11-13T23:59Z; no claim on the TreeStore. MC sweep: "TreeStore Turbo Mode numeric parent id: getChildren returns a new record every call, edits lost, hydrateRecord childrenMap not healed", 5 results: the March 2026 design of the healing (#9414, #9415), no decision about numeric keys. Own-assignment sweep: 1 open (#20667, package hosting), not overlapping. Structure map: N/A (Engine src/data, no file placed).

unowned-rationale: Ready for a contributor; maintainers provide planning and review.

Origin Session ID: 236696c2-9277-40e4-969a-025bbcd2ce4c Retrieval Hint: "TreeStore Turbo Mode numeric parentId hydrateRecord childrenMap split-brain getChildren new record"

TanNghiB2303833
TanNghiB2303833 Nov 14, 2026, 4:02 AM

I would like to work on this issue. I have reproduced the failure locally with a Turbo Mode TreeStore using integer id and numeric parentId, and verified that TreeStore#hydrateRecord misses #childrenMap because record.parentId is coerced to a String.

  • 2026-11-14T03:02:48Z @github-actions assigned to @TanNghiB2303833

@github-actions - 2026-11-14T03:02:49Z

Thanks for claiming this, @TanNghiB2303833, and welcome! Assigned to you — you can start now.

Your claim reserves this issue for 3 days (any comment here resets the clock; we still merge the first approve-worthy PR if another lands first or a claim goes quiet).

An automatic reply. How claims work [QUARANTINED_URL: github.com]

  • 2026-11-14T03:07:58Z @neo-opus-vega cross-referenced by #20928
  • 2026-11-14T08:24:35Z @neo-gemini-maryam cross-referenced by PR #20940
TanNghiB2303833 cross-referenced by PR #20995 on Nov 15, 2026, 4:02 AM
tobiu referenced in commit 5de02a7 - "fix(data): preserve raw parentId lookup in TreeStore#hydrateRecord (#20913) (#20995)" on Nov 15, 2026, 5:21 AM
tobiu closed this issue on Nov 15, 2026, 5:21 AM