Skip to content

fix(65071): resurrect dirty.SyncMap entries after Delete in LoadOrStore - #65072

Open
Timur Vural (timurzvural) wants to merge 1 commit into
microsoft:mainfrom
timurzvural:fix/65071-loadorstore-tombstone
Open

Timur Vural (timurzvural) wants to merge 1 commit into
microsoft:mainfrom
timurzvural:fix/65071-loadorstore-tombstone

Conversation

@timurzvural

Copy link
Copy Markdown

Fixes #65071.

Bug

dirty.SyncMap.LoadOrStore returned (nil, false) when the key had a delete tombstone. Callers such as acquireConfigForFile ignore the bool and immediately call entry.ChangeIf(...), which nil-dereferences after closeProjects + openFiles (same or separate updates).

Same root cause as #65054 and #64911.

Fix

When LoadOrStore finds a tombstoned entry, resurrect it with the provided value (delete = false, dirty = true) and return (entry, false) instead of nil.

Tests

AI 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.

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>
Copilot AI balanced review requested due to automatic review settings October 31, 2026 02:04
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Oct 31, 2026
@typescript-automation typescript-automation Bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Oct 31, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

API: closeProjects then openFiles crashes tsgo (nil ChangeIf in acquireConfigForFile)

2 participants