Repository navigation
feat(oracle-gaps): check tsconfig coverage and TypeScript errors in oracle files - #198
schiller-manuel wants to merge 1 commit into
Conversation
…racle files Vitest strips TypeScript without typechecking, so oracle files with type errors or excluded from tsconfig.json previously passed oracle-gaps silently. - Add oracle-gaps/typecheck.mjs using bundled typescript-for-tanstack-oracles (never loading the package's own TypeScript), checking tsconfig.json coverage across solution-style projectReferences and running syntactic/semantic diagnostics on covered TypeScript oracle files. - Leave packages without tsconfig.json (JS repos and synthetic fixtures) unaffected by default; gracefully skip semantic checking (while still checking coverage) when a tsconfig uses options unsupported by bundled TS 5.9 (such as TypeScript 7's contentMappers). - Emit greppable `oracle-gaps: note typecheck: ...` lines (stderr, stream.log, stdout summary, summary.md, and results.json) by default, and add `--typecheck` and `--tsconfig <file>` to enforce typechecking as a refusal (exit 2). - Add unit and CLI/daemon integration tests in tests/oracle-gaps-typecheck.test.ts. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 24 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Problem
oracle-gapsruns Vitest withtypecheck: { enabled: false }, which strips TypeScript types without checking them. As a result, a package whose TypeScript oracle files (*.oracle*.test.ts) have TypeScript type errors — or are not even included intsconfig.json— previously reportedall oracle files pass, 0 gapswhiletsc --noEmitfailed.Solution
Add
packages/oracles/oracle-gaps/typecheck.mjsand wire it intocheck.mjs,args.mjs,report.mjs, andindex.mjs:typescript-for-tanstack-oracles(never loading the target package'stypescript), preserving compatibility with JS repos, packages without TypeScript, and TypeScript 7 packages.tsconfig.jsonby default: Packages without atsconfig.jsonin--package(such as JS repos and synthetic fixture packages) incur zero notes or refusals unless--typecheckis explicitly passed.projectReferences: Parsestsconfig.json(or--tsconfig <file>) and follows solution-styleprojectReferences(file or directory targets, cycle-safe) to detect any.ts/.tsx/.mts/.ctsoracle file excluded from typechecking.contentMappers) or invalid JSON, coverage is still checked where parseable and semantic checking is skipped cleanly with anoracle-gaps: note typecheck: skipped ...line rather than false-positive errors.getSyntacticDiagnostics+getSemanticDiagnosticsonly on the covered TypeScript oracle files (withnoEmit: true, incremental: false, composite: false, emitDeclarationOnly: false, skipLibCheck: true), so pre-existing type errors in unrelated files are ignored and no build artifacts are written. Uses a stat-stamped/node_modules/SourceFilecache for fast--daemonparity.--typecheckopt-in:oracle-gaps: note typecheck: ...lines to stderr,stream.log, stdout summary,summary.md(## Typecheck notes), and structuredtypecheckdata inresults.json.--typecheck(and optionally--tsconfig <file>) refuses the run (exit 2, report-shaped refusal) before baseline tests run if the tsconfig is missing/incompatible, any TypeScript oracle file is excluded, or any oracle file has TypeScript errors.Validation
pnpm run build— passedpnpm run typecheck— passedpnpm run lint:check— passedpnpm run format:check— passedpnpm run test:publint— passedpnpm run test:sherif— passedpnpm --filter @tanstack/oracles run test— 9 files, 125 tests passed (including 8 new unit + CLI/daemon tests intests/oracle-gaps-typecheck.test.ts)pnpm --filter @tanstack/oracles run test:oracle-gaps:fast— 5 files, 33,899 tests passedpnpm --filter @tanstack/oracles run test:oracle-gaps:shards— 5 shards partition the e2e testspnpm --filter @tanstack/oracles run test:pr-shards— 7 partitions split their tests exactlygap-report-oraclee2e checks (every outcome class,apiLessTypescript,noTypescript) — 3/3 passed