Found while implementing #13973 (the read door's canonical instant shape). Not addressed there, and this card does not close it; #13973 remains open for its own reasons.
The shape
SqlDriver#findWithWindowFunctions (packages/drivers/driver-sql/src/sql-driver.ts) is the one record read door that returns await builder rows without the formatOutput pass every find() / findOne() row gets, and without the presentReadValue pass aggregate() / distinct() got under #3797 / #3849. So it hands back STORAGE forms where every other door hands back the declared type's presentation.
Reproduced on SQLite, from the built package
Probe (verbatim, node against packages/drivers/driver-sql/dist/index.js built from origin/main b4abb0a91; the tree under #13973 changes nothing on this door):
const driver = new SqlDriver({ client: 'better-sqlite3', connection: { filename: ':memory:' }, useNullAsDefault: true });
await driver.initObjects([{ name: 'probe_window', fields: { id: { type: 'text' }, ok: { type: 'boolean' }, closed_at: { type: 'datetime' }, meta: { type: 'object' } } }]);
await driver.create('probe_window', { id: 'a', ok: true, closed_at: new Date('2026-01-10T09:00:00.123Z'), meta: { k: 1 } }, { bypassTenantAudit: true });
const viaFind = await driver.find('probe_window', {}, { bypassTenantAudit: true });
const viaWindow = await driver.findWithWindowFunctions('probe_window', { windowFunctions: [{ function: 'row_number', alias: 'rn', orderBy: [{ field: 'id', order: 'asc' }] }] }, { bypassTenantAudit: true });
Output, same row through the two doors:
find(): {"id":"a", …, "ok":true, "closed_at":"2026-01-10T09:00:00.123Z", "meta":{"k":1}}
findWithWindowFunctions(): {"id":"a", …, "ok":1, "closed_at":"2026-01-10T09:00:00.123Z", "meta":"{\"k\":1}", "rn":1}
ok: find=true (boolean) window=1 (number) same=false
meta: find={"k":1} (object) window="{\"k\":1}" (string) same=false
A declared Field.boolean answers 1 where find() answers true; a declared Field.object answers the stored JSON TEXT where find() answers the parsed object. closed_at happens to agree on SQLite only because #3912 stores the canonical text there; on Postgres and MySQL this door hands out the client library's Date for closed_at / created_at / updated_at, which after #13973 (ADR-0053 D-F1) is the one shape every OTHER read door no longer produces — so on the live dialects the divergence is now between this door and the driver's own declared read contract, not only between dialects.
Why it is filed rather than folded into #13973
#13973's ruling names formatOutput and the aggregate() / distinct() presentation path; this door is a driver-sql extension (SqlWindowFunctionQuery) outside that ruling's surface, and its gap predates and is wider than the instant classes (booleans and JSON are wrong on SQLite today). ADR-0053's D-F addendum records it as "not covered" so the declaration stays as narrow as the enforcement.
What a fix looks like
The same presentation the other doors apply — formatOutput per row, minus the window-function alias columns (computed values, not declared fields) — plus a conformance case in the sql-driver-aggregate-temporal-output.test.ts family asserting findWithWindowFunctions and find() agree on every declared kind (boolean, json, date, time, datetime, audit stamps). The one design question: an alias that collides with a declared field name.
Backlinks: #13973 (where this was found; not addressed here), #3797 / #3849 (the aggregate() / distinct() half of the same gap, closed).
Found while implementing #13973 (the read door's canonical instant shape). Not addressed there, and this card does not close it; #13973 remains open for its own reasons.
The shape
SqlDriver#findWithWindowFunctions(packages/drivers/driver-sql/src/sql-driver.ts) is the one record read door that returnsawait builderrows without theformatOutputpass everyfind()/findOne()row gets, and without thepresentReadValuepassaggregate()/distinct()got under #3797 / #3849. So it hands back STORAGE forms where every other door hands back the declared type's presentation.Reproduced on SQLite, from the built package
Probe (verbatim,
nodeagainstpackages/drivers/driver-sql/dist/index.jsbuilt fromorigin/mainb4abb0a91; the tree under #13973 changes nothing on this door):Output, same row through the two doors:
A declared
Field.booleananswers1wherefind()answerstrue; a declaredField.objectanswers the stored JSON TEXT wherefind()answers the parsed object.closed_athappens to agree on SQLite only because #3912 stores the canonical text there; on Postgres and MySQL this door hands out the client library'sDateforclosed_at/created_at/updated_at, which after #13973 (ADR-0053 D-F1) is the one shape every OTHER read door no longer produces — so on the live dialects the divergence is now between this door and the driver's own declared read contract, not only between dialects.Why it is filed rather than folded into #13973
#13973's ruling names
formatOutputand theaggregate()/distinct()presentation path; this door is a driver-sql extension (SqlWindowFunctionQuery) outside that ruling's surface, and its gap predates and is wider than the instant classes (booleans and JSON are wrong on SQLite today). ADR-0053's D-F addendum records it as "not covered" so the declaration stays as narrow as the enforcement.What a fix looks like
The same presentation the other doors apply —
formatOutputper row, minus the window-function alias columns (computed values, not declared fields) — plus a conformance case in thesql-driver-aggregate-temporal-output.test.tsfamily assertingfindWithWindowFunctionsandfind()agree on every declared kind (boolean, json, date, time, datetime, audit stamps). The one design question: an alias that collides with a declared field name.Backlinks: #13973 (where this was found; not addressed here), #3797 / #3849 (the
aggregate()/distinct()half of the same gap, closed).