Repository navigation
fix(65071): resurrect dirty.SyncMap entries after Delete in LoadOrStore - #65072
Open
Timur Vural (timurzvural) wants to merge 1 commit into
Open
Timur Vural (timurzvural) wants to merge 1 commit into
Timur Vural (timurzvural) wants to merge 1 commit into
Conversation
LoadOrStore returned (nil, false) for tombstoned keys, so acquireConfigForFile and similar callers nil-dereferenced after closeProjects. Revive the entry with the new value instead (also covers microsoft#65054 / microsoft#64911). Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the change restoring tombstoned entries to prevent crashes when projects close and files reopen.
No open issues 🎉
What changed in this PR
Fixes #65071 by making dirty.SyncMap.LoadOrStore restore deleted entries instead of returning nil, preventing crashes when snapshot updates close projects and reopen files.
Changes:
- Restore tombstoned entries with the supplied value and mark them dirty.
- Add unit tests for base-map and dirty-only tombstones.
- Add API regression coverage for closing projects and reopening files in combined and separate updates.
| File | Description |
|---|---|
tsc/internal/project/dirty/syncmap.go |
Restore tombstoned entries in both LoadOrStore paths. |
tsc/internal/project/dirty/syncmap_tombstone_test.go |
Test restoration, return values, and subsequent lookups. |
tsc/internal/api/session_apistate_test.go |
Test close-project and reopen-file snapshot sequences. |
Review effort: Balanced
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 #65071.
Bug
dirty.SyncMap.LoadOrStorereturned(nil, false)when the key had a delete tombstone. Callers such asacquireConfigForFileignore the bool and immediately callentry.ChangeIf(...), which nil-dereferences aftercloseProjects+openFiles(same or separate updates).Same root cause as #65054 and #64911.
Fix
When
LoadOrStorefinds a tombstoned entry, resurrect it with the provided value (delete = false,dirty = true) and return(entry, false)instead of nil.Tests
dirty.TestLoadOrStoreAfterDeleteTombstone— base and dirty-only tombstonesapi.TestCloseProjectsThenOpenFilesDoesNotPanic— API:closeProjectsthenopenFilescrashes tsgo (nil ChangeIf inacquireConfigForFile) #65071 repro via standalone snapshot APIAI assistance disclosure
This PR was authored with assistance from Cursor Agent. I have read and understand the change and am prepared to discuss and revise it in review.