Skip to content

feat(oracle-gaps): check tsconfig coverage and TypeScript errors in oracle files - #198

Open
schiller-manuel wants to merge 1 commit into
mainfrom
feat/oracle-gaps-typecheck
Open

schiller-manuel wants to merge 1 commit into
mainfrom
feat/oracle-gaps-typecheck

Conversation

@schiller-manuel

Copy link
Copy Markdown

Problem

oracle-gaps runs Vitest with typecheck: { 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 in tsconfig.json — previously reported all oracle files pass, 0 gaps while tsc --noEmit failed.

Solution

Add packages/oracles/oracle-gaps/typecheck.mjs and wire it into check.mjs, args.mjs, report.mjs, and index.mjs:

  • Bundled TS 5.9 only: Uses typescript-for-tanstack-oracles (never loading the target package's typescript), preserving compatibility with JS repos, packages without TypeScript, and TypeScript 7 packages.
  • No-op without tsconfig.json by default: Packages without a tsconfig.json in --package (such as JS repos and synthetic fixture packages) incur zero notes or refusals unless --typecheck is explicitly passed.
  • Coverage across projectReferences: Parses tsconfig.json (or --tsconfig <file>) and follows solution-style projectReferences (file or directory targets, cycle-safe) to detect any .ts/.tsx/.mts/.cts oracle file excluded from typechecking.
  • Graceful TS 7 / incompatible config handling: When a covering tsconfig contains options unsupported by bundled TS 5.9 (e.g. TypeScript 7's contentMappers) or invalid JSON, coverage is still checked where parseable and semantic checking is skipped cleanly with an oracle-gaps: note typecheck: skipped ... line rather than false-positive errors.
  • Scoped diagnostics: Runs getSyntacticDiagnostics + getSemanticDiagnostics only on the covered TypeScript oracle files (with noEmit: 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/ SourceFile cache for fast --daemon parity.
  • Greppable notes by default + strict --typecheck opt-in:
    • Default runs emit single-line oracle-gaps: note typecheck: ... lines to stderr, stream.log, stdout summary, summary.md (## Typecheck notes), and structured typecheck data in results.json.
    • Passing --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 — passed
  • pnpm run typecheck — passed
  • pnpm run lint:check — passed
  • pnpm run format:check — passed
  • pnpm run test:publint — passed
  • pnpm run test:sherif — passed
  • pnpm --filter @tanstack/oracles run test — 9 files, 125 tests passed (including 8 new unit + CLI/daemon tests in tests/oracle-gaps-typecheck.test.ts)
  • pnpm --filter @tanstack/oracles run test:oracle-gaps:fast — 5 files, 33,899 tests passed
  • pnpm --filter @tanstack/oracles run test:oracle-gaps:shards — 5 shards partition the e2e tests
  • pnpm --filter @tanstack/oracles run test:pr-shards — 7 partitions split their tests exactly
  • Targeted gap-report-oracle e2e checks (every outcome class, apiLessTypescript, noTypescript) — 3/3 passed

…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>
@changeset-bot

changeset-bot Bot commented Nov 23, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 85f3a8e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Nov 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 19090b2a-0bbd-450a-8b73-16b4c3005379
Commits

Reviewing files that changed from the base of the PR and between 7b6bae1 and 85f3a8e.

Files selected for processing: 6

  • packages/oracles/oracle-gaps/args.mjs
  • packages/oracles/oracle-gaps/check.mjs
  • packages/oracles/oracle-gaps/index.mjs
  • packages/oracles/oracle-gaps/report.mjs
  • packages/oracles/oracle-gaps/typecheck.mjs
  • packages/oracles/tests/oracle-gaps-typecheck.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

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