Measured on dev32fb6cb32e with a throwaway unit probe: model field {name: 'id', type: 'String'}, rows {id: 1}, {id: 2} (TreeStore: {id: 1, parentId: null}, {id: 2, parentId: 1}, {id: 3, parentId: null}), once in Turbo Mode (autoInitRecords: false) and once eager:
A flat Store answers get(1) once, then null (Turbo), or never (eager). A TreeStore returns a new record on every get(1) and every getChildren(1), in both modes, so an edit on one of them is lost. With string ids every identity holds.
The Problem
A record's key is the converted value ('1'). Since #17716 the Store has a primitive for exactly that, Store#getCanonicalKey(value), but the stores' own boundaries never call it: a raw item registers under its raw key, get(key) looks the argument up as given, and TreeStore keeps raw items under raw keys in #allRecordsMap while records sit under converted keys.
The Architectural Reality
Store#getCanonicalKey (src/data/Store.mjs:1592) returns the key insertion stores, by delegating to RecordFactory's parser, or undefined outside its supported domain (calculate, convert, object results, NaN, absent). Its callers today: onPipelinePush, list/Base, list/Buffered, list/ValuePicker, component/Gallery, component/Helix, form/field/Chip.
Store#getKey(item) (:683) returns the raw value for a raw item and the converted value for a record.
Base Store#hydrateRecord (:1054) moves a map entry from the raw key to the record's key, which is why a second get(1) misses in Turbo Mode.
TreeStore#get (src/data/TreeStore.mjs:721) falls back to #allRecordsMap by the raw argument; TreeStore#hydrateRecord (:877) stores the record under its key and leaves the raw-key entry in place.
Design authority: getCanonicalKey's JSDoc: "a key whose wire type differs from the stored one is therefore not a near-miss but a miss".
The Fix
Use the canonical key at the stores' own boundaries:
Store#get(key), TreeStore#get(key) and TreeStore#getChildren(key) look up getCanonicalKey(key) ?? key.
A raw item registers in the map, and in TreeStore's #allRecordsMap, under its canonical key, so hydration has nothing to re-key.
The canonical key is one more call per row on the Turbo Mode ingestion path: measure 100,000 rows before and after.
Contract Ledger
Target Surface
Source of Authority
Proposed Behavior
Fallback / Edge Case
Docs
Evidence
Store#getKey(item)
Store#getCanonicalKey JSDoc (#17716): a key whose wire type differs from the stored one is a miss
A raw item's key is getCanonicalKey(value, modelOf(item)), the key its record will carry; a record's key is unchanged
null and undefined pass through; a value the primitive refuses (calculate, convert, NaN, an object result) keeps its raw value
Its Soft Hydration block already writes depth, isLeaf, childCount and collapsed into raw rows
A raw row whose parentId misses #allRecordsMap gets its canonical parentId, written into the row
A parentId that hits stays as given (#20913 owns numeric parent ids under an Integer key)
none
same
Turbo Mode ingestion, Store#add(rows, false)
AC-4
A raw key that already has the key field's canonical type costs no measurable canonicalization
A key that needs conversion pays the parser once per row
none
the 100,000-row table in the PR body
Rows anchored on PR #20940's head 0e989ed1 and its base b96f134316 (2026-11-14).
Acceptance Criteria
With a String key field and numeric raw ids, in both modes: get(1), a second get(1) and get('1') return the one record getAt(0) returns.
TreeStore, both modes: getChildren(1)[0] is the same record on every call and is get(2); an edit on it survives a later get(2).
String ids, a store without a declared key field, and a key the primitive refuses (calculate, convert) behave as before: the test/playwright/unit/data specs pass unchanged.
The ingestion of 100,000 Turbo Mode rows, before and after, is in the PR body, and rows whose raw key already has the key field's canonical type (Integer key with numeric ids, String key with string ids, in both stores) ingest within 10 % of the base median. (Budget added 2026-11-14 after the measurement on #20940: this ticket had assumed the call per row was cheap.)
Out of Scope
Numeric parent ids under an Integer key field: #20913 (a good first issue with its own one-line fix).
Live latest-open + closed sweep: checked the newest open (03:04Z) + closed searches (store get key type conversion raw key; keyProperty String numeric id store get null; hydrateRecord rawKey pk) at 2026-11-14T03:06Z; read #17716's fix and Out of Scope; no equivalent found, #17716's primitive is the prescription. Backlog: 52 open, red band; no owning epic.
A2A in-flight claim sweep: latest 12 messages at 03:04Z; no claim on this scope.
MC sweep: query_messages on the symptom found my defect-notes d75c4a88 and 4566d652 (recovered 40bc3b3a); this ticket promotes d75c4a88.
Own-assignment sweep: none overlapping.
unowned-rationale: A core data path with a hot-path measurement: a maintainer lane, not a good first issue.
Retrieval Hint: "getCanonicalKey at the store boundary", "numeric ids under a String key field", "TreeStore new record every get"
tobiu referenced in commit 60bd78c - "fix(data): canonicalize raw and lookup keys at Store and TreeStore boundaries (#20928) (#20940) on Nov 14, 2026, 4:46 PM
Context
Measured on
dev32fb6cb32ewith a throwaway unit probe: model field{name: 'id', type: 'String'}, rows{id: 1},{id: 2}(TreeStore:{id: 1, parentId: null},{id: 2, parentId: 1},{id: 3, parentId: null}), once in Turbo Mode (autoInitRecords: false) and once eager:Store autoInit=false | get(1)#1=record(id="1") get(1)#2=null same=false get('1')=record(id="1") same-as-#1=true getAt(0)===#1:true TreeStore autoInit=false | get(1)#1=record(id="1") get(1)#2=record(id="1") same=false | getChildren(1)[0] same=false get(2)===child:false get('2')===child:false Store autoInit=true | get(1)#1=null get(1)#2=null same=true get('1')=record(id="1") same-as-#1=false getAt(0)===#1:false TreeStore autoInit=true | get(1)#1=record(id="1") get(1)#2=record(id="1") same=false | getChildren(1)[0] same=false get(2)===child:false get('2')===child:falseA flat Store answers
get(1)once, thennull(Turbo), or never (eager). A TreeStore returns a new record on everyget(1)and everygetChildren(1), in both modes, so an edit on one of them is lost. With string ids every identity holds.The Problem
A record's key is the converted value (
'1'). Since #17716 the Store has a primitive for exactly that,Store#getCanonicalKey(value), but the stores' own boundaries never call it: a raw item registers under its raw key,get(key)looks the argument up as given, andTreeStorekeeps raw items under raw keys in#allRecordsMapwhile records sit under converted keys.The Architectural Reality
Store#getCanonicalKey(src/data/Store.mjs:1592) returns the key insertion stores, by delegating toRecordFactory's parser, orundefinedoutside its supported domain (calculate,convert, object results,NaN, absent). Its callers today:onPipelinePush,list/Base,list/Buffered,list/ValuePicker,component/Gallery,component/Helix,form/field/Chip.Store#getKey(item)(:683) returns the raw value for a raw item and the converted value for a record.Store#hydrateRecord(:1054) moves a map entry from the raw key to the record's key, which is why a secondget(1)misses in Turbo Mode.TreeStore#get(src/data/TreeStore.mjs:721) falls back to#allRecordsMapby the raw argument;TreeStore#hydrateRecord(:877) stores the record under its key and leaves the raw-key entry in place.getCanonicalKey's JSDoc: "a key whose wire type differs from the stored one is therefore not a near-miss but a miss".The Fix
Use the canonical key at the stores' own boundaries:
Store#get(key),TreeStore#get(key)andTreeStore#getChildren(key)look upgetCanonicalKey(key) ?? key.TreeStore's#allRecordsMap, under its canonical key, so hydration has nothing to re-key.The canonical key is one more call per row on the Turbo Mode ingestion path: measure 100,000 rows before and after.
Contract Ledger
Store#getKey(item)Store#getCanonicalKeyJSDoc (#17716): a key whose wire type differs from the stored one is a missgetCanonicalKey(value, modelOf(item)), the key its record will carry; a record's key is unchangednullandundefinedpass through; a value the primitive refuses (calculate,convert,NaN, an object result) keeps its raw value@summarytest/playwright/unit/dataStore#get(key),TreeStore#get(key),TreeStore#getChildren(parentId)'root', take no retry; an unknown key still returnsnull/[]@summaryStore#getCanonicalKey(value, model=this.model)modelOf()storesthis.model; otherwise unchanged@paramTreeStore#splice, raw rowsdepth,isLeaf,childCountandcollapsedinto raw rowsparentIdmisses#allRecordsMapgets its canonicalparentId, written into the rowparentIdthat hits stays as given (#20913 owns numeric parent ids under anIntegerkey)Store#add(rows, false)Rows anchored on PR #20940's head
0e989ed1and its baseb96f134316(2026-11-14).Acceptance Criteria
Stringkey field and numeric raw ids, in both modes:get(1), a secondget(1)andget('1')return the one recordgetAt(0)returns.TreeStore, both modes:getChildren(1)[0]is the same record on every call and isget(2); an edit on it survives a laterget(2).calculate,convert) behave as before: thetest/playwright/unit/dataspecs pass unchanged.Integerkey with numeric ids,Stringkey with string ids, in both stores) ingest within 10 % of the base median. (Budget added 2026-11-14 after the measurement on #20940: this ticket had assumed the call per row was cheap.)Out of Scope
Integerkey field: #20913 (a good first issue with its own one-line fix).Related
#17716 · #20913
Live latest-open + closed sweep: checked the newest open (03:04Z) + closed searches (store get key type conversion raw key; keyProperty String numeric id store get null; hydrateRecord rawKey pk) at 2026-11-14T03:06Z; read #17716's fix and Out of Scope; no equivalent found, #17716's primitive is the prescription. Backlog: 52 open, red band; no owning epic. A2A in-flight claim sweep: latest 12 messages at 03:04Z; no claim on this scope. MC sweep:
query_messageson the symptom found my defect-notes d75c4a88 and 4566d652 (recovered 40bc3b3a); this ticket promotes d75c4a88. Own-assignment sweep: none overlapping.unowned-rationale: A core data path with a hot-path measurement: a maintainer lane, not a good first issue.
Origin Session ID: 4b962e52-b40c-47fd-8297-e6e3d3879476
Retrieval Hint: "getCanonicalKey at the store boundary", "numeric ids under a String key field", "TreeStore new record every get"