Repository navigation
feat(oracle-gaps): check tsconfig coverage and TypeScript errors in oracle files - #198
Open
schiller-manuel wants to merge 3 commits into
Open
schiller-manuel wants to merge 3 commits into
schiller-manuel wants to merge 3 commits 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>
🦋 Changeset detectedLatest commit: 330cf22 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
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 10 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. |
commit: |
The gap report owes its TypeScript findings to the output, and never a refusal (maintainer decision of 2026-11-23, "Type errors are reported, never blocking"). A property draws the package layout (no tsconfig, a tsconfig that includes the tests, one that excludes them, a solution whose reference covers them), a type error in an oracle file, the removed --typecheck flag, and the daemon. The model states the notes, the summary section, results.json, and an exit status that the findings do not change, and the removed flag refused as an unknown option. RED on the parent (85f3a8e): 5 of 26 units fail, all on the refusal law: a run with --typecheck completes (exit 0) on a clean package and refuses (exit 2, a TS2322 refusal, no unknown-option block) on a package with a type error. The reporting, exit, summary and results laws hold on the parent. Adds the pr-shards partition and its CI job, which gates the preview. Co-authored-by: Isaac <no-reply@databricks.com>
Per the maintainer's decision of 2026-11-23 ("Type errors are reported,
never blocking"), TypeScript findings in oracle files are reported as
output only: the stream notes, the summary's Typecheck notes section,
and results.json. A run's exit status and done line do not depend on
them.
- Remove the --typecheck refusal mode, its exit-2 path and its flag.
The flag is now an unknown option, which refuses before any check.
--tsconfig stays: it names the config, not a mode.
- Drop the cross-check cache of node_modules source files in
typecheck.mjs. Nothing is kept across daemon checks, so no read needs
to be a daemon input (R46). A warm daemon check on this repo is about
0.3 to 0.4 s slower; a cold run is unchanged.
- Changeset for the new output.
Co-authored-by: Isaac <no-reply@databricks.com>
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.
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 passedUpdate: TypeScript findings are reported, never blocking (head 330cf22)
Per the maintainer's decision of 2026-11-23 ("type errors shouldn't block a run but we can just put them in the output"), the refusal mode is removed. TypeScript findings in oracle files are reported as output only. The sections above describe the first head (85f3a8e); where they say
--typecheckrefuses, this update supersedes them.What changed
oracle-gaps: note typecheck: ..., on stderr and stdout, andstream.log), insummary.md(## Typecheck notes), and inresults.json(typecheck). They never refuse or fail a run; the exit status and the done line are the same either way.--typecheckand its exit-2 path are removed. The flag is now an unknown option, refused before any check starts.--tsconfig <file>stays, since it names a config rather than a mode.typecheck.mjsno longer cachesnode_modulessource files across daemon checks (the stat-stamped cache). Nothing is kept across checks, so no read needs to be a daemon input (R46). The cost is in the Cost section below..changeset/oracle-gaps-report-typescript.md.Commits
bbe933dc(oracle first): the new law, its shard partition, and its CI job. Run on the parent, it fails, as the RED result below shows.330cf22b(the change): the removal, the cache removal, the unit tests moved to report-only semantics, and the changeset.Evidence
packages/oracles/oracle-gaps/gap-report-typecheck-oracle.property.test.mjs.--typecheckrefused as an unknown option). In the two generated campaigns, every state was entered by at least one generated history exceptdaemon run with type errorsin one campaign, which the constructed history covers.pnpm exec vitest --run --config oracle-gaps/vitest.config.mjs gap-report-typecheck→ 5 failed, 21 passed. The failures are the refusal law only:fixed seed 20261123: --typecheck refused as an unknown option,random seed: --typecheck refused as an unknown option,fixed seed 20261123: generated,random seed: generated, andcalibration: the removed --typecheck flag still refuses a clean package. Concretely,--typecheckon a clean package exits 0, and on a package with a type error it exits 2 with a TS2322 refusal, notunknown option --typecheck.tests/oracle-gaps-typecheck.test.ts→ 8 passed. Static gap oraclegap-report-static→ 172 passed.pnpm --filter @tanstack/oracles run typecheck,lint, and prettier on the changed files → clean.node scripts/pr-shards.mjs check→ 8 partitions split their tests exactly.node scripts/e2e-shards.mjs check→ 5 shards partition the e2e tests.fileDiagnostics = []): 8 of 26 fail, lawtypecheck report.check.mjs): 8 of 26 fail, lawtypecheck exit.report.mjs): 10 of 26 fail, lawtypecheck report.typecheck report.typecheckfield dropped fromresults.json: 12 of 26 fail, lawtypecheck report.Why the law is a new property file
The gap e2e oracle (
gap-report-oracle.property.test.mjs) is unchanged. Its fixtures write no tsconfig, so none of its histories reaches a TypeScript path, and drawing a new field into its generator would shift every seed of its campaigns (R54) and cost about 30 CLI runs per history. The TypeScript law is a separate, small oracle over the same CLI, named in thegap-report-family and run in its own CI job, so the gap e2e campaign and its seeds are unchanged. This is a judgment call. If you want the dimension in the gap e2e oracle itself, say so, and I will move it.Cost (P12)
Measured wall time of
typecheckOracleFilesin a fresh process (one check = one CLI run):packages/oracles(7 oracle files, 322 source files in the program)Of the repo's time, about 0.6 s is creating the program (289
node_modulesfiles, mostly the Vitest types) and about 0.9 s is the semantic check. Narrowing the program's roots to the oracle files did not help (1.5 s against 1.5 s), so it is not used.Cache removal (warm daemon, two checks in one process on this repo): the head's cache gives 0.83 to 0.92 s per warm check; the uncached code gives 1.15 to 1.33 s. So a warm daemon check is about 0.3 to 0.4 s slower on a package with a tsconfig. A cold run is unchanged. A cheaper alternative needs the cache back under R46, with its keys as daemon inputs. That is a follow-up, not in this PR.
The new CI job runs the new oracle, about 2 min locally (122 s under load), in its own job with a 20-minute backstop.
Weight (shipped
oracle-gapsCLI, minified and compressed;packages/oracles/oracle-gaps/*.mjsminus property tests)Against main: +5,240 B minified (+4.1%), +2,157 B gzip (+4.1%), +1,997 B brotli. This head is smaller than the first head by 1,920 B minified. The
distbundle is built fromsrc/, which this PR does not touch.Conflict with #99
args.mjsconflicts with #99 (fix/gap-cli-deterministic-cuts, 6ccca9d) ingit merge-tree: both edit the usage text and the valued options.check.mjs,index.mjs, andscripts/pr-shards.mjsmerge cleanly. Theargs.mjschange here is minimal (one flag removed, the usage text re-wrapped, one option removed). I did not rebase onto #99, per the instruction that #99 merges first.Limits
contentMappers) are skipped with a note and are not drawn by the new oracle. The skip is not recorded in a coverage map or the README, since neither exists in this repo.node_modulesedit between two daemon checks; more than one reference level; a config withfilesandincludetogether.CI
See the CI line below, which is updated when the run for this head finishes.
This pull request and its description were written by Isaac.