Skip to content

fix(web): keep literal tilde folders inside the diff repository - #47610

Merged
juliusmarminge merged 3 commits into
pingdotgg:mainfrom
saphid:hunter/c-91f0c9b316
Dec 2, 2026
Merged

juliusmarminge merged 3 commits into
pingdotgg:mainfrom
saphid:hunter/c-91f0c9b316

Conversation

@saphid

@saphid saphid commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Problem

Opening ~/notes.txt from an external tracked repository's Diff can open a different file in the user's home directory. The commit dialog and Diff image previews use the same link resolver, which treats a Git filename starting with ~/ as home shorthand.

Deterministic repro on origin/main (54e81819cbe825bfa36808c783c84758890e4ca0): Track a sibling Git repository at /home/alex/repo from a thread rooted elsewhere. In the repository, commit ./~/notes.txt, then modify it. Open the thread's Diff → Uncommitted scope, select the tracked repository, and click ~/notes.txt. The Git diff header supplies that literal name; because the repository is outside the thread folder, Diff sends the resolved target through the editor-launch RPC. Observed: /home/alex/notes.txt. Expected: /home/alex/repo/~/notes.txt.

Save hunter-literal-tilde.e2e.ts from the evidence gist under scripts/scenarios/ and run vp run scenarios:prove scripts/scenarios/hunter-literal-tilde.e2e.ts --base 54e81819cbe825bfa36808c783c84758890e4ca0 --head HEAD to reproduce with an isolated Git fixture and capture the editor argument.

Change

Join literal Git paths to the appropriate repository or workspace root without interpreting link shorthand. The Diff header's external-editor action, context menu, working-tree image preview, and commit dialog's changed-file action share that join across web, hosted web, and Electron. In-panel file opening and Markdown links are unchanged.

Scope

Small fix for an obvious bug; no issue needed under CONTRIBUTING.md.

Verification

  • Both focused tests failed on base with /home/alex/notes.txt and passed with /home/alex/repo/~/notes.txt after the fix.
  • The isolated web scenario failed on base and passed with the patch, capturing the actual editor-launch argument. Transcript, scenario source, and before/after screenshots.
  • Chromium component tests reproduced the missing ~/logo.png preview and the commit dialog sending /home/alex/notes.txt. After the fix, the image preview renders and the commit dialog sends /home/alex/repo/~/notes.txt to the editor hook.
  • vp run check:changed exited 0, including 76 affected tests and four React Compiler checks.
  • Not shown: live image asset serving and commit-dialog launches (covered at the browser component boundary), context-menu launch in the browser (target covered by a unit test), hosted relay and Electron launches, or Windows/macOS editor launches. Mobile does not use these web actions.

Authored by GPT-6.2 Sol (Codex); reviewed by Gemini 4 Neon (Antigravity).

@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Dec 2, 2026
@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 4eee5d6 and e805bfc.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The change adds joinDiffFilePath and uses it to construct paths for changed-file editor actions, image previews, and file context menus. Tests cover paths that begin with a literal ~.

Changes: Diff path handling

Layer / File(s) Summary
Editor path joining
apps/web/src/diffFileActions.ts, apps/web/src/GitActionsControl.tsx, apps/web/src/diffFileActions.test.ts, apps/web/src/components/GitActionsControl.composition.browser.test.tsx
joinDiffFilePath joins a working directory and relative path using a separator selected from the working directory format. Editor actions use the helper when a working directory is available. Tests check that ~/notes.txt remains a literal path segment.
Preview and context-menu paths
apps/web/src/components/DiffPanel.tsx, apps/web/src/fileContextMenu.ts, apps/web/src/components/DiffPanel.browser.test.tsx, apps/web/src/fileContextMenu.test.ts
Image previews and file context menus use joinDiffFilePath to combine resolved paths with their working directories. Tests include paths beginning with ~.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: juliusmarminge, stienswout

Merge Risk: Minimal · previous review 4eee5

Literal ~/ folders in diffs now open at the correct repository path instead of being treated as home-directory shorthand. The change is small and tested, and no merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(web): keep literal tilde folders inside the diff repository" names the main change. The changeset joins literal Git paths to the repository or workspace root, so a tracked file named `~…
Description check Passed The description follows the template. It has Problem, Change, Scope, and Verification sections. The Problem section states the bug, expected behavior, and a deterministic reproduction on a stated base…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "fix(web): keep literal tilde folders inside the diff repository" names the main change. The changeset joins literal Git paths to the repository or workspace root, so a tracked file named ~/notes.txt no longer expands to the home directory. The title is concise, uses a conventional commit prefix, and matches the bug fix described in the objectives.

Full details: Description check

Explanation

The description follows the template. It has Problem, Change, Scope, and Verification sections. The Problem section states the bug, expected behavior, and a deterministic reproduction on a stated base commit. The Change section explains the shared path join across the affected surfaces. The Scope section states why no issue is linked, as the template asks. Verification lists focused tests, a scenario run, a full changed-check run, and untested areas. The description is thorough. One gap: the Verification section cites an external gist and a scenario path, which reviewers must open to confirm the evidence. The description also does not include before/after screenshots inline, though it links them. These gaps are minor, so the check passes.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between dff224d and 4eee5d6.

Files selected for processing: 8

  • apps/web/src/components/DiffPanel.browser.test.tsx
  • apps/web/src/components/DiffPanel.tsx
  • apps/web/src/components/GitActionsControl.composition.browser.test.tsx
  • apps/web/src/components/GitActionsControl.tsx
  • apps/web/src/diffFileActions.test.ts
  • apps/web/src/diffFileActions.ts
  • apps/web/src/fileContextMenu.test.ts
  • apps/web/src/fileContextMenu.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Dec 2, 2026
@macroscopeapp

macroscopeapp Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Would Approve

Macroscope's review found this PR approvable — Diff file actions now treat tilde-prefixed folders as literal repository paths instead of home-directory shortcuts. The change is limited to file targeting for editor actions, context menus, and image previews.

Needs human approval because:

  • Macroscope's correctness review did not reach a verdict

Notes:

  • The correctness review was unavailable. Eligibility was assessed without its result.

You can add or adjust custom eligibility rules. Learn more.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Dec 2, 2026
juliusmarminge and others added 2 commits December 2, 2026 18:26
The browser tests repeated the same join at each call site; the unit
tests for openDiffFilePrimaryAction and resolveFileContextMenuAbsolutePath
already fail on main for this bug.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@macroscopeapp
macroscopeapp Bot dismissed their stale review December 2, 2026 18:34

Dismissing prior approval to re-evaluate e805bfc

@juliusmarminge

Copy link
Copy Markdown
Member

Evidence

Environment: Linux web client, Chromium 156, 1280×800, light theme, fresh server state on each commit, Replay (dev). Projects and tracked-folder state were seeded through the real server API.

On each commit, seed fresh Git repositories with ~/notes.txt, ~/logo.png, and root control.png; commit then modify all three. Track tilde-repo from other-repo and start a Replay thread there. Open Diff → Changes, select tilde-repo, expand both images, and click ~/notes.txt. Open Thread details → Other repositories… → tilde-repo → Git action options → Commit; click Open ~/notes.txt in editor and Open control.png in editor. Record the editor shim's launch arguments.

Scenario: Git-relative tilde folders preview images inside the selected repository

Proven: the scenario fails on base b67b49ab26 and passes on head e805bfc5f1.

Base b67b49ab26 Head e805bfc5f1
Result ❌ failed
ASSERTION_FAILED: expected false to be true
✅ passed
literal tilde image preview Base b67b49ab26: literal tilde image preview Head e805bfc5f1: literal tilde image preview
literal tilde commit dialog Base b67b49ab26: literal tilde commit dialog Head e805bfc5f1: literal tilde commit dialog
failure Base b67b49ab26: failure
Additional evidence Before After
Same interaction Recording Recording
Editor launch targets Redacted output: Diff and commit both open <home>/notes.txt Redacted output: both open <repository>/~/notes.txt

The control opens <repository>/control.png on both sides. The base shows “Image unavailable · ~/logo.png”; the head renders the 64px image.

Scenario source. Editor dispatch was recorded by the runner's Cursor shim; no external editor UI was needed.

@juliusmarminge juliusmarminge added takeover:ready Takeover done; auto-lands when gates pass and removed takeover:in-progress A takeover lead is working on this PR labels Dec 2, 2026
@juliusmarminge
juliusmarminge merged commit 9b419ae into pingdotgg:main Dec 2, 2026
61 checks passed
@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Dec 2, 2026
henrychu04 added a commit to henrychu04/t3code-coder that referenced this pull request Dec 6, 2026
- Changed files outside the thread folder open by joining the path as
  upstream pingdotgg#47610 does, not through the link resolver.
- The fork's thread-branch rename and review too-large paths follow
  upstream's untrimmed path schemas (pingdotgg#47804, pingdotgg#48000).
- Restore upstream's contracts filesystem and project tests.
- coder-only.md lists the two new session-storage keys.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants