Repository navigation
[api] Report project reference diagnostics on programs without a config file - #64637
Merged
Andrew Branch (andrewbranch) merged 1 commit intoOct 6, 2026
Conversation
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused fix correctly uses the existing compiler-diagnostic fallback and includes regression coverage.
Review effort: Balanced
Findings: None
What changed in this PR
Prevents API crashes when synthetic programs without config files report project-reference diagnostics.
Changes:
- Adds a nil guard before accessing
ConfigFile. - Adds regression coverage for TS6306 reporting.
| File | Description |
|---|---|
tsc/internal/tsoptions/tsconfigparsing.go |
Falls back when reference syntax is unavailable. |
tsc/internal/api/session_createprogram_test.go |
Verifies non-composite reference diagnostics. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Andrew Branch (andrewbranch)
approved these changes
Oct 6, 2026
Andrew Branch (andrewbranch)
enabled auto-merge
October 6, 2026 22:36
Christopher Plieger (cplieger)
deleted the
fix-api-nil-configfile-project-reference
branch
October 6, 2026 23:54
Theo Browne (t3dotgg)
added a commit
to pingdotgg/ts-rust
that referenced
this pull request
Oct 9, 2026
…fig file (#64637) Port the Go test of microsoft/TypeScript#64637 (09d496657), Go N' fed0bf24149f: TestCreateProgramReportsNonCompositeProjectReference (api/session_createprogram_test.go:283). A synthetic program with a reference to a non-composite project reports TS6306. The fix is the config lane's tsoptions nil guard (tsconfigparsing.go:1530, CreateDiagnosticAtReferenceSyntax). It is not in int1 or config 3 yet, so this test panics ("nil pointer dereference: config.ConfigFile") until root applies w2b/api/patches/64637-nil-guard.patch (it passes with the patch). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.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.
Backlogmilestone (required)mainbranchnpx hereby testnpx hereby lintnpx hereby check:formatFixes #64629
A program created through
createProgramshas no configuration file, so itsParsedCommandLine.ConfigFileis nil. Any project reference diagnostic on such a program crashes the API server with a nil pointer dereference inCreateDiagnosticAtReferenceSyntax.Impact: a tool that builds its own program for a repository that references a non-composite project kills the whole API server process, losing every open snapshot, and the tool sees only an EOF. That is an ordinary monorepo setup, where
tsc -preports TS6306 and keeps going, so an analyzer on the API stops on that repository instead of analyzing it.CreateDiagnosticAtReferenceSyntaxnow returns nil whenConfigFileis nil, and its caller inverifyProjectReferencesalready falls back to a compiler diagnostic in that case.TestCreateProgramReportsNonCompositeProjectReferencecreates such a program with a reference to a non-composite project and expects TS6306 as its only program diagnostic, and it panics without the fix.I met this while building deadset-ts, the TypeScript analyzer of deadset, on the TypeScript 7 API. That work hit a small set of related defects, which is why a few reports come from me.
An AI coding agent wrote this patch. I have read, built and tested it and will handle the review.