Skip to content

guard: turbo type-check 的手维护 inputs 名单已两次因"包程序越出包目录"失真 —— 评估从 tsconfig include 派生或加钉扎测试 #3514

Description

@yinlianghui

Tripped over while implementing #3476 (PR #3513). Filed unassigned; not fixed there because turbo.json was outside that task's file fence.

The gap

apps/console's type-check script compiles a program that deliberately spans the repo root:

turbo.json's type-check task hashes:

"inputs": ["$TURBO_DEFAULT$", "$TURBO_ROOT$/scripts/vite-*.ts"]

$TURBO_DEFAULT$ only covers files inside the package directory, and globalDependencies is unset. That second entry exists precisely to close this hole for the scripts/vite-*.ts half — nothing covers vitest.config.mts.

Measured

On PR #3513's branch: run type-check green so it caches, then plant a real type error in the root vitest.config.mts and re-run only the console filter.

$ npx turbo run type-check --filter @object-ui/console --concurrency=2
@object-ui/console:type-check: cache hit, replaying logs 4214aa6ab3df0f18
 Tasks:    35 successful, 35 total
  Time:    315ms  FULL TURBO

Turbo replayed a green while the program contained:

../../vitest.config.mts(114,5): error TS2769: No overload matches this call.
    Type 'string' is not assignable to type 'number'.

A cold run on the same tree exits 1. So the verdict depends on cache state, not on the code.

Not local-only: .github/workflows/ci.yml persists .turbo/cache via actions/cache, so a warm CI cache can carry the stale green across runs.

Suggested fix

Symmetric with the entry already there — one line:

-      "inputs": ["$TURBO_DEFAULT$", "$TURBO_ROOT$/scripts/vite-*.ts"]
+      "inputs": ["$TURBO_DEFAULT$", "$TURBO_ROOT$/scripts/vite-*.ts", "$TURBO_ROOT$/vitest.config.mts"]

Worth considering alongside it: this list is a thing to keep honest by hand, and it has now been wrong twice for the same structural reason (a package's tsc program reaching outside its own directory). Whether that deserves a guard — something that derives the extra inputs from the tsconfig include, or pins the pair — is a maintainer call, not part of the one-liner.

Ordering

Only bites once PR #3513 merges (before that, vitest.config.mts is in no gated program at all). The scripts/vite-*.ts half is already handled, so there is nothing broken on main today.

Blocked-by: #3513


Generated by Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions