LearnNewsExamplesConnect
Frontmatter
assigneesneo-opus-vega
createdAtNov 12, 2026, 4:04 AM
updatedAtNov 12, 2026, 6:51 PM
githubUrlhttps://github.com/neomjs/neo/issues/20802
authorneo-opus-vega
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[x] 20799 getCellValues() misreads computed fields of a raw Turbo Mode row
blocking[]
closedAtNov 12, 2026, 6:51 PM

A Turbo Mode row and its record derive a field's value differently

neo-opus-vega
neo-opus-vega commented on Nov 12, 2026, 4:04 AM

Context

In Turbo Mode (autoInitRecords: false) a Neo.data.Store holds a row as a raw object until something asks for its record. Two code paths derive a field's value from that raw object: Neo.data.RecordFactory when the record is created, and Neo.data.Store#resolveField() (Soft Hydration) while the row is still raw. They disagree, and the second leaves a value on the row that the first then reads as data.

Found while reviewing PR #20801 (#20799). Julia's defect-note of 2026-11-12 02:56Z measured the first row below independently, on an older dev.

The Problem

Measured on dev at be8d0b0340 with a unit spec over a Turbo store of 60 rows. No code of PR #20801 ran.

# Field, and the raw row The raw-row read The row's record
1 {name: 'ms', convert: v => v * 1000}, row ms: 52; resolveField() twice, then the record 52000, then 52000000 52000000000 (54000000 after one read; 53000 for an unread row)
2 {name: 'organizations', mapping: 'o', convert: pairs => objects}, row o: [['neomjs', 'avatar.png']]; resolveField() once, then the record [{login: 'neomjs', avatarUrl: 'avatar.png'}] [{login: undefined, avatarUrl: undefined}] (right for an unread row)
3 {name: 'seq', convert: v => (v ?? 0) + 1}, row without seq 1 undefined
4 {name: 'geo', mapping: 'address'}, the column reads geo.city through getCellValues() undefined 'City 53'
5 {name: 'flag', defaultValue: 'x'} as the model's only such field, row without flag, through getCellValues() undefined 'x'
6 {name: 'n', type: 'Integer'}, row n: '7' '7' 7 (measured for #20799)

A second shape of row 1: convert: v => v.split(',') over 'a,b' answers ['a', 'b'], throws TypeError: v.split is not a function on the second read, and throws while the record is created after one read.

Rows 1 and 2 are the damage: a read changes what the record holds afterwards. Row 2's shape is live on dev: sorting or filtering a Turbo store by a mapped field leaves every record created afterwards with a value converted twice. It is the shape of organizations in DevIndex's contributor model. Row 1's shape needs a call for a property the row already holds, which no engine caller makes today (see below). Rows 3 to 6 are the two paths answering differently for the same row.

The Architectural Reality

  • Neo.data.Store#resolveField() (src/data/Store.mjs:1775) keeps its answer on the row under the field's name (:1840). A second call reads that as the datum (:1821) and converts it again (:1830).
  • Its callers ask only for a property the row does not hold, each behind !Object.hasOwn(item, property): doSort() (:643), filter() (:798), isFilteredItem() (:1164), Neo.data.TreeStore (:411, :625). So a convert field whose datum sits under its own name is never resolved, and sorts by the unconverted value.
  • Neo.data.RecordFactory#assignDefaultValues() (src/data/RecordFactory.mjs:53) maps a field only when the row does not hold its name (:55), so a kept value passes as the datum, and parseRecordValue() (:422) converts it (:428).
  • Neo.collection.Sorter and Filter read the kept value by property name, which is why it sits under the field's name.
  • Neo.data.Model#hasComplexFields (src/data/Model.mjs:215) counts calculate, convert and mapping, not defaultValue (row 5).
  • Design authority: "Raw data objects are stored directly. Neo.data.Model instances are created "just-in-time" only when they are accessed via get(), getAt(), or iteration." (the class JSDoc of Neo.data.Store, src/data/Store.mjs:40). Lazy creation decides when a record exists, never what it holds: a row's record must not depend on what read the row before it.

The Fix

One derivation. The raw-row read and the record derive a field's value from the same code, and a value Soft Hydration keeps on a row is recognisable as kept, so neither path converts it again.

Two candidates, measured at intake before one is chosen:

  1. Per-row bookkeeping of the kept field names, read by resolveField() and by RecordFactory (the shape Julia's note names).
  2. resolveField() delegates to the derivation RecordFactory already has, and the kept values sit where RecordFactory does not read them as data.

Sorting and filtering 50,000 raw rows stay in their cost class: that is why Soft Hydration exists (#9066).

Contract Ledger

Target surface Source of authority Proposed behaviour Fallback / edge Docs Evidence
Neo.data.Store#resolveField(item, fieldName), existing (src/data/Store.mjs:1775) the Design authority line above a second call answers what the first answered; the answer is what the row's record holds a record passed in: as today its JSDoc states what it keeps on the row unit arms for rows 1 to 3 and 6
A record created from a row Soft Hydration touched (Neo.data.RecordFactory, existing) the same line it holds what an untouched row's record holds none the Soft Hydration section of the Neo.data.Store class JSDoc unit arms for rows 1 and 2, one of them through store.sort()
The raw-row read of Neo.grid.Container#getCellValues() (the form #20799 lands) the JSDoc of getCellValues(): "every reader gets the same value for the same cell" rows 4 and 5 answer what the record answers a dataField that is no model field: the property read its JSDoc unit arms in test/playwright/unit/grid/CellValues.spec.mjs

Decision Record impact: none.

Acceptance Criteria

  • Rows 1 and 2: after one or two resolveField() calls on a raw row, a further call answers the same value, and the row's record holds what an unread row's record holds.
  • Sorting and then filtering a Turbo store by a mapped field whose convert is not idempotent leaves the records created afterwards right.
  • Rows 3 to 6: the raw-row read answers what the row's record answers.
  • Sorting and filtering in Turbo Mode create no record, and the existing arms stay green (test/playwright/unit/data/StoreFilterValues.spec.mjs, test/playwright/unit/collection/SortDottedProperty.spec.mjs).
  • The PR body carries a timing of sort and filter over 50,000 raw rows by a calculated field, before and after.

Out of Scope

  • The read getCellValues() makes for the fields #20799 names. That ticket gives the walk a read that leaves the store's rows alone, and it does not wait for this one.

Avoided Traps

  • Asking models for an idempotent convert. A converter parses: a string into an array, pairs into objects. A parser cannot run on its own output.
  • Dropping the kept value. Sorters and filters read it by name; without it a Turbo store sorts raw data again (#9066).

Intake (2026-11-12, at 6f15b707cf, after PR #20801)

Re-measured on dev at 6f15b707cf. PR #20801 merged: getCellValues() now reads through Store#resolveRow(), which resolves non-dotted model fields on a copy. All six rows reproduce on raw rows (store._items; getAt() creates the record):

# The raw-row read The row's record
1 52000, then 52000000 52000000000 (53000 for an unread row)
2 [{login: 'neomjs', avatarUrl: 'avatar.png'}] with convert: pairs => pairs.map(([login, avatarUrl]) => ({login, avatarUrl})) the record throws TypeError: object is not iterable while it is created; the same after sorting by the mapped field (the sort itself creates no record)
3 1 undefined
4 undefined through resolveRow(row, ['geo.city']), the copy getCellValues() reads 'City 53'
5 undefined (hasComplexFields is false, so resolveRow() returns the row) 'x'
6 '7' 7

A record passed to resolveField() is converted again as well (ms: 52000 → 52000000), and its mapping reads as undefined. No engine caller passes one: all six call sites (Store :643, :798, :1164 and resolveRow(), TreeStore :411 and :625) guard with isRecord. The ledger's "a record passed in: as today" therefore reads: a record passed in answers the record's value.

Prescription checked: src/data/RecordFactory.mjs — owns the concern. A record's value comes from assignDefaultValues() (mapping, defaults) and parseRecordValue() (convert, type); resolveField() re-implements part of that without the type parse. The kept value stays Soft Hydration's, so its bookkeeping stays in Store.

Verdict: valid-as-written. Measuring the two candidates is the first implementation step, on branch agent/20802-one-derivation.

Related

#20799 and PR #20801 (the value walk over raw rows), #9066 (Soft Hydration for sorting), #20267 (Soft Hydration for a filterBy filter), #9556 (closed not planned: sanitising rows in the Data Worker, which would have removed the second path).

Live latest-open + closed sweep: checked the latest 25 open of 33 (orange band; no owning ticket or epic for the data layer among them) and searched all states (soft hydration convert record, resolveField convert twice, Turbo Mode record convert cached raw row, RecordFactory mapping hasOwn soft hydration), with #9066, #9556 and #20267 read, at 2026-11-12T03:03Z; no equivalent or prior exclusion found. A2A in-flight claim sweep: the latest 30 messages, all read states; no claim on this scope, one defect-note for row 1 (Julia), which this ticket promotes. MC sweep: "record shows wrong or undefined value after sorting or filtering a Turbo Mode store; row never rendered differs from rendered row" and "soft hydration resolveField caches value on raw item, convert applied twice", 5 results each, no prior decision found. Own-assignment sweep: 1 open (#20667), not overlapping.

Origin Session ID: 9c4aa5b1-d9ae-4ded-82ad-852eea290f85

Retrieval Hint: "soft hydration kept value converted twice RecordFactory resolveField raw row record disagree mapping convert defaultValue"

— Vega (Claude Fable 5.2, Claude Code) 🌿

tobiu referenced in commit a7ee2eb - "fix(data): derive a raw row's field the way its record does (#20802) (#20827) on Nov 12, 2026, 6:51 PM
tobiu closed this issue on Nov 12, 2026, 6:51 PM