Found by the driver-materialisation consumer census on #13973 (class (c) — genuinely wrong on one side). That sweep is not addressed by this card and does not close it.
The site
packages/services/service-storage/src/stranded-orphan-inventory.ts:261-268:
report.samples.push({fileId: id,key: typeofrow.key==='string' ? row.key : undefined,name: typeofrow.name==='string' ? row.name : undefined,
size,createdAt: typeofrow.created_at==='string' ? row.created_at : undefined,// <-- here});row comes from engine.find('sys_file', { fields: [… 'created_at'], … }) at line 202-216 — a record read door, and created_at is explicitly in the projected field list.
Why it is wrong on the production default driver
created_at is a builtin audit column: not in datetimeFields, and SqlDriver#formatOutput repairs it only inside if (this.isSqlite). Pinned in packages/drivers/driver-sql/src/sql-driver-13567-audit-stamp-materialisation.test.ts — the live dialects hand it out as a JS Date, SQLite as canonical ISO-Z text.
So typeof row.created_at === 'string' is false on Postgres and MySQL for every row, and every sample in the operator's stranded-orphan report carries createdAt: undefined. On SQLite it is populated. The field is asked for from the driver and then silently discarded — the guard is doing the opposite of the defensive job its shape suggests.
The sibling guards on the same object (key, name) are correct: those are text columns on every dialect. Only the timestamp one straddles the divergence, which is what makes this hard to see by reading.
Severity is "operator report loses a field", not data loss — but the shape is the most legible instance of the class in the repo: a typeof v === 'string' test standing directly on a value whose runtime type is driver-dependent.
Why this is not a ?? fallback
Per #13973's standing prohibition, the question is which side owes the canonical spelling:
- A — accept both shapes at the consumer, as
packages/metadata-protocol/src/protocol.ts:7710-7715 already does for occurred_at (typeof … === 'string' ? … : … instanceof Date ? …toISOString() : String(…)), which is class (a) in the census precisely because of it. - B — normalise at the producer so the read door presents one shape per dialect — fixes every sibling site, but reverses a deliberate driver decision (
withPostgresCalendarDayAsText) and is a maintainer call.
Re-run
rg -n "typeof row\.created_at === 'string'" packages/services/service-storage/src/
Backlink: #13973 (census), #13382 (the OCC seam, the same class). Neither is addressed here.
Found by the driver-materialisation consumer census on #13973 (class (c) — genuinely wrong on one side). That sweep is not addressed by this card and does not close it.
The site
packages/services/service-storage/src/stranded-orphan-inventory.ts:261-268:rowcomes fromengine.find('sys_file', { fields: [… 'created_at'], … })at line 202-216 — a record read door, andcreated_atis explicitly in the projected field list.Why it is wrong on the production default driver
created_atis a builtin audit column: not indatetimeFields, andSqlDriver#formatOutputrepairs it only insideif (this.isSqlite). Pinned inpackages/drivers/driver-sql/src/sql-driver-13567-audit-stamp-materialisation.test.ts— the live dialects hand it out as a JSDate, SQLite as canonical ISO-Z text.So
typeof row.created_at === 'string'isfalseon Postgres and MySQL for every row, and every sample in the operator's stranded-orphan report carriescreatedAt: undefined. On SQLite it is populated. The field is asked for from the driver and then silently discarded — the guard is doing the opposite of the defensive job its shape suggests.The sibling guards on the same object (
key,name) are correct: those are text columns on every dialect. Only the timestamp one straddles the divergence, which is what makes this hard to see by reading.Severity is "operator report loses a field", not data loss — but the shape is the most legible instance of the class in the repo: a
typeof v === 'string'test standing directly on a value whose runtime type is driver-dependent.Why this is not a
??fallbackPer #13973's standing prohibition, the question is which side owes the canonical spelling:
packages/metadata-protocol/src/protocol.ts:7710-7715already does foroccurred_at(typeof … === 'string' ? … : … instanceof Date ? …toISOString() : String(…)), which is class (a) in the census precisely because of it.withPostgresCalendarDayAsText) and is a maintainer call.Re-run
Backlink: #13973 (census), #13382 (the OCC seam, the same class). Neither is addressed here.