fix: show archiving status for worktrees being removed#348
Open
AndresGonzalez5 wants to merge 1 commit intoalltuner:mainfrom
Open
fix: show archiving status for worktrees being removed#348AndresGonzalez5 wants to merge 1 commit intoalltuner:mainfrom
AndresGonzalez5 wants to merge 1 commit intoalltuner:mainfrom
Conversation
…ommitted changes When archiving a workstream, the git worktree removal runs in a background task. If the user navigates to the project overview before it finishes, the worktree appeared with a misleading "Uncommitted changes" badge and was clickable (showing empty files). Now tracks archiving paths in a shared set and displays a spinner with "Archiving..." badge, disabling interaction until the removal completes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Member
davidpoblador
left a comment
There was a problem hiding this comment.
A few things I noticed:
Path standardization is repeated 4 times
URL(fileURLWithPath: path).standardizedFileURL.path shows up in the archiver and 3 times in the view. If the normalization ever needs to change, that's 4 places to update. A small helper or storing the standardized path on WorktreeInfo would reduce the surface area.
Background task needs a defer for cleanup
If removeWorktree throws or hangs, archivingPaths never gets cleaned up and the UI shows "Archiving..." forever with no way out. That's arguably worse than the original bug. Wrapping the cleanup in a defer would fix this:
Task.detached {
defer {
await MainActor.run {
archivingPaths.remove(standardizedPath)
NotificationCenter.default.post(name: archivingDidComplete, object: nil)
}
}
ScriptConfig.runTeardown(in: worktreePath, projectDirectory: projectDir)
GitOperations.removeWorktree(projectPath: projectDir, worktreePath: worktreePath)
if let tmuxPath {
TmuxSession.killWorkstreamSessions(tmuxPath: tmuxPath, project: projName, workstream: wsName)
}
}Minor: breadcrumb comment
// No action button while archiving + EmptyView() — the condition already makes it clear, the comment is redundant.
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.
Summary
Set<String>onWorkstreamArchiverand displays a spinner with "Archiving..." badge, disabling interaction until the removal completes.Changes
WorkstreamArchiver.swift: AddedarchivingPathsset andarchivingDidCompletenotification. Tracks path on purge start, removes on completion.ProjectOverviewView.swift: Checks archiving state per worktree row, shows spinner badge, disables adopt button, refreshes on completion notification, excludes from prunable count.Localizable.strings: Added "Archiving..." translation.Test plan
🤖 Generated with Claude Code