From f12186b069e0169b4aca4897c61a4b5f5927ce66 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 23 Jun 2026 17:41:56 +0000 Subject: [PATCH] fix(ci): scope nightly type-drift typecheck to the package under test Vitest's `--typecheck` engine built its tsc program from the root `tsconfig.json`, which has no `include` and therefore swept the entire monorepo's source. Example UI `.tsx` files (which need `jsx`) and provider packages relying on their own ambient `types`/`lib` (Chrome AI, Cloudflare) then surfaced hundreds of "unhandled source errors" unrelated to the drift guard, failing the nightly even though the 3 drift tests passed. Point vitest's typecheck at a dedicated `tsconfig.typecheck.json` scoped to `packages/ai/src`, so the program only contains the file under test and resolves cross-package imports to the already-built `.d.ts` declarations. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01G6ie5uJvfMpFZrGtrKL1c4 --- tsconfig.typecheck.json | 10 ++++++++++ vitest.config.ts | 7 +++++++ 2 files changed, 17 insertions(+) create mode 100644 tsconfig.typecheck.json diff --git a/tsconfig.typecheck.json b/tsconfig.typecheck.json new file mode 100644 index 000000000..f28873ee4 --- /dev/null +++ b/tsconfig.typecheck.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "composite": false, + "incremental": false, + "noEmit": true + }, + "include": ["packages/ai/src/**/*"], + "exclude": ["**/dist", "**/node_modules"] +} diff --git a/vitest.config.ts b/vitest.config.ts index 008db3b2a..3b9a33e4d 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -8,6 +8,13 @@ export default defineConfig({ envDir: __dirname, test: { setupFiles: ["./vitest.setup.ts"], + // The nightly type-drift guard runs `.test-d.ts` files through vitest's + // `--typecheck` engine. Scope the tsc program to the package under test so + // unrelated source (example UIs needing `jsx`, providers relying on their + // own ambient `types`/`lib`) is not swept in and reported as drift. + typecheck: { + tsconfig: "./tsconfig.typecheck.json", + }, testTimeout: 15000, // 15 second global timeout (WASM Postgres / PGlite init can be slow) // Vitest uses hookTimeout for beforeEach/afterAll separately from testTimeout; keep both aligned hookTimeout: 15000,