Skip to content

(projects): offer to remove linked worktree folders when deleting a project (#474) - #1105

Merged
devsuitup merged 9 commits into
mainfrom
wt/474-e
Nov 13, 2026
Merged

devsuitup merged 9 commits into
mainfrom
wt/474-e

Conversation

@devsuitup

@devsuitup devsuitup commented Nov 12, 2026 •

Copy link
Copy Markdown
Owner

Part of #474, slice E (Q3, maintainer decision 2026-11-10): the project-delete dialog also offers removing linked worktree folders from disk, each previewed and selected individually, unchecked by default. The main checkout and the project folder are never removable.

Behaviour

  • Inventory. Linked worktrees are listed with git worktree list --porcelain (newline format, works on Git before 2.36), parsed by the shared (worktrees): the delete dialog names the folder and forces only what it showed #841 parser. If the inventory fails, the dialog says why.
  • Preview budget. The inventory takes a bounded share of (projects): make project deletion work end to end on Windows (#1103) #1104's single 20 s preview deadline. Selected rows are inspected first with the remaining budget (minus a margin); rows not inspected in time are shown as "not inspected", cannot be removed, and never make the metadata deletion fail. Only selected rows feed the plan fingerprint.
  • Safety. A row is refused when it is dirty or untracked content changed since the preview, a live or uncertain session or schedule run is in it, a directory link (including a node_modules junction) is inside it, or it is remote. An active session or schedule run whose folder is unknown blocks every selected folder. Activity and the check right before each git worktree remove read an isolated, per-preview process table; a stale or missing table is "unknown", never absence. Holds stop launches into the selected folders for the whole operation.
  • Execution. Folders are removed before the metadata, one at a time, stopping at the first failure. Results separate removed, failed (git was run), refused (nothing attempted) and remaining; a refusal never makes the operation "partial". The renderer follows a pending operation up to a ceiling that grows with the number of selected folders.

Evidence

  • Unit and real-Git tests (project-delete-worktrees*, dom-project-delete, project-delete-main, project-delete-plan, worktree-delete*), real-Git passing on Git 2.24.
  • Live: the project deletion flow (open, cancel, reopen, confirm, reload) passes 5/5 consecutive runs in an isolated instance after the v0.0.106 merge. Worktree removal itself is covered by real-Git tests, not by a live run.
  • Independent review loop converged (no open finding).

Not covered here: sibling worktrees of a whole repository are offered when the project is a subfolder of it (accepted).

…474)

Git before 2.36 has no 'worktree list -z', so the dialog showed no worktree rows on older Git. Scan activity once per preview, fingerprint only selected rows, keep refusals apart from partial failures, and tidy the row labels.
…474)

The inventory takes a bounded share of the preview budget and marks late rows not inspected; a record that cannot be tied to a folder is shown once instead of marking every worktree uncertain.
…ive them the full budget (#474)

An active tab, PTY or live CLI session with no known folder blocks every selected worktree again; dormant history only reports. Selected rows are inspected first with the remaining planner budget, and a failed inspection points to the dedicated Delete worktree action.
# Conflicts:
#	public/sidebar.js
#	src/main/projects/project-delete-main.js
#	src/main/projects/project-delete-plan.js
#	src/main/projects/project-delete.js
#	test/dom-project-delete.test.js
…le and follow worktree removal to the end (#474)

The worktree activity read and the check before each removal use an isolated, per-preview process table instead of the shared cache, so a session started moments earlier cannot pass for stopped. The renderer's follow-up ceiling grows with the number of selected worktree folders.
…ds with main (#474)

Each preflight and final per-folder check aborts its own process reads when it ends. Main and the renderer now share the worktree status, removal and directory-scan bounds, and the follow-up ceiling counts the scan and the post-failure inspection.
@devsuitup
devsuitup marked this pull request as ready for review November 13, 2026 15:17
@devsuitup
devsuitup merged commit 393bec7 into main Nov 13, 2026
11 of 12 checks passed
@devsuitup
devsuitup deleted the wt/474-e branch November 13, 2026 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant