Skip to content

[finding][drivers] driver-turso 的 date-bucket-parity 测试里还有一处死 as never —— 在 driver.create 的 options 门上,与 #6354 不同门 #6394

Description

@os-zhuang

在实施 #6354(删掉 checkDateBucketParity / checkReadCoercion 调用点的 as never)期间实测发现,记录备查。观察类,不挂 pm:queue,请分诊轮定级。

现状

packages/drivers/driver-turso/src/date-bucket-parity.test.ts:68:

await driver.create(
  'bucket_storage_probe',
  { id: 'p1', at: new Date('2026-01-10T09:00:00Z') },
  { bypassTenantAudit: true } as never,
);

这是同一个文件里 #6354 之外仅存的一处 as never。#6354 处理的是 checkDateBucketParity(driver, …) 这个替身调用点;这一处是 driver.create(…) 的 options 门,属于不同的门、不同的生产者,所以在 #6354 的 PR 里按 PD #10 单独记下来,没有扩大那个 PR 的 diff。

实测:这个 cast 也是死的

把 as never 去掉后(基线为已含 #6355 的 origin/main,且已先 build @objectstack/driver-turso 的依赖闭包,确保读到的不是陈旧 dist/*.d.ts):

> @objectstack/driver-turso@17.0.0-rc.5 typecheck
> tsc --noEmit

EXIT=0

零输出、退出码 0。

为什么它本来就不需要

bypassTenantAudit 是已声明的键,不是野键 —— packages/spec/src/data/driver.zod.ts:99:

bypassTenantAudit: z.boolean().optional().describe('Suppress the driver tenant-audit warning for
  a deliberately global write on a tenant-scoped object (diagnostics only — never changes what
  the write touches)')

同一族的另一处旁证:dogfood 与 turso 两个 parity 测试都往 checkDateBucketParity 传 createOptions: { bypassTenantAudit: true },那边从来没有写 cast,一直编译得过。

不是缺陷

运行期行为完全正确(driver-turso 808 tests 全绿)。丢掉的同样只是编译期检查:这个 cast 把整个 options 形状抹成 never,于是 options 里拼错的键、写错类型的值都不会红。代价是休眠的 —— 今天没有人踩。

如果要做

删掉这 5 个字符,跑一遍 @objectstack/driver-turso 的 typecheck 即可。建议顺带扫一遍其余驱动测试里是否有同形的 options 门 cast(本单未做这个全仓扫描)。

相关

会话:session_01WyvqvKMG6asi9aXjKE6xtx(#6354 实施期间发现,未认领)

Activity

  1. os-project-manager commented on Aug 8, 2026

    @os-project-manager
    Collaborator

    Findings sweep (maintainer-authorized one-off, 2026-08-07 — registered on #6015): promoted to the queue. The last as never in the file #6354 cleaned, already verified dead against a freshly-built closure — one-line removal, batch with #6399's guardrail work so the cleanup and its protection land together. finding → pm:queue.


    Generated by Claude Code

  2. self-assigned this
    on Aug 8, 2026
  3. os-zhuang commented on Aug 8, 2026

    @os-zhuang
    ContributorAuthor

    Claim: PM loop, drivers lane (accelerated batch, maintainer-directed)
    Session: session_01Hg9Pkg5nDedCRihRsdeCdX
    Branch: claude/issue-6394-date-bucket-options-cast
    Worktree: objectstack-issue-6394 (cloud session — own container)
    Domain: domain:drivers
    Container class: S-size test-only cast removal, mode:cloud for parallel isolation
    File surface: packages/drivers/driver-turso/src/date-bucket-parity.test.ts (single as never removal); the suggested same-shape scan of other drivers' options-gate casts is read-only (findings filed, not fixed here).
    Serial constraints cleared: promotion note asked to batch with #6399's guardrail — #6399 closed completed 2026-08-08T03:40Z (devx lane), so the protection question is settled and this rides alone. PR #6706 (in flight) touches driver-turso but not this file. No other in-flight claim on this file found.


    Generated by Claude Code

  4. os-zhuang commented on Aug 8, 2026

    @os-zhuang
    ContributorAuthor

    os-dev report

    {
      "issue": 6394,
      "repo": "objectstack-ai/objectstack",
      "premise_still_valid": true,
      "premise_notes": "Cast located by pattern (not line number) on origin/main and still present: `{ bypassTenantAudit: true } as never` in packages/drivers/driver-turso/src/date-bucket-parity.test.ts. It was the file's only remaining `as never` — #6354's stand-in call sites (the `checkDateBucketParity(...)` gates) are already cast-free. No #6399 guard covers or conflicts with it: that resolution landed as the `check:verify-stand-in` gate, which guards the stand-in call sites and passes green both before and after this change.",
      "status": "delivered",
      "pr": 6757,
      "pr_state": "draft",
      "branch": "claude/issue-6394-date-bucket-options-cast",
      "head_sha": "5e4e828",
      "base_merged": "origin/main @ 64d764e",
      "diff": { "files": 1, "insertions": 1, "deletions": 1 },
      "changeset": {
        "added": false,
        "reason": "Tests-only change; no runtime or published surface touched, so it declares no release. Per dispatch, PM applies `skip-changeset` at acceptance."
      },
      "evidence": {
        "dependency_closure_built_first": true,
        "typecheck": "@objectstack/driver-turso — tsc --noEmit, EXIT=0, zero output",
        "tests": "@objectstack/driver-turso — vitest run, 27 files / 836 tests passed, EXIT=0",
        "compile_graph_control": "Confirmed the test file is genuinely typechecked (not excluded): tsconfig has include ['src/**/*'], and an injected `const x: number = \"…\"` in this same file reds with TS2322. Control reverted.",
        "reran_after_merging_main": true
      },
      "premise_correction": {
        "claim_in_issue": "The cast erases the options shape to `never`, so misspelled keys and wrong-typed values in options go unchecked; removing it restores that checking.",
        "measured_verdict": "Half wrong. The cast IS dead (removal typechecks clean), but removing it restores NO checking at this gate.",
        "measurements": [
          "{ bypassTenantAudditt: true } (misspelled key), cast removed → tsc EXIT=0, no error",
          "{ bypassTenantAudit: 'not-a-boolean' } (wrong type), cast removed → tsc EXIT=0, no error"
        ],
        "root_cause": "TursoDriver overrides create with `options?: any` (packages/drivers/driver-turso/src/turso-driver.ts:523). That override, not SqlDriver's `options?: DriverOptions`, is what resolves at this call site — the parameter was already `any` before the cast applied.",
        "why_still_landed": "The cast reads as a load-bearing escape hatch and is not one. Removing dead noise is the honest benefit; restoring type safety is not, and the PR body says so rather than repeating the issue's rationale."
      },
      "gates": {
        "source": "Enumerated one by one from .github/workflows/lint.yml (ESLint job + TypeScript Type Check job)",
        "total_run": 47,
        "failed": 0,
        "notes": "Includes turbo build (66 tasks) and turbo typecheck (120 tasks) across packages/apps/examples."
      },
      "ci": {
        "converged": true,
        "total_checks": 24,
        "success": 21,
        "skipped": 2,
        "failure": 1,
        "failing_checks": ["Check Changeset"],
        "failure_is_expected": true,
        "failure_analysis": "Read the job log to confirm the cause: it failed on the changeset COUNT, not on an unusable diff base. The gate offers exactly two routes — a changeset, or the `skip-changeset` label — and explicitly rejects an empty-frontmatter changeset as a third (#5471 / #4898). A tests-only change releases nothing, so the label is the correct route; fabricating a changeset would be the wrong one. Left for the PM label at acceptance.",
        "green_highlights": ["ESLint", "TypeScript Type Check", "Test Core (3 shards)", "Build Core", "Dogfood Regression Gate (3 shards)", "Dogfood Verify CLI", "Temporal Conformance (live PG + MySQL)"]
      },
      "out_of_scope_findings": [
        {
          "action": "filed",
          "issue": 6754,
          "assignee": null,
          "title": "27 dead `{ bypassTenantAudit: true } as any` options-gate casts in driver-sql / driver-sqlite-wasm tests",
          "dedup": "search-first; no existing issue covered this shape",
          "summary": "This is the same-shape scan the dispatch ordered READ-ONLY. 27 sites across 12 files (17 driver-sqlite-wasm, 10 driver-sql). Stripping all 27 leaves both packages at tsc EXIT=0, so all are dead. Unlike #6394's, these sit on a REAL typed gate — SqlDriver.create declares `options?: DriverOptions` and SqliteWasmDriver does not override it — so removing them genuinely restores checking, measured: a misspelled key reds with TS2561. Not fixed here; all exploratory edits reverted (git diff vs the commit is empty)."
        },
        {
          "action": "commented_on_existing",
          "issue": 6402,
          "dedup": "search-first hit — existing open issue already owns this axis, so a correction comment rather than a duplicate issue",
          "summary": "Its table under-counts: the `options?: any` widening on TursoDriver covers 16 overrides, not the 5 listed. The 11 missing are find, findOne, create, bulkCreate, bulkUpdate, bulkDelete, updateMany, deleteMany, execute, syncSchema, dropTable. Verified all 16 against their SqlDriver bases — every one declares `options?: DriverOptions`, so there is no legitimate-`any` subset. This matters because the issue's own argument is that a partial fix reads as a judgment on the sites left behind, and `create` — the exact gate #6394 is about — was among the missing."
        }
      ],
      "open_questions": [
        {
          "question": "Is #6394 worth landing at all, given it restores no type checking?",
          "self_ruled": "Yes — landed. The dispatch graded it a one-line removal and the cast is measurably dead; a cast that looks load-bearing and is not costs the next reader of TursoDriver's signatures real time. But the PR body states the true benefit (noise removal) rather than the issue's claimed one (restored checking), so acceptance is not made on a false premise.",
          "axis": "value / honesty of the stated benefit"
        },
        {
          "question": "Should the 27 sibling casts in #6754 have been fixed in this PR, since they are the same five characters and buy MORE than this PR does?",
          "self_ruled": "No — the dispatch made the same-shape scan explicitly READ-ONLY, and that ruling is not mine to relitigate. Filed as #6754 with the full measurement so a grader can queue it at its real value, which is higher than this card's.",
          "axis": "scope discipline"
        },
        {
          "question": "Does the ordering between #6754 and #6402 need stating for triage?",
          "self_ruled": "Stated in both. #6754 buys checking today; turso's casts are only worth touching after #6402 narrows the 16 `options?: any` overrides. Flagging so the two are not graded as interchangeable cleanup.",
          "axis": "triage sequencing"
        }
      ],
      "pm_action_required": ["Apply `skip-changeset` to PR #6757 at acceptance — the only red check clears with it.", "Grade newly filed #6754 (unassigned, observation-class).", "Note the corrected inventory on #6402 before it is implemented — 16 overrides, not 5."]
    }

    Generated by Claude Code

  5. os-zhuang commented on Aug 8, 2026

    @os-zhuang
    ContributorAuthor

    ACCEPT — PR #6757 passed the step-7 review; skip-changeset applied (tests-only, the one red check clears with it), marking it ready and enabling auto-merge.

    What shipped: the dead as never on driver.create's options gate removed (1 file, +1/−1), with the honest premise correction recorded: the cast was dead but removing it restores NO checking at this gate — TursoDriver.create's own options?: any override (not the cast) was what disabled the checking, which is exactly #6402's surface; once PR #6755 lands, this site gains real checking. Verified: dependency closure built before typecheck, compile-graph control run and reverted, 47 gates enumerated from lint.yml green locally, CI 21 success / 2 skipped / 1 expected label-gate red. Out-of-scope scan honored as read-only: #6754 filed unassigned (27 dead casts on REAL typed gates in driver-sql / driver-sqlite-wasm — awaiting triage grading), inventory correction posted on #6402.


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions