Repository navigation
Preserve dependency invalidation after large watch batches - #65718
Open
benjibun (benjibunbun) wants to merge 1 commit into
Open
benjibun (benjibunbun) wants to merge 1 commit into
benjibun (benjibunbun) wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the fix for dependency invalidation after large watch-event batches.
No open issues 🎉
What changed in this PR
Fixes #65638 by preserving dependency invalidation when opening or closing unsaved files after large watch-event batches, preventing stale importer diagnostics in the language server.
Changes:
- Apply open/close conversion after either watch-processing branch while preserving existing filtering and bulk invalidation.
- Add project tests for unsaved content, disk edits, deletion, and program/configuration reuse.
- Add language-server diagnostic regressions covering 0, 999, 1,000, and 1,001 watch events.
| File | Description |
|---|---|
tsc/internal/project/snapshot.go |
Move open/close conversion outside the watch-processing branches. |
tsc/internal/project/bulkcache_test.go |
Test dependency content updates and cache reuse after large watch batches. |
tsc/internal/lsp/server_watchdiagnostics_test.go |
Verify importer diagnostics update while unrelated diagnostics remain intact. |
Review effort: Balanced
Author
|
@microsoft-github-policy-service agree |
This branch has not been deployed
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.
Fixes #65638
This PR was co-authored with Codex using GPT-6 (reasoning setting unavailable). Codex implemented and tested the fix under my guidance.
Motivation & Guidance
Motivation: The contributor selected this issue after an agent-assisted search and requested implementation, verification and review before submission.
Guidance: Keep the change minimal, address the underlying cause, preserve existing behaviour and avoid unrelated cleanup.
Analysis
After more than 1,000 watch events,
processFileChangesskips the open/close conversion. When unrelated watch paths are filtered out, the dependency's change between disk and unsaved contents is lost, so the importer can reuse a stale program.Fix
Run the existing conversion after either watch-processing branch, before evicting open files from the cache. This preserves watch filtering and the bulk invalidation rules.
Tests cover opening and closing at 0, 999, 1,000 and 1,001 events, preserved unrelated diagnostics, disk edits and deletion, and unchanged program/configuration reuse. Both stale-diagnostic cases fail on the original code and pass with the fix.
Validation passed on macOS arm64:
npx hereby validate --allnpx hereby tidynpx hereby check:format-race.The macOS run used a resolved
TMPDIRpath for an existing codegen test.