fix: skip unreadable tsconfig files during auto-discovery#1033
Merged
Boshen merged 3 commits intooxc-project:mainfrom Feb 26, 2026
Merged
fix: skip unreadable tsconfig files during auto-discovery#1033Boshen merged 3 commits intooxc-project:mainfrom
Boshen merged 3 commits intooxc-project:mainfrom
Conversation
When `TsconfigDiscovery::Auto` walks parent directories and finds a tsconfig.json that exists but cannot be read (e.g. permission denied), treat it as if no tsconfig exists at that level and continue walking. Previously, `read_to_string` failures were mapped to `TsconfigNotFound`, which is also used for missing `extends` targets. Now I/O errors are properly mapped to `IOError`, and `find_tsconfig_auto` catches `IOError` to skip unreadable files while still propagating real config errors (bad JSON, broken extends, circular references). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
|
@Boshen CC captures most of the context there, but there's some nuances with Linux sandbox vs Darwin where Darwin is generally more lax. |
Member
|
I think it's worth adding a test that ensures the NotFound error is correctly emitted when the tsconfig.json specified in |
Merging this PR will degrade performance by 4.64%
Performance Changes
Comparing Footnotes
|
Ensure that missing or unreadable tsconfig files in `extends` and `references` emit the correct error variants (TsconfigNotFound vs IOError). Uses a custom UnreadableFs to simulate permission denied without platform-specific code. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
|
thanks guys! |
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.
Summary
TsconfigDiscovery::Autowalks parent directories and finds atsconfig.jsonthat exists but cannot be read (e.g. permission denied in sandboxed environments like Bazel/Docker), treat it as if no tsconfig exists at that level and continue walking parent directories.read_to_stringI/O failures were mapped toTsconfigNotFound, conflating "file not found" with "file not readable." Now I/O errors are properly mapped toIOError, andfind_tsconfig_autocatchesIOErrorto skip unreadable files while still propagating real config errors (bad JSON, broken extends, circular references).Context: vitejs/vite#21705 (comment)
Test plan
tsconfig_discovery_skips_unreadable_filetest (unix-only) that creates atsconfig.jsonwithchmod 000and verifiesfind_tsconfigreturnsOk(None)🤖 Generated with Claude Code