Return an API error when opened files cannot be loaded into a project - #64374
Merged
Merged
Conversation
Co-authored-by: andrewbranch <3277153+andrewbranch@users.noreply.github.com>
Co-authored-by: andrewbranch <3277153+andrewbranch@users.noreply.github.com>
Copilot started work on behalf of
Andrew Branch (andrewbranch)
September 21, 2026 16:53
View session
Andrew Branch (andrewbranch)
marked this pull request as ready for review
September 21, 2026 17:32
Copilot started reviewing on behalf of
Andrew Branch (andrewbranch)
September 21, 2026 17:33
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The validation uses existing error cleanup paths and has comprehensive sync and async regression coverage.
Review effort: Balanced
Findings: None
What changed in this PR
Returns a client error instead of panicking when snapshot-opened files cannot be loaded into a project.
Changes:
- Validates project membership for opened files.
- Documents the failure contract.
- Adds sync and async regression coverage.
| File | Description |
|---|---|
| tsc/internal/project/projectcollectionbuilder.go | Rejects files without a project. |
| tsc/internal/api/proto.go | Documents rejection behavior. |
| packages/typescript/test/sync/api.test.ts | Tests synchronous snapshot behavior. |
| packages/typescript/test/async/api.test.ts | Tests asynchronous snapshot behavior. |
| packages/typescript/src/api/proto.generated.ts | Exposes the documented API contract. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Andrew Branch (andrewbranch)
approved these changes
Sep 21, 2026
Andrew Branch (andrewbranch)
left a comment
Member
There was a problem hiding this comment.
In the future, it would be great to attach a reason to this error, but I'm afraid that might be a lot of plumbing the way things are set up right now.
Andrew Branch (andrewbranch)
requested a review
from Gabriela Araujo Britto (gabritto)
September 21, 2026 17:44
Gabriela Araujo Britto (gabritto)
approved these changes
Sep 21, 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.
Analysis
The crash reported on #64204 occurs when
openFilesrequests an unreadable virtual identity: ts-loader opensApp.vue.ts, but its host servesApp.vue. Snapshot construction proceeds without a containing project, then panics while building the response. This also reproduces withcreateSnapshot, not onlyupdate.Fix
Copilot Checklist
I successfully ran the applicable command at the end of my session, and it completed without error: