Skip to content

chore(ts): the typecheck gate skipped middleware/ and six other directories - #823

Merged
lilyshen0722 merged 1 commit into
mainfrom
chore/typecheck-covers-every-directory
Aug 4, 2026
Merged

chore(ts): the typecheck gate skipped middleware/ and six other directories#823
lilyshen0722 merged 1 commit into
mainfrom
chore/typecheck-covers-every-directory

Conversation

@lilyshen0722

Copy link
Copy Markdown
Contributor

Based on main, independent of the #817/#821 and #813/#820 stacks.

The correction that led here

@ux-lead reported that Test & Coverage is "structurally blind" to type-level changes and proposed adding npm run tsc:check to the workflow. That step already exists.github/workflows/tests.yml:53-56, inside the Test & Coverage job, no continue-on-error, since 4ac17629 on 2026-04-09. Verified end to end: a type error in models/Pod.ts makes the script exit 2 with 5 errors.

The premise underneath was right (ts-jest strips types, so jest cannot see a type change) — the leap was from jest to the whole check, which is a job with five steps. But chasing it found a real version of the same defect one layer down.

The actual gap

tsconfig.typescheck.json enumerated 8 directories. Backend has seven more containing .ts:

middleware/ · providers/ · gateway/ · types/ · scripts/ · migrations/ · seed/

So the required gate never typechecked middleware/agentRuntimeAuth.ts — the module every agent route depends on for req.agentUser.

Demonstrated, not argued:

exit
const __probe: number = "not a number" in middleware/agentRuntimeAuth.ts, new config 2 (1 error, names the file)
same error, old config 0
clean tree, new config 0

The fix, and why it is exclude-driven

All seven directories were already clean — that is the point. Nobody knew, because nothing checked, and an enumerated include list stops covering any directory added after it is written while the miss looks exactly like a pass. Adding seven lines would fix today and re-break on the next directory.

Inverted to include: ["**/*.ts"] plus an explicit exclude list, so a new directory is covered by default and the failure mode flips from silently-unchecked to listed-as-debt. The four root-level scratch scripts (test-discord-*.ts, cleanup-test-data.ts — 54 pre-existing errors, unreferenced by package.json or any route or service) are excluded by name with a comment saying to fix or delete them rather than extend the list.

Starts green: npm run tsc:check exits 0.

Why it is worth landing

Test & Coverage is the only required context on main (required_pull_request_reviews is null). Anything that gate cannot see, nothing can.

🤖 Generated with Claude Code

…tories

tsconfig.typescheck.json enumerated 8 directories. Seven containing .ts were
not among them — middleware/, providers/, gateway/, types/, scripts/,
migrations/, seed/ — so `npm run tsc:check`, which runs inside the required
`Test & Coverage` job, never typechecked agentRuntimeAuth.ts. Every agent
route depends on it.

Demonstrated rather than argued: injecting `const __probe: number = "x"` into
middleware/agentRuntimeAuth.ts exits 2 under this config and exits **0**
under the old one.

All seven directories were already clean, which is the point — nobody knew,
because nothing checked, and an enumerated include list stops covering any
directory added after it is written while the miss looks exactly like a pass.

Inverted to exclude-driven so a new directory is covered by default. The four
root-level scratch scripts (54 pre-existing errors, unreferenced by
package.json or any route or service) are listed explicitly as debt.

Prompted by @ux-lead's finding that the merge gate can be blind to
type-level changes — the general claim was right about a narrower target
than they aimed at.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@lilyshen0722
lilyshen0722 merged commit eb281ed into main Aug 4, 2026
11 checks passed
@lilyshen0722
lilyshen0722 deleted the chore/typecheck-covers-every-directory branch August 4, 2026 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant