Skip to content

fix(server): a worktree a thread reached through a symlink can't be removed from under it - #917

Merged
badcuban merged 1 commit into
mainfrom
fix/worktree-removal-symlinked-path
Nov 14, 2026
Merged

badcuban merged 1 commit into
mainfrom
fix/worktree-removal-symlinked-path

Conversation

@badcuban

Copy link
Copy Markdown
Collaborator

The problem

The worktree removal guard compared the folder being removed with each thread's recorded folders by spelling. git names a worktree by its real path, and a thread can record the same folder through a symlink (a data folder under macOS's /var, which is /private/var). That thread then did not count as in the way, and its worktree could be deleted while the thread still pointed there.

Found while testing #911 on a data folder under /var.

The fix

The guard resolves the folder being removed and every thread's recorded folders through the disk before comparing them. Each distinct folder is resolved once; one that is gone keeps its spelling.

The cleanup list still classifies by spelling (it runs in the client and can't resolve paths), so it can offer such a folder. The server then refuses and names the threads.

Checked

  • New test with a real symlink: a thread recorded through the symlink blocks removing the real path, and a neighbouring folder is still free to go.
  • vp fmt, vp lint, vp run typecheck, vp run '@threadlines/server#test' WorktreeRemovalGuard.

…emoved from under it

The removal guard compared the folder being removed with each thread's
recorded folders by spelling. git names a worktree by its real path, and a
thread can record the same folder through a symlink (a data folder under
macOS's /var, which is /private/var), so that thread did not count as in the
way and its worktree could be deleted while it was still pointed there. The
guard now compares folders as the disk resolves them.

The cleanup list still classifies by spelling, so it can offer such a folder;
the server then refuses and names the threads.
@vercel

vercel Bot commented Nov 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
threadlines Skipped Skipped Nov 14, 2026 5:17pm UTC

Request Review

@badcuban
badcuban added this pull request to the merge queue Nov 14, 2026
Merged via the queue into main with commit 1f5801d Nov 14, 2026
24 checks passed
@badcuban
badcuban deleted the fix/worktree-removal-symlinked-path branch November 14, 2026 19:08

This branch was previously deployed

1 inactive deployment
Preview — 12ea9fc7 Deployed Nov 14, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant