Measured during #6394 (removing the single as never on date-bucket-parity.test.ts's driver.create options gate). The dispatch for #6394 asked for a same-shape scan of other drivers' test options-gate casts as read-only — this is that scan's result, filed rather than fixed. Observation-class, no pm:queue, please grade in a triage round.
The inventory
Same shape as #6394's cast, spelled as any instead of as never, on driver.create(…) / driver.find(…) options arguments in test files:
| Package |
Sites |
driver-sqlite-wasm |
17 |
driver-sql |
10 |
| Total |
27 across 12 files |
(driver-turso has 2 more, in turso-temporal-conformance.test.ts — see the split below for why they are a different animal.)
Reproduce the inventory:
grep -rnE "\{ *bypassTenantAudit: true *\} as (any|never)" packages/drivers/*/src --include=*.test.ts
Measured: all 27 are dead
Baseline origin/main @ 64d764e, dependency closures built first so the verdict is not read off stale dist/*.d.ts. Stripped all 27 casts, then:
@objectstack/driver-sql typecheck → EXIT=0
@objectstack/driver-sqlite-wasm typecheck → EXIT=0
Zero output both. bypassTenantAudit is a declared key on DriverOptionsSchema (packages/spec/src/data/driver.zod.ts:99), so no cast was ever needed — identical to #6394's finding on the as never.
Why this is worth more than #6394 was
These 27 sit on a genuinely typed gate, and #6394's does not. That is the whole point of filing it separately.
SqlDriver.create declares options?: DriverOptions (packages/drivers/driver-sql/src/sql-driver.ts:2961), and SqliteWasmDriver does not override it, so both inherit real checking. Removing a cast there restores it — measured, by misspelling one key after the strip:
src/sql-driver-runtime-token-default.test.ts(111,73): error TS2561: Object literal may only
specify known properties, but 'bypassTenantAuditt' does not exist in type '{ transaction?:
unknown; timeout?: number | undefined; … bypassTenantAudit?: boolean | undefined; }'.
Did you mean to write 'bypassTenantAudit'?
TursoDriver, by contrast, overrides create with options?: any (see #6402 and my comment there), so at #6394's call site the same typo compiles clean with or without the cast. That is why #6394 was correctly graded a noise removal with no restored check, and why these 27 are not the same trade.
So the ordering matters: fixing these 27 buys real compile-time checking today, whereas the turso family (#6402) has to narrow options?: any first before its casts are worth touching.
Not a defect
No known bug has come out of this. Every affected suite is green; the cost is dormant — a misspelled or wrong-typed options key in these 27 test call sites goes unreported. Nobody has tripped on it.
If it gets done
Mechanical: delete as any at the 27 sites, then pnpm --filter @objectstack/driver-sql typecheck and pnpm --filter @objectstack/driver-sqlite-wasm typecheck. Both were measured green with the casts already gone, so the change is expected to be zero-error. Tests-only, no changeset.
Worth doing in one pass across both packages rather than piecemeal, for the reason #6402 gives about its own five: a partial fix reads to the next reader as a judgment about the sites left behind.
Related
Measured during #6394 (removing the single
as neverondate-bucket-parity.test.ts'sdriver.createoptions gate). The dispatch for #6394 asked for a same-shape scan of other drivers' test options-gate casts as read-only — this is that scan's result, filed rather than fixed. Observation-class, nopm:queue, please grade in a triage round.The inventory
Same shape as #6394's cast, spelled
as anyinstead ofas never, ondriver.create(…)/driver.find(…)options arguments in test files:driver-sqlite-wasmdriver-sql(
driver-tursohas 2 more, inturso-temporal-conformance.test.ts— see the split below for why they are a different animal.)Reproduce the inventory:
Measured: all 27 are dead
Baseline
origin/main@64d764e, dependency closures built first so the verdict is not read off staledist/*.d.ts. Stripped all 27 casts, then:Zero output both.
bypassTenantAuditis a declared key onDriverOptionsSchema(packages/spec/src/data/driver.zod.ts:99), so no cast was ever needed — identical to #6394's finding on theas never.Why this is worth more than #6394 was
These 27 sit on a genuinely typed gate, and #6394's does not. That is the whole point of filing it separately.
SqlDriver.createdeclaresoptions?: DriverOptions(packages/drivers/driver-sql/src/sql-driver.ts:2961), andSqliteWasmDriverdoes not override it, so both inherit real checking. Removing a cast there restores it — measured, by misspelling one key after the strip:TursoDriver, by contrast, overridescreatewithoptions?: any(see #6402 and my comment there), so at #6394's call site the same typo compiles clean with or without the cast. That is why #6394 was correctly graded a noise removal with no restored check, and why these 27 are not the same trade.So the ordering matters: fixing these 27 buys real compile-time checking today, whereas the turso family (#6402) has to narrow
options?: anyfirst before its casts are worth touching.Not a defect
No known bug has come out of this. Every affected suite is green; the cost is dormant — a misspelled or wrong-typed options key in these 27 test call sites goes unreported. Nobody has tripped on it.
If it gets done
Mechanical: delete
as anyat the 27 sites, thenpnpm --filter @objectstack/driver-sql typecheckandpnpm --filter @objectstack/driver-sqlite-wasm typecheck. Both were measured green with the casts already gone, so the change is expected to be zero-error. Tests-only, no changeset.Worth doing in one pass across both packages rather than piecemeal, for the reason #6402 gives about its own five: a partial fix reads to the next reader as a judgment about the sites left behind.
Related
as never—— 在driver.create的 options 门上,与 #6354 不同门 #6394 — the singleas never, same shape, different gate (turso'soptions?: any); this scan came out of its dispatchTursoDriver五个 override 的options?: any—— #5181 收窄的是 query,options 这条轴还没人碰过 #6402 —TursoDriver'soptions?: anyoverrides, the reason turso's casts are a separate problemDriverQuery收窄之外:aggregate/distinct/analyzeQuery等驱动自有查询方法仍要求把对象名写两遍 #6212 — same family (declared-but-unread shapes)