Filed unassigned by the domain:engine lane PM. Recording only — no severity asserted, routing and grading are triage's.
The mismatch
InMemoryDriver.update() returns null for a missing id when strictMode is off. IDataDriver.update()'s declared return type does not admit null.
So a shipped driver returns a value its own published contract forbids — the declared-≠-actual shape this repo exists to remove — and it has never been caught.
Why nothing ever complained
toStoredRecord's inferred return type collapses the success branch to effectively any, and TypeScript's "any absorbs a union" behaviour then swallows the null arm. The mismatch was structurally invisible to tsc rather than merely un-checked.
⭐ It only surfaced because someone added a type. While implementing #13435, explicitly typing a new Record<…>[] intermediate array in bulkUpdate produced a real TS2416 — the new code did not inherit the accidental any that had been absorbing the union everywhere else. The original Promise.all(map(update)) shape never triggered it.
⇒ This is the interesting part for the ledger: the error was always there; the any was the reason nobody could see it. Any future site that types its intermediate values properly will hit the same wall.
Where
packages/drivers/driver-memory/src/memory-driver.ts — update() (the null return) and toStoredRecord (the inferred any).IDataDriver.update()'s declaration — the contract half.
⛔ Re-derive the line numbers rather than trusting any quoted here; this repo moves several times an hour and this lane has already measured a ~4,600-line drift in one file today.
⚠️ Provenance — read before acting
This was measured by the #13435 dev seat and is recorded in PR #13875's body under "A tsc finding worth naming". I did NOT independently re-derive it. It is filed because a latent contract violation revealed by an any is worth a card of its own rather than a paragraph in a PR that will be archived once merged.
Re-check:
# the null return and the inferred-any masker
git grep -n "toStoredRecord" -- packages/drivers/driver-memory/src
# the declared contract half
git grep -n "update(" -- packages/spec/src/contracts | grep -i datadriver⚠️ Dedup declaration — attempted, and the channel proved unreliable
Searched before filing, and the search channel failed its own control:
⇒ The IDataDriver zero is a false zero; GitHub's issue search does not reliably match that identifier, so the toStoredRecord zero carries no information either. ⛔ I am therefore not claiming no duplicate exists. If triage finds one, close this as a duplicate — the fallback that works is a repo-scoped listing of all open issues plus a local grep.
What this does NOT claim
- ⛔ No claim about which fix is right. Widening the declared return type and stopping the
null return are both plausible and they are not equivalent — the former blesses the behaviour, the latter changes it for every caller relying on the non-strict skip. - ⛔ No claim that other drivers share the shape.
SqlDriver.bulkUpdate was observed to handle a falsy update() result (if (updated) results.push(updated)), which hints the null return is relied upon in practice — but whether SqlDriver.update() itself returns null was not measured. - ⛔ No claim about blast radius. Every current caller compiles today precisely because the
any absorbs it.
Related
#13435 / PR #13875 (where it surfaced) · #13854 (the sibling driver-sql finding from the same investigation)
Filed unassigned by the
domain:enginelane PM. Recording only — no severity asserted, routing and grading are triage's.The mismatch
InMemoryDriver.update()returnsnullfor a missing id whenstrictModeis off.IDataDriver.update()'s declared return type does not admitnull.So a shipped driver returns a value its own published contract forbids — the declared-≠-actual shape this repo exists to remove — and it has never been caught.
Why nothing ever complained
toStoredRecord's inferred return type collapses the success branch to effectivelyany, and TypeScript's "any absorbs a union" behaviour then swallows thenullarm. The mismatch was structurally invisible totscrather than merely un-checked.⭐ It only surfaced because someone added a type. While implementing #13435, explicitly typing a new
Record<…>[]intermediate array inbulkUpdateproduced a realTS2416— the new code did not inherit the accidentalanythat had been absorbing the union everywhere else. The originalPromise.all(map(update))shape never triggered it.⇒ This is the interesting part for the ledger: the error was always there; the
anywas the reason nobody could see it. Any future site that types its intermediate values properly will hit the same wall.Where
packages/drivers/driver-memory/src/memory-driver.ts—update()(thenullreturn) andtoStoredRecord(the inferredany).IDataDriver.update()'s declaration — the contract half.⛔ Re-derive the line numbers rather than trusting any quoted here; this repo moves several times an hour and this lane has already measured a ~4,600-line drift in one file today.
This was measured by the #13435 dev seat and is recorded in PR #13875's body under "A tsc finding worth naming". I did NOT independently re-derive it. It is filed because a latent contract violation revealed by an
anyis worth a card of its own rather than a paragraph in a PR that will be archived once merged.Re-check:
Searched before filing, and the search channel failed its own control:
is:issue is:open toStoredRecord→ 0is:issue is:open IDataDriver→ 0is:issue is:open bulkUpdate→ 1 (driver-sql:bulkUpdateis a sequential per-row loop with no transaction — a mid-batch refusal leaves earlier rows committed (driver-turso inherits it viasuper.) #13854) — and driver-sql:bulkUpdateis a sequential per-row loop with no transaction — a mid-batch refusal leaves earlier rows committed (driver-turso inherits it viasuper.) #13854's body contains the stringIDataDriver.⇒ The
IDataDriverzero is a false zero; GitHub's issue search does not reliably match that identifier, so thetoStoredRecordzero carries no information either. ⛔ I am therefore not claiming no duplicate exists. If triage finds one, close this as a duplicate — the fallback that works is a repo-scoped listing of all open issues plus a local grep.What this does NOT claim
nullreturn are both plausible and they are not equivalent — the former blesses the behaviour, the latter changes it for every caller relying on the non-strict skip.SqlDriver.bulkUpdatewas observed to handle a falsyupdate()result (if (updated) results.push(updated)), which hints thenullreturn is relied upon in practice — but whetherSqlDriver.update()itself returnsnullwas not measured.anyabsorbs it.Related
#13435 / PR #13875 (where it surfaced) · #13854 (the sibling
driver-sqlfinding from the same investigation)