test(driver-turso): drop the dead as never on date-bucket-parity's create options gate (#6394) - #6757
Merged
Merged
Conversation
…create options gate (#6394) `date-bucket-parity.test.ts` passed `{ bypassTenantAudit: true } as never` to `driver.create`. `bypassTenantAudit` is a declared key on `DriverOptionsSchema` (packages/spec/src/data/driver.zod.ts), so the cast was never needed: `@objectstack/driver-turso` typechecks clean without it (verified after building the package's full dependency closure, so the verdict is not read off stale `dist/*.d.ts`). This is the last `as never` in the file — #6354 removed the ones on the `checkDateBucketParity(...)` stand-in call sites; this one sat on a different gate (`driver.create`'s options parameter) and was recorded separately under PD #10 rather than widening that PR's diff. Scope note: removing the cast does NOT restore compile-time checking at this call site. `TursoDriver` overrides `create` (and eight sibling methods) with `options?: any`, so a misspelled key or a wrong-typed value still compiles either way — measured, not assumed. Filed separately; this commit only removes noise that reads as a needed escape hatch. Tests-only change, no changeset. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015g3eCfHF7Wrtyq2qRahmP8
…e-bucket-options-cast
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Contributor
📓 Docs Drift CheckNo hand-written docs reference the 0 changed package(s). ✅ |
os-zhuang
marked this pull request as ready for review
August 8, 2026 15:20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6394
What changed
One cast, in
packages/drivers/driver-turso/src/date-bucket-parity.test.ts:await driver.create( 'bucket_storage_probe', { id: 'p1', at: new Date('2026-01-10T09:00:00Z') }, - { bypassTenantAudit: true } as never, + { bypassTenantAudit: true }, );That is the entire diff — 1 file, +1/−1.
Premise verified before implementing
origin/main, located by pattern (as neverindate-bucket-parity.test.ts), not by line number. It was the file's only remainingas never: [finding][drivers]checkDateBucketParity的每个调用点都写driver as never,把BucketableDriver替身的编译期一致性整个抹掉 —— 且实测该 cast 并不必要 #6354 already removed the ones on thecheckDateBucketParity(…)stand-in call sites (lines 43–45 and 128–130 are cast-free on main).as never被加回来 —— #6354 一次清掉 10 个死 cast,但清理本身没有护栏 #6399 conflicts with it. [finding][devx] 没有任何门禁阻止as never被加回来 —— #6354 一次清掉 10 个死 cast,但清理本身没有护栏 #6399's resolution landed as thecheck:verify-stand-ingate inlint.yml; it passes green both before and after this change. It guards the stand-in call sites, notdriver.create's options parameter.bypassTenantAuditis a declared key, not a wild one —packages/spec/src/data/driver.zod.ts:99, onDriverOptionsSchema. Corroborating: the dogfood and turso parity tests both passcreateOptions: { bypassTenantAudit: true }tocheckDateBucketParitywith no cast and always have.Evidence
Dependency closure built before typechecking (
pnpm --filter @objectstack/driver-turso... build), so the verdict is not read off staledist/*.d.ts. Re-run after mergingorigin/main@64d764e.Zero output on typecheck, so the cast was dead: nothing depended on it.
I also confirmed the test file is genuinely in the compile graph rather than silently excluded —
driver-turso/tsconfig.jsonhas"include": ["src/**/*"], and an unrelatedconst x: number = "definitely-not-a-number"appended to this same file does red:That control was reverted; it is not in the diff.
Scope note — this restores no checking, and the issue's rationale on that point is wrong
The issue argues the cast's cost is that it "抹成
never,于是 options 里拼错的键、写错类型的值都不会红". I tried to measure that payoff and it does not exist at this gate. With the cast removed:tscresult{ bypassTenantAudditt: true }(misspelled key){ bypassTenantAudit: 'not-a-boolean' }(wrong type)The reason:
TursoDriveroverridescreatewithoptions?: any(packages/drivers/driver-turso/src/turso-driver.ts:523), so the override — notSqlDriver'soptions?: DriverOptions— is what resolves here. The parameter was alreadyanybefore the cast ever applied.The change is still correct and still worth landing: the cast reads as a needed escape hatch, and a future reader narrowing
TursoDriver's signatures would have to work out whether it was load-bearing. Removing dead noise is the honest description of the benefit — restoring type safety is not.Filed rather than fixed here (out of scope, per the dispatch):
TursoDriver五个 override 的options?: any—— #5181 收窄的是 query,options 这条轴还没人碰过 #6402 — I commented with a measurement correcting its inventory: theoptions?: anywidening covers 16 overrides, not the 5 its table lists, and all 16 have a base declaringDriverOptions.createis among the 11 missing, which is precisely why this PR restores nothing.Same-shape scan of other drivers (read-only, per dispatch)
Filed as #6754, unassigned, not fixed here. 27 dead
{ bypassTenantAudit: true } as anyoptions-gate casts — 17 indriver-sqlite-wasm, 10 indriver-sql, across 12 files. Stripping all 27 leaves both packages atEXIT=0.Those are the inverse trade to this PR: they sit on a real typed gate (
SqlDriver.createdeclaresoptions?: DriverOptionsandSqliteWasmDriverdoes not override it), so removing them genuinely restores checking — measured by misspelling a key after the strip:All exploratory edits for that measurement were reverted;
git diffagainst the commit is empty.Changeset
None — this is a tests-only change. No runtime or published surface is touched, so there is nothing for a changeset to describe.
skip-changesetto be applied at acceptance.Gates
Enumerated from
.github/workflows/lint.yml, everycheck:*step run one by one — 47 gates, all green locally.ESLint job — 33 gates
pnpm lint, thencheck:—slot-lookup,query-options-erasure,verify-stand-in,nul-bytes,doc-authoring,docs-audit-scope,role-word,quick-reference-counts,adr-anchors,org-identifier,authz-resolver,service-providers,route-envelope,error-code-casing,wildcard-fallthrough,meta-type-normalized,init-service-contract,durability-log-level,startup-registry-verdict,objectui-changeset,release-notes,release-body,node-version,workflow-status-functions,shard-attestation,published-files,engine-double-contract,kernel-hook-pairs,resume-authority-declared,driver-memory-census,merge-driver,spec-parsed-aliasTypeScript Type Check job — 14 gates
check:type-check-coverage,check:driver-conformance,check:stall-guard,spec tsc --noEmit,spec check:generated --reconcile-only,spec check:skill-docs,spec check:spec-changes,spec check:upgrade-guide,spec check:authorable-surface,spec check:docs,spec check:skill-refs,check:skill-frame-sync,check:skill-compatibility,spec check:react-blocks,turbo build(66 tasks),turbo typecheck(120 tasks),turbo build packages/*/*,check:type-check-debt,examples typecheck,downstream-contract typecheck,spec check:api-surface,spec check:exported-any,spec check:dual-source-exports,spec check:skill-examples,lint check:doc-formula-expressions,check:i18n,check:i18n-coverage,check:app-nav-i18norigin/main@64d764emerged in (PR #6706'sremote-transport.ts/ text-predicate work does not touch this file; the merge leftdriver-turso,driver.zod.tsandverifyuntouched). Suite re-run green after the merge.CI
Converged on
5e4e828— 24 checks: 21 success, 2 skipped, 1 failure.The single red is
Check Changeset, and it is the expected label gate, not a defect in this PR. Its log:I confirmed from the job log that it failed on the changeset count, not on an unusable diff base. The gate offers exactly two routes, and an empty-frontmatter changeset is explicitly rejected as a third (#5471 / #4898). A tests-only change releases nothing, so the label is the correct route and fabricating a changeset would be the wrong one — left for
skip-changesetat acceptance.Everything else is green, including
ESLint,TypeScript Type Check,Test Core(3 shards),Build Core,Dogfood Regression Gate(3 shards),Dogfood Verify CLI, andTemporal Conformance (live PG + MySQL).