Context
Neo.data.Store#updateRows() finds a batch's rows through getRow(), "the row the store holds under a key, as it holds it, hydrating none". writeRows() then hands the records to one Neo.data.RecordFactory#applyPreparedFields() call, so "a record that refuses its values leaves every row as it was". But applyPreparedFields() admits a record only when (store.allItems || store).get(key) === record (src/data/RecordFactory.mjs:461). The lookup that finds a row and the check that admits it can disagree.
Design authority: applyPreparedFields()' own JSDoc, "Distinct current records of this model. The store owner manages membership." And Neo.data.Store#writeRows: "The records adopt their values through one RecordFactory#applyPreparedFields call […]: a record that refuses its values leaves every row as it was." For which rows a store holds, Store#shouldReapplySorters already reads getRow(key) === record ("any other store every row it holds"). D#20857 placed "which rows its readers see" on the Store.
The problem
getRow() is the protected seam a subclass widens to hold rows that get() does not answer: Neo.data.TreeStore#getRow answers a row "under a collapsed parent or one the filters hide". A subclass that keeps filtered-out rows in its own structure, outside allItems, while its get() answers only visible rows, has its batch find a hydrated hidden record that the transaction then refuses with TypeError: Expected non-key fields on a record of this model.
Its only way through is to write such records with set() before super.writeRows(), outside the transaction. A batch that then refuses (a row of another model, a converter that throws) leaves those records written and their recordChange published: a partial write, the thing writeRows() promises cannot happen. TreeStore escapes this only because its get() also answers hidden nodes.
The architectural reality
Store#getRow(key) reads (this.allItems || this).map with the canonical-key fallback (Store.mjs:914). TreeStore#getRow adds its Structural Layer.
applyPreparedFields()'s check uses get(), which on a Turbo Mode store can hydrate a raw row. A membership check should not create a record.
Store#writeRows is applyPreparedFields()' only caller in the engine.
The fix
RecordFactory#applyPreparedFields() (src/data/RecordFactory.mjs) admits a record when store.getRow(store.getKey(record)) === record: the store owner's own lookup of what it holds, the one the batch found the row with. A record the store does not hold (removed, never added, or a stale instance) is refused as before.
- Specs (
test/playwright/unit/data/StoreUpdateRowsHeld.spec.mjs, new): a Store subclass whose getRow() holds a record that get() does not answer:
- writes that record in
updateRows() and publishes once;
- mixed with a row of another model, the batch refuses, and every row, the held record included, keeps its values, with no
recordChange or rowsChange published;
- a record the store does not hold is still refused.
Contract Ledger
| Target surface |
Source of authority |
Proposed behaviour |
Fallback |
Docs |
Evidence |
Neo.data.RecordFactory#applyPreparedFields admission |
Its JSDoc ("the store owner manages membership"); Store#writeRows; Store#shouldReapplySorters |
A record is admitted when its store's getRow() answers it |
A record the store does not hold throws the existing TypeError |
Method JSDoc names the predicate |
Unit |
Acceptance criteria
Out of scope
- What a subclass does with its own derived state (#20968's exclusion stands).
TreeStore row identity after a re-add: #21008, PR #21009. That PR touches collection/Base.mjs and TreeStore.mjs, not this file.
get() itself: what a store's get() answers is unchanged.
Avoided traps
- Widening a subclass's
get() to answer hidden rows: it changes every reader of get() to fix one writer.
- A dry-run of the batch in the subclass, validating before writing: it copies the engine's admission rules into every subclass.
- Rolling hidden writes back by hand: their
recordChange has already published.
Related
#20968 (the batch primitive) · D#20857 (its design) · #21008 / PR #21009 (adjacent, no shared file).
Ownership: self-assigned (Grace). It blocks one of my reviewed pull requests, so good first issue / help wanted do not apply.
Live latest-open + closed sweep: latest 20 open (54 open, red band; no owning epic for store write paths), open search (applyPreparedFields, updateRows, writeRows, "row batch": #21008, #20974, #21028, none equivalent) and closed search (applyPreparedFields, writeRows hidden: #20848, #20968, #20855; #20968's scope read) at 2026-11-15T15:13Z; A2A claims of the last hour checked, none on store write paths. MC sweep: "a refused row batch leaves a hidden record already written; partial write; applyPreparedFields refuses a record get() does not answer", 5 results: the #20968 design and D#20857, which place row visibility on the Store; no prior decision on admission. Own-assignment sweep: 5 open (#21028, #20986, #20911, #20884, #20790), none overlapping.
Origin Session ID: 42a76101-e5aa-4c83-8513-8709e3a84ec4
Retrieval Hint: "row batch admission: applyPreparedFields get() vs getRow(), hidden record written outside the transaction"
Context
Neo.data.Store#updateRows()finds a batch's rows throughgetRow(), "the row the store holds under a key, as it holds it, hydrating none".writeRows()then hands the records to oneNeo.data.RecordFactory#applyPreparedFields()call, so "a record that refuses its values leaves every row as it was". ButapplyPreparedFields()admits a record only when(store.allItems || store).get(key) === record(src/data/RecordFactory.mjs:461). The lookup that finds a row and the check that admits it can disagree.Design authority:
applyPreparedFields()' own JSDoc, "Distinct current records of this model. The store owner manages membership." AndNeo.data.Store#writeRows: "The records adopt their values through one RecordFactory#applyPreparedFields call […]: a record that refuses its values leaves every row as it was." For which rows a store holds,Store#shouldReapplySortersalready readsgetRow(key) === record("any other store every row it holds"). D#20857 placed "which rows its readers see" on the Store.The problem
getRow()is the protected seam a subclass widens to hold rows thatget()does not answer:Neo.data.TreeStore#getRowanswers a row "under a collapsed parent or one the filters hide". A subclass that keeps filtered-out rows in its own structure, outsideallItems, while itsget()answers only visible rows, has its batch find a hydrated hidden record that the transaction then refuses withTypeError: Expected non-key fields on a record of this model.Its only way through is to write such records with
set()beforesuper.writeRows(), outside the transaction. A batch that then refuses (a row of another model, a converter that throws) leaves those records written and theirrecordChangepublished: a partial write, the thingwriteRows()promises cannot happen.TreeStoreescapes this only because itsget()also answers hidden nodes.The architectural reality
Store#getRow(key)reads(this.allItems || this).mapwith the canonical-key fallback (Store.mjs:914).TreeStore#getRowadds its Structural Layer.applyPreparedFields()'s check usesget(), which on a Turbo Mode store can hydrate a raw row. A membership check should not create a record.Store#writeRowsisapplyPreparedFields()' only caller in the engine.The fix
RecordFactory#applyPreparedFields()(src/data/RecordFactory.mjs) admits a record whenstore.getRow(store.getKey(record)) === record: the store owner's own lookup of what it holds, the one the batch found the row with. A record the store does not hold (removed, never added, or a stale instance) is refused as before.test/playwright/unit/data/StoreUpdateRowsHeld.spec.mjs, new): aStoresubclass whosegetRow()holds a record thatget()does not answer:updateRows()and publishes once;recordChangeorrowsChangepublished;Contract Ledger
Neo.data.RecordFactory#applyPreparedFieldsadmissionStore#writeRows;Store#shouldReapplySortersgetRow()answers itTypeErrorAcceptance criteria
getRow()holds, but itsget()does not answer, is written insideupdateRows()'s one transaction (unit).devand green at the head; the full unit suite passes on both.Out of scope
TreeStorerow identity after a re-add: #21008, PR #21009. That PR touchescollection/Base.mjsandTreeStore.mjs, not this file.get()itself: what a store'sget()answers is unchanged.Avoided traps
get()to answer hidden rows: it changes every reader ofget()to fix one writer.recordChangehas already published.Related
#20968 (the batch primitive) · D#20857 (its design) · #21008 / PR #21009 (adjacent, no shared file).
Ownership: self-assigned (Grace). It blocks one of my reviewed pull requests, so
good first issue/help wanteddo not apply.Live latest-open + closed sweep: latest 20 open (54 open, red band; no owning epic for store write paths), open search (applyPreparedFields, updateRows, writeRows, "row batch": #21008, #20974, #21028, none equivalent) and closed search (applyPreparedFields, writeRows hidden: #20848, #20968, #20855; #20968's scope read) at 2026-11-15T15:13Z; A2A claims of the last hour checked, none on store write paths. MC sweep: "a refused row batch leaves a hidden record already written; partial write; applyPreparedFields refuses a record get() does not answer", 5 results: the #20968 design and D#20857, which place row visibility on the Store; no prior decision on admission. Own-assignment sweep: 5 open (#21028, #20986, #20911, #20884, #20790), none overlapping.
Origin Session ID: 42a76101-e5aa-4c83-8513-8709e3a84ec4
Retrieval Hint: "row batch admission: applyPreparedFields get() vs getRow(), hidden record written outside the transaction"