Skip to content

Commit 48564c0

Browse files
committed
fix(wizard): resolve @cipherstash/auth via the node condition; gate typecheck
Closes the last open item from the #771 review — the 3 pre-existing `AutoStrategy` tsc errors flagged as "would bite a future strict type gate". **Root cause.** `@cipherstash/auth` uses conditional exports: `node` resolves to `index.d.ts` (the full surface, including `AutoStrategy`), `default` resolves to `wasm-types.d.ts` (which has no `AutoStrategy`). The wizard's tsconfig sets `moduleResolution: "bundler"`, which does NOT include the `node` condition, so tsc took the `default` branch and reported `AutoStrategy` as missing on all three call sites — `agent/fetch-prompt.ts`, `agent/interface.ts` and `lib/prerequisites.ts`. Nothing was actually broken at runtime: the wizard is a Node CLI and always loads the `node` branch. The types were simply resolved against the wrong entry point. **Fix.** Add `"customConditions": ["node"]`, matching what `packages/stack`, `packages/prisma-next`, `packages/test-kit`, `packages/stack-drizzle` and `packages/stack-supabase` already carry for the identical `protect-ffi` conditional-export problem. `tsc --noEmit` now exits 0. **Regression guard.** A type-level defect needs a type-level gate, or it comes back silently — the wizard is built by tsup with `dts: false`, so the build transpiles without ever typechecking, which is exactly why these three errors sat in `main` unnoticed. Add a `typecheck` script and wire it into `tests.yml` alongside the prisma-next gate (#684). Verified the gate fires: with `customConditions` removed the step exits 2 on all three errors; restored, it exits 0. No changeset — `dts: false` means the published tarball is byte-identical. Tooling only, no observable behaviour change. Green: wizard 265 pass / 5 env-skipped, typecheck 0 errors; stash 770 pass / 53 files; `code:check` 0 errors.
1 parent ae2fedd commit 48564c0

3 files changed

Lines changed: 18 additions & 0 deletions

File tree

.github/workflows/tests.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,12 @@ jobs:
146146
- name: Typecheck (bench — guards the stack/stack-drizzle importers)
147147
run: pnpm exec turbo run build --filter @cipherstash/bench
148148

149+
# The wizard is built by tsup, which transpiles without typechecking, so
150+
# nothing here caught the three `auth.AutoStrategy` resolution errors that
151+
# sat in `main` until #771. Gate it so they cannot come back silently.
152+
- name: Typecheck (wizard)
153+
run: pnpm --filter @cipherstash/wizard run typecheck
154+
149155
- name: Lint — no hardcoded package-manager runners
150156
run: pnpm run lint:runners
151157

packages/wizard/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"postbuild": "chmod +x ./dist/bin/wizard.js",
2727
"dev": "tsup --watch",
2828
"test": "vitest run",
29+
"typecheck": "tsc --project tsconfig.json --noEmit",
2930
"lint": "biome check ."
3031
},
3132
"dependencies": {

packages/wizard/tsconfig.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@
77
"allowJs": true,
88
"esModuleInterop": true,
99
"moduleResolution": "bundler",
10+
11+
// `@cipherstash/auth` uses conditional exports — `node` picks `index.d.ts`
12+
// (the full surface, including `AutoStrategy`), `default` picks
13+
// `wasm-types.d.ts` (which has no `AutoStrategy`). Bundler resolution does
14+
// not include `node` by default, so without this the wizard's three
15+
// `auth.AutoStrategy` call sites fail to typecheck even though they run
16+
// fine — the wizard is a Node CLI and always loads the `node` branch.
17+
// Matches `packages/stack`, `packages/prisma-next`, `packages/test-kit`,
18+
// `packages/stack-drizzle` and `packages/stack-supabase`.
19+
"customConditions": ["node"],
20+
1021
"allowImportingTsExtensions": true,
1122
"verbatimModuleSyntax": true,
1223
"noEmit": true,

0 commit comments

Comments
 (0)