Skip to content

fix: solve #3759 — v2 Open in Finder label uses persisted worktree path#3760

Draft
github-actions[bot] wants to merge 1 commit into
mainfrom
triage/issue-3759-24962801582
Draft

fix: solve #3759 — v2 Open in Finder label uses persisted worktree path#3760
github-actions[bot] wants to merge 1 commit into
mainfrom
triage/issue-3759-24962801582

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot commented Apr 26, 2026

Root cause

The v2 "Open in Finder" button rendered its /<name> slug from workspaces.branch. The worktree directory under ~/.superset/worktrees/<projectId>/<branchAtCreation> is fixed at create time, but workspaces.branch is rewritten whenever HEAD moves (status sync, AI rename via #3692, manual checkout). For stacked-PR navigation the displayed label drifted to a directory that doesn't exist on disk.

The Finder action target (openInApp.mutate({ path: worktreePath, ... })) was already correct — it uses the persisted worktreePath from the host-service workspace row. Only the visible label was wrong.

Fix

Derive the displayed slug from worktreePath + projectId. The new getV2WorktreeDisplayName(worktreePath, projectId) util returns the substring after worktrees/<projectId>/, which matches the branch-at-creation directory name (preserving slashes for nested branches like andrew/foo). It falls back to the basename if the marker isn't found.

V2OpenInMenuButton now consumes this util and no longer takes a branch prop. V2WorkspaceOpenInButton stops selecting workspaces.branch from the live query.

Tests

getV2WorktreeDisplayName.test.ts covers:

  • Standard v2 path → returns directory name
  • Nested slashed branches (feat/users/list) preserved
  • The drift scenario from the issue: branch becomes andrew/foo-2 after stack navigation but the persisted path still points at andrew/foo — display must reflect the path, not the branch
  • Fallback to basename when marker is absent
  • Windows separators in the fallback
6 pass / 0 fail

bun run typecheck for apps/desktop is clean.

Closes #3759


Summary by cubic

Fixes the v2 “Open in Finder” label to always show the persisted worktree directory instead of the live branch, preventing drift when HEAD changes. The action target was already correct; this aligns the visible label with the on-disk path.

  • Bug Fixes

Written for commit 29900c1. Summary will update on new commits.

Derive the displayed `/<name>` slug in `V2OpenInMenuButton` from the
persisted `worktreePath` instead of the live `workspaces.branch`. The
worktree directory is fixed at create time but `branch` drifts as HEAD
moves (status sync, AI rename, manual checkout), so the label could
point at a directory that no longer exists.
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.

[bug] "Open in Finder" path displays branch name instead of worktree directory

0 participants