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
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"
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'sconvertandtype.Measured at Engine
7fae35d397and Proc9b17edwith a unit probe:Intfield averaged over 2 and 3 reads2on the group row, not2.5.convert: value => value * 1000, summed over the converted 1000 and 2000, reads3000000, not3000.Where it happens:
resolveField()keeps the converted value on the row.get()orgetAt()hydrate the group row.The showcase's Workstation store averages an
Intprogressfield. Its model has types only (no complex fields), so an unhydrated group row reads2.5, andget()hydrates it into a record that reads2.The Problem
A subclass whose population holds rows of another shape has no way to say so. It can override
resolveField()andresolveRow()for its rows. But the records come from two sites that namethis.modeldirectly:createRecord()andhydrateRecord(). A subclass overridinghydrateRecord()to create the record itself would duplicate the method's map replacement andTreeStore's healing.The Architectural Reality
Design authority: n/a: this adds a seam and calls no existing behavior wrong.
Neo.data.Storenamesthis.modelfor a raw row at four sites:createRecord(),hydrateRecord(),resolveField()(getField(),deriveRecordData()) andresolveRow().RecordFactorykeys 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), whichStore#afterSetModel()sets for the store's own model only.TreeStore#hydrateRecord()calls the base and then heals its maps; it needs no change.fieldsconfig merges into its class's by name (Neo.mergeDeepArrays), and anullvalue 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 returnsthis.modelby 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 itsstoreId.Contract Ledger
Neo.data.Store#modelOf(item)(protected, new)storeIdthis.modelStore#createRecord(),#hydrateRecord(),#resolveField(),#resolveRow()modelOf()for the raw row in hand. A record answers its own fields inresolveField()and passes throughresolveRow()Acceptance Criteria
modelOf()returns a second model for marked rows (unit arms):resolveField()andresolveRow()derive a marked row by the second model.createRecord()(with records) and byhydrateRecord()(Turbo Modeget()andgetAt()) are of the second model.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.TreeStoresubclass that hydrates a marked row heals its maps as for any other row (unit arm).modelOf()returnsthis.modelby default, and the data, collection, tree and grid unit suites pass unchanged.modelOf()on the method and at the four sites.Out of Scope
RecordFactory.Avoided Traps
store.modelaround a call:modelis a reactive config, and changing it has effects.hydrateRecord()to create the record itself: it duplicates the replacement and the tree's healing.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:
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"