Skip to content

fix: show archiving status for worktrees being removed#348

Open
AndresGonzalez5 wants to merge 1 commit intoalltuner:mainfrom
AndresGonzalez5:fix/archiving-status-indicator
Open

fix: show archiving status for worktrees being removed#348
AndresGonzalez5 wants to merge 1 commit intoalltuner:mainfrom
AndresGonzalez5:fix/archiving-status-indicator

Conversation

@AndresGonzalez5
Copy link
Copy Markdown

Summary

  • When a workstream is archived, 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<String> on WorkstreamArchiver and displays a spinner with "Archiving..." badge, disabling interaction until the removal completes.
  • Also excludes archiving worktrees from the prunable count so they can't be accidentally pruned mid-removal.
  • Includes localized strings for all 4 locales (en, ca, es, sv).

Changes

  • WorkstreamArchiver.swift: Added archivingPaths set and archivingDidComplete notification. 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.
  • All 4 Localizable.strings: Added "Archiving..." translation.

Test plan

  • Archive a workstream and immediately navigate to the project overview
  • Verify the worktree shows a spinner with "Archiving..." instead of "Uncommitted changes"
  • Verify the worktree row is not clickable while archiving
  • Verify the worktree disappears from the list after archival completes
  • Verify prunable count does not include archiving worktrees

🤖 Generated with Claude Code

…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>
Copy link
Copy Markdown
Member

@davidpoblador davidpoblador left a comment

Choose a reason for hiding this comment

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

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.

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.

2 participants