fix: solve #3759 — v2 Open in Finder label uses persisted worktree path#3760
Draft
github-actions[bot] wants to merge 1 commit into
Draft
fix: solve #3759 — v2 Open in Finder label uses persisted worktree path#3760github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
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.
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.
Root cause
The v2 "Open in Finder" button rendered its
/<name>slug fromworkspaces.branch. The worktree directory under~/.superset/worktrees/<projectId>/<branchAtCreation>is fixed at create time, butworkspaces.branchis 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 persistedworktreePathfrom the host-service workspace row. Only the visible label was wrong.Fix
Derive the displayed slug from
worktreePath+projectId. The newgetV2WorktreeDisplayName(worktreePath, projectId)util returns the substring afterworktrees/<projectId>/, which matches the branch-at-creation directory name (preserving slashes for nested branches likeandrew/foo). It falls back to the basename if the marker isn't found.V2OpenInMenuButtonnow consumes this util and no longer takes abranchprop.V2WorkspaceOpenInButtonstops selectingworkspaces.branchfrom the live query.Tests
getV2WorktreeDisplayName.test.tscovers:feat/users/list) preservedbranchbecomesandrew/foo-2after stack navigation but the persisted path still points atandrew/foo— display must reflect the path, not the branchbun run typecheckforapps/desktopis 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.
/<name>fromworktreePath+projectIdviagetV2WorktreeDisplayName(...).V2OpenInMenuButtonto use the util and drop thebranchprop;V2WorkspaceOpenInButtonstops selectingworkspaces.branch.apps/desktoptypecheck is clean.Written for commit 29900c1. Summary will update on new commits.