LearnNewsExamplesConnect
Frontmatter
assigneesneo-opus-vega
createdAtNov 13, 2026, 12:47 AM
updatedAtNov 13, 2026, 4:41 AM
githubUrlhttps://github.com/neomjs/neo/issues/20846
authorneo-opus-vega
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtNov 13, 2026, 4:41 AM

A store cannot give a projected row its own model

Closed v14.0.0/archive-v14-0-0-chunk-1 enhancementaicore
neo-opus-vega
neo-opus-vega commented on Nov 13, 2026, 12:47 AM

Context

Pro's grouping store (neomjs/neo-pro#185) projects group rows into its own population. A group row's aggregates, a sum or an average, are computed by the store; they are not data. The engine derives and creates every raw row through this.model, so a group row's aggregates run through the leaf field's convert and type.

Measured at Engine 7fae35d397 and Pro c9b17ed with a unit probe:

  • An Int field averaged over 2 and 3 reads 2 on the group row, not 2.5.
  • A field with convert: value => value * 1000, summed over the converted 1000 and 2000, reads 3000000, not 3000.

Where it happens:

  • In Turbo Mode, on the first read: resolveField() keeps the converted value on the row.
  • With records, when the record is created.
  • In Turbo Mode again, when get() or getAt() hydrate the group row.

The showcase's Workstation store averages an Int progress field. Its model has types only (no complex fields), so an unhydrated group row reads 2.5, and get() hydrates it into a record that reads 2.

The Problem

A subclass whose population holds rows of another shape has no way to say so. It can override resolveField() and resolveRow() for its rows. But the records come from two sites that name this.model directly: createRecord() and hydrateRecord(). A subclass overriding hydrateRecord() to create the record itself would duplicate the method's map replacement and TreeStore's healing.

The Architectural Reality

Design authority: n/a: this adds a seam and calls no existing behavior wrong.

  • Neo.data.Store names this.model for a raw row at four sites: createRecord(), hydrateRecord(), resolveField() (getField(), deriveRecordData()) and resolveRow().
  • RecordFactory keys record classes by ${model.className}.${model.id}, so a second model instance gets its own record class.
  • RecordFactory#onRecordChange() sends a record's change to the store its model names (model.storeId), which Store#afterSetModel() sets for the store's own model only.
  • TreeStore#hydrateRecord() calls the base and then heals its maps; it needs no change.
  • A fields config merges into its class's by name (Neo.mergeDeepArrays), and a null value overrides. So a subclass can build the second model from the first.

The Fix

Add a protected Store#modelOf(item): the model a raw row derives from and becomes a record of. It returns this.model by default, and the four sites ask it, for a raw row only. A subclass that projects rows of another shape answers with that shape's model, which names the store as its storeId.

Contract Ledger

Target Surface Source of Authority Proposed Behavior Fallback Docs Evidence
Neo.data.Store#modelOf(item) (protected, new) This ticket The model a raw row derives from and becomes a record of. It is asked for a raw row only. An answered model names the store as its storeId this.model JSDoc Unit arms below
Store#createRecord(), #hydrateRecord(), #resolveField(), #resolveRow() Their existing JSDoc Each asks modelOf() for the raw row in hand. A record answers its own fields in resolveField() and passes through resolveRow() The default keeps them identical JSDoc of each Existing suites unchanged; arms with a subclass

Acceptance Criteria

  • For a Store subclass whose modelOf() returns a second model for marked rows (unit arms):
    • resolveField() and resolveRow() derive a marked row by the second model.
    • Records created by createRecord() (with records) and by hydrateRecord() (Turbo Mode get() and getAt()) are of the second model.
    • A record of the second model answers a field only that model has, the same through resolveField() as raw and by its getter, and the marker need not be a field of either model. modelOf() is never asked about a record.
    • A write to a record of the second model reaches the store that model names.
    • Unmarked rows are unchanged.
  • A TreeStore subclass that hydrates a marked row heals its maps as for any other row (unit arm).
  • modelOf() returns this.model by default, and the data, collection, tree and grid unit suites pass unchanged.
  • JSDoc names modelOf() on the method and at the four sites.

Out of Scope

  • The grouping store's group model: neomjs/neo-pro#185.
  • Sorting and filtering semantics, and RecordFactory.

Avoided Traps

  • Swapping store.model around a call: model is a reactive config, and changing it has effects.
  • A subclass overriding hydrateRecord() to create the record itself: it duplicates the replacement and the tree's healing.
  • Asking modelOf() about a record: an override tells its rows apart by raw data, which a record need not declare (review of PR 20847, Round 1).

Related

neomjs/neo-pro#185 (blocked by this), #20802, #20799, #20827.

Live latest-open + closed sweep, 2026-11-12 at 23:5xZ; no equivalent found:

  • Latest 20 of 32 open issues (orange band; no owning ticket or epic for a store's row model).
  • Closed searches: "modelOf store", "per-row model store", "hydrateRecord model", "group row parse aggregate". I read #20802's Out of Scope and Avoided Traps.
  • A2A of the last hour: no claim on a store model seam.

MC sweep: "group row record parsed through the leaf model field type; aggregate average truncated to integer in grouped grid", 5 results, no prior decision found. Own-assignment sweep: 1 open (#20667), not overlapping.

Origin Session ID: 316a9998-ef29-41f9-8f03-e2887bfa880d Retrieval Hint: "store modelOf per-row model projected group row parses aggregate leaf field type convert hydrateRecord"

tobiu referenced in commit ad58c10 - "feat(data): let a store give a projected row its own model (#20846) (#20847) on Nov 13, 2026, 4:41 AM
tobiu closed this issue on Nov 13, 2026, 4:41 AM