fix(tests): restore the tests typecheck gate - #239
Open
xodapi wants to merge 1 commit into
Open
Conversation
`pnpm typecheck:tests` failed with 11 errors, so the gate could not detect new type regressions in test code. - analyze-session-contract-parity: drop a duplicated `readFileSync` import. - auth-modal: declare the `createObjectURL` mock parameter so `mock.calls[0]` is a one-element tuple instead of `[]`, which also makes the three `as Blob` casts unnecessary. - rust-analytics-sidecar: `toMatchObject` takes no type argument; type the case table with `RustAnalyticsSidecarError['code']` instead, which keeps the import meaningful and validates the four error codes. - Add `.d.mts` declarations for `migration-baseline-state.mjs` and `production-db-change-gate.mjs`. Both are imported from typed tests, and without declarations every export degraded to `any`, which silently disabled type checking across those two suites. Verification: `pnpm typecheck:tests` exits 0; `pnpm lint` clean; the five affected suites pass 32/32.
This was referenced Aug 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Restores
pnpm typecheck:tests, which failed with 11 errors across 5 files and therefore validated nothing.Errors fixed
analyze-session-contract-parity.test.ts—import { readFileSync }was duplicated on two consecutive lines (TS2300 x2). Removed the duplicate.auth-modal.test.tsx—vi.fn(() => "blob:...")declared no parameters, somock.calls[0]was typed as an empty tuple[]. Destructuringconst [blob]gave TS2493, and the threeblob as Blobcasts each gave TS2352 because the source type wasundefined. Typed the mock asvi.fn((_blob: Blob) => ...), which matches the realcreateObjectURLsignature and makes the three casts unnecessary.migration-baseline-state.test.tsandproduction-db-governance.test.ts— both import untyped.mjsscripts (TS7016 x3), which also madeenumlabelimplicitlyany(TS7006). Addedscripts/migration-baseline-state.d.mtsandscripts/production-db-change-gate.d.mts, written against the current implementations.runbookIdandreviewUrlare declared optional because the test exercises the fail-closed path by calling the gate withpathsalone.rust-analytics-sidecar.test.ts—toMatchObject<RustAnalyticsSidecarError>({ code })passed a type argument to a method that accepts none (TS2558). Removed it, and typed thecasesarraycodefield asRustAnalyticsSidecarError["code"]instead ofstring. That keeps the import in use and makes the four error-code literals checked rather than accepted as arbitrary strings.Notes
The two
.d.mtsfiles describe existing JavaScript; they add no runtime behaviour. Both declarations were written from the implementations rather than inferred, so a declaration cannot silently drift from what the scripts return.Verification
pnpm typecheck:tests— exits 0. Previously exited 2 with 11 errors.pnpm lint— clean.pnpm teston all 5 affected files — 32/32 pass, confirming the declarations match runtime and did not merely satisfy the compiler.pnpm knipstill fails, ontailwind-merge,tailwindcssandknip.config.jshints. Those are pre-existing and outside this diff, which touches neitherpackage.jsonnorknip.config.js.Full
pnpm testandpnpm test:e2ewere not run locally; only the affected files. No production or server access. No real user data, secrets, tokens, raw Brain ID, or private telemetry added.