Repository navigation
ci: tsc differential parse for the TypeScript grammar - #12
Merged
Merged
Conversation
tsc is the ground truth for whether a file is valid TypeScript syntax. The new job parses pinned corpora (Effect, Zod, Excalidraw, VS Code src/) and the in-repo ts-syntax fixtures with both tsc and the vendored tree-sitter-typescript/tsx wasm. It fails on any file that tsc accepts and tree-sitter rejects when that file is not in the checked-in baseline. Baseline files that now parse are reported as "now agree". The gap-*.ts and variance.ts fixtures record known grammar gaps (tree-sitter-typescript#370 and others), so a patched grammar or a candidate fork shows its fixes as "now agree". Fork-only. It runs on PRs and main pushes that touch the TS wasm, the grammar sources or patch, the lockfile, or the job's own files.
- run under --liftoff-only via self re-exec (V8 Zone OOM guard, colbymchenry#293/colbymchenry#298) - strict fixtures: tsc-invalid or non-gap divergent fixtures fail - 0-file corpus is a setup error; vanished baseline paths are reported, never now-agree - baseline stores each file's first error row; an earlier row fails as a new error - one construct per gap fixture - upload the --json report; restore/save cache split so failing runs still cache - trigger paths narrowed to the TS grammar sources; docs say wasm only - step summary on exit 2; rename race tolerated; oracle and grammar canaries - cache dir and marker keyed on subdir too
- cache path under $RUNNER_TEMP via GITHUB_ENV (actions/cache rejects '..'); key v3 - every exit-2 setup error writes the step summary - relaunch guard without --liftoff-only fails closed - wasm flags checked against src/extraction/wasm-runtime-flags.ts (and that file triggers the job) - first-error-row gate skips the editable local fixtures; pinned corpora hint at --update - baseline corpora missing from corpora.json are reported as vanished - TSX oracle canary; malformed baseline rows are a setup error
This was referenced Nov 6, 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.
What
This adds a CI job,
TS grammar differential, that exists only in the fork. It treats tsc as the ground truth for TypeScript syntax and checks the vendored tree-sitter-typescript and tsx wasm grammars against it.ts.createSourceFile(...).parseDiagnostics, syntax only. Tree-sitter's verdict isrootNode.hasError. The job runs under--liftoff-only, the same flag as production (a self re-exec, checked againstsrc/extraction/wasm-runtime-flags.ts). Canaries check that the tsc oracle (both TS and TSX) and both grammars can still tell good input from bad. If either can't, the job fails before it does any corpus work.src/, and the in-repo__tests__/fixtures/ts-syntax/. The external ones are pinned by SHA and cached under$RUNNER_TEMP.scripts/ts-differential.baseline.jsonrecords each divergent file's first error row):--update.variance.ts(tree-sitter-typescript#370),static accessor, import attributes onexport {..} fromand onexport * from,usingin a for-of head, andawait usingin a for-await head. A grammar that fixes one reports it as now-agree, which is how a candidate fork is compared with ours.Scope: wasm only. The native kernel's grammar is not exercised here. Wasm/kernel parity is
scripts/kernel-parity.mjs's job.Background: tree-sitter-typescript has had no commit since 2025-01-30 (tree-sitter/tree-sitter#6091), and we carry grammar patches (colbymchenry#3226).
Verified
Full local run against current main's wasm (tsc 5.9.3, web-tree-sitter 0.25.10). It exits 0:
Two review rounds (/code-review plus a code-reviewer agent) found 21 issues in total. All are fixed except one accepted low-severity item: SIGTERM sent to the parent orphans the relaunched child. Each fix has a before/after check: a new fixture missing from the baseline exits 1; a version mismatch, a renamed fixture, a 0-file corpus, a blind oracle, flag drift and a malformed row each exit 2.