Skip to content

Don't let append overwrite sibling results in tspath.GetCommonParents - #64493

Merged
Jake Bailey (jakebailey) merged 2 commits into
microsoft:mainfrom
auvred:common-parents-worker-backing-array
Sep 29, 2026
Merged

Jake Bailey (jakebailey) merged 2 commits into
microsoft:mainfrom
auvred:common-parents-worker-backing-array

Conversation

@auvred

@auvred auvred commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Fixes #64492

Cause: group.head is a subslice of an input path's components that still has spare capacity, so when a group has more than one sub-result, they overwrite each other in the shared backing array. One directory comes out twice (or as a nonexistent path), and another is dropped.

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

Copilot review overview

🟢 Approval recommended

The focused allocation fix addresses the reported corruption and is covered by a suitable regression test.

Review effort: Balanced
Findings: None

What changed in this PR

Fixes backing-array aliasing in GetCommonParents, preventing sibling path results from overwriting one another.

Changes:

  • Uses slices.Concat to create independent result slices.
  • Adds a nested fan-out regression test.
File Description
tsc/​internal/​tspath/​path.go Prevents result slices from sharing mutable backing storage.
tsc/​internal/​tspath/​path_test.go Verifies all nested fan-out results are retained.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread tsc/internal/tspath/path.go Outdated

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.

Copilot review overview

🟢 Approval recommended

The focused fix addresses the aliasing defect and includes direct regression coverage.

Review effort: Balanced
Findings: None

@jakebailey
Jake Bailey (jakebailey) added this pull request to the merge queue Sep 29, 2026
Merged via the queue into microsoft:main with commit 673a5f1 Sep 29, 2026
29 checks passed
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: Done

Development

Successfully merging this pull request may close these issues.

External directory from tsconfig files gets no watcher in LSP

3 participants