Repository navigation
ci: ratchet type errors in apps/sim test files - #8959
Conversation
apps/sim's tsconfig excludes *.test.ts(x), so ~3.4k test files are never type-checked and any new test can add errors. check:test-types runs the native tsc on apps/sim/tsconfig.tests.json (the app config with tests left in), counts errors per file, and compares with a shrink-only baseline, matching check:explicit-any's semantics: a rise or a new file fails, a drop fails until --update shrinks it, --update never raises, --update --init only creates a missing baseline. Output it cannot place (global diagnostics, a crash) fails outright instead of reading as fewer errors. It type-checks the whole app, so it runs in its own test-types job gated like test (wired into ci-gate.sh), not in check:audits. On failure the job uploads counts.json and the compiler output; --counts <file> lets the baseline be bootstrapped or shrunk from that artifact without a local compile.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
… --init path Baseline from run 38342772080's test-types counts: 3209 errors in 874 files. --update stays shrink-only; a missing baseline is restored from git.
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 11 files
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
Turn on auto-fix | Re-trigger cubic
|
… tests
A per-file count let one new error replace a fixed one with the total flat.
The baseline is now { file: { TSnnnn: count } }: any (file, code) count
that rises fails, including a new code in a baselined file, and --update
stays shrink-only per pair. The key stops at the code: line and column
move with edits, and messages print types that change with unrelated
source or compiler versions.
--diagnostics <file> replaces --counts: it reads a saved compiler output
(the CI artifact's diagnostics.txt) through the same parser and undercount
checks, so a fix can shrink the baseline without a local compile. The
baseline was migrated from run 38342772080's diagnostics.txt with the
script's parser: 3209 errors in 874 files across 52 codes, every per-file
total equal to the previous baseline's.
Command-level tests run the real script on fixture diagnostics: unchanged,
a rising count, a new code replacing a fixed error, a new file, a dropped
count, --update refusing a raise, --update shrinking, and unparseable or
inconsistent output. The checks.yml comment now describes the artifact as
input for shrinking the existing baseline.
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 11 files
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
Turn on auto-fix | Re-trigger cubic
--diagnostics read an empty or truncated diagnostics.txt as fewer errors, so a failed compile's artifact plus --update could erase the baseline. --report now writes status.json (exit code and printed error count) once the compile's output and exit code agree, and --diagnostics requires it: exit 0 must mean no errors, the parse must match the recorded count, and a missing or malformed status fails. Command-level tests cover each case and that --update never writes the baseline from such input. Also passes a route context to the socket-token route test's POST call, the one new test type error (TS2554) the ratchet caught after #8958.
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
No issues found across 12 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
Turn on auto-fix | Re-trigger cubic
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
No issues found across 12 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
Turn on auto-fix | Re-trigger cubic
Summary
apps/sim's tsconfig excludes*.test.ts(x), so about 3,363 test files are never type-checked. This adds a shrink-only ratchet so new type errors can't enter test files, without forcing anyone to fix the existing ones now.apps/sim/tsconfig.tests.jsonextends the app config and includes the test files. Only the ratchet uses it.check:test-types(scripts/check-test-types.ts)tsc(the repo's@typescript/native) on that config and counts errors per file.--updateshrinks the baseline, the same ascheck:explicit-any.--updatenever raises a count.test-typesjob (4 vCPU) runs alongside lint, test and build, so it stays off the critical path, at about 1.5 min. It's gated on thetestflag and included inci-gate.sh. On failure it uploadsdiagnostics.txtandcounts.json, so a shrink never needs a local compile:gh run download <run> -n test-types -D <dir>, thenbun run scripts/check-test-types.ts --counts <dir>/counts.json --update. It isn't incheck:audits, because that also runs on laptops.Known gap: an
@ts-expect-erroror@ts-ignoreadded to a test still hides an error. Counting those could be a follow-up.Test plan
test-typesjob passes against the committed baselinescripts/check-test-types.test.ts(parsing and comparison; each guard verified by revert),ci-gate.test.ts