Repository navigation
feat(chat): read tool-file labels from the pane's folder - #1837
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Path root and label formatting src/lib/workspacePath.ts, src/lib/workspacePath.test.ts, DESIGN.md, changelog.d/chat-relative-tool-paths.md |
Added helpers to derive a POSIX pane root and format eligible paths relative to it. Tests cover roots and path cases. Documentation describes the display and raw-path behavior. |
Tool-file rendering and pane integration src/components/ChatView.tsx, src/components/PaneTerminal.tsx, src/components/ChatView.css |
ChatView receives the pane working directory and provides its derived root to tool-file rendering. Tool-file titles and opening continue to use the raw path. Coarse-pointer links receive a minimum touch target. |
Clipboard path preservation src/lib/markdownClipboard.ts |
Fully selected shortened labels temporarily expand to their raw paths while generating the selection payload. The label text is restored afterward. |
Browser regression coverage scripts/chat-tool-paths-demo-regression.ts, scripts/ci-browser.sh |
Added browser checks for labels, opening, copying, pane and machine switching, touch targets, and viewer states. The sequential browser CI lane runs the new script. |
Priority:
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Feature
Possibly related issues
- Issue 1606 in
devswha/herdr-web-uirequests relative tool-card file labels with full paths retained in tooltips and paths outside the pane folder left unchanged. This PR implements those objectives.
Suggested reviewers: yoonwoo-ha, demrom
Merge Risk: 
Minimal · up to d1f86
-
No concrete issue remains that should block merging.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Title check
-
Explanation
The title "feat(chat): read tool-file labels from the pane's folder" names the main change: chat tool-file labels are now shortened relative to the pane's folder. It matches the changeset, which adds toolPathRoot/toolPathLabel, passes cwd to ChatView, and changes ToolFile rendering. It is specific and follows a conventional commit style.
Full details: Description check
-
Explanation
The description follows the template. It has a Change section that describes the problem and resulting behavior, and it links no issue. The description states the feature's motivation but does not link a maintainer-agreed issue, which the template asks for on features. The Validation section lists the commands run and their results, including the browser regression and check fast. The description also covers the known follow-up on rich-text copy. The missing issue link is a minor gap, so the description is mostly complete.
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 24 functions across 7 files. (3 skipped: 3 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches: 💡 1
-
📝 Generate docstrings: 💡
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
|
Merge pass review-work for 51c9d1e: REVIEW FAILED on one outside-the-folder case. Blocker: a tool path with The cause is Please keep a path containing a Checked and passing:
Non-blocking:
|
|
Fixed the blocker from the merge-pass review in
|
cac4e35 to
bbb2c0a
Compare
|
Rebased onto current origin/main ( |
… a pinned count (#1874) ## What `scripts/ci-browser.test.ts` pinned the number of browser scripts (`toHaveLength(83)`), a list of `toContain` lines and the last script. So every PR that adds a browser script edited the same lines, and parallel PRs conflicted on them just for that (#1831, #1837, #1849 and #1852 needed rebases for it). This PR removes those pins and checks the same things against the files on disk: - The serial lane's summary must equal `scripts/demo-build.ts` followed by the list parsed from `scripts/ci-browser.sh` (`serialBrowserScripts()`), in order. This checks more than the old count did. - The lane must not repeat a script or name one that does not exist. - Every `scripts/*-regression.ts` and `scripts/*-browser-qa.ts` must be run by the lane in one of three ways: it has its own `run_script` line; it is imported by a script the lane runs (transitively, e.g. through `ui-regression.ts` or `ui-contexts-checks.ts`); or it is spawned by one (`join(import.meta.dir, "x.ts")`). Spawns are followed only from files that run as scripts, not from imported helpers, because those spawns sit under `import.meta.main`. A script CI does not run has to be named in a new `MANUAL_BROWSER_SCRIPTS` list. Today that list holds 13 scripts that are run by hand (Android emulator, SSH fixture, native Windows, update QA, ...). - The manual list must only name scripts that exist and that CI does not reach, so it cannot go stale. A PR that adds a browser script now adds only its `run_script` line in `scripts/ci-browser.sh` (or a line in the manual list), so two such PRs no longer touch the same line. `docs/development.md` describes the check. Test-only change: CI behaviour is unchanged. ## Verification - `bun test scripts/ci-browser.test.ts`: 7 pass. - Mutation checks, each restored afterwards: - Deleting the `run_script scripts/workspace-rows-regression.ts` line fails "runs every browser script on disk ..." and lists that script as unassigned. - Adding `run_script scripts/does-not-exist-regression.ts` fails "runs each script once, and only scripts that exist". - Adding an untracked `scripts/brand-new-regression.ts` fails the assignment check. - The restored tree passes. - `bun run check fast`: green (typecheck, build, 6396 unit tests). - Reviewed by a code-review agent. Its one HIGH finding (a spawn inside an imported helper's `import.meta.main` block was being counted as run by CI, hiding `keyboard-viewport-demo-regression.ts`) is fixed in this commit. --------- Co-authored-by: mp <mp@local>
|
Merge pass: one rebase needed. #1874 is merged on main. |
bbb2c0a to
521b76c
Compare
|
Rebased onto main after #1874 and pushed 521b76c (was bbb2c0a). I dropped this PR's change to |
A tool card's file labels (an edit's or a read's file, each file of a patch, a multi-edit, a sent file) now read from the pane's folder the way the file browser does: in a pane on /work/app, /work/app/src/a.ts reads app/src/a.ts. PaneTerminal passes its already-known cwd to ChatView as an optional presentation prop; a chat-local context hands it to ToolFile, which reuses workspaceRelativePath. Only an absolute POSIX folder counts (trailing slashes trimmed, never "/"); no folder, a Windows drive or UNC folder, or a path outside the folder, in a sibling (/work/app-2) or relative leaves the label as written. The button's title, the path the viewer opens, the transcript and every copy keep the path as written. No server, wire or transcript change. Checked with new workspacePath unit cases and a new browser regression, scripts/chat-tool-paths-demo-regression.ts (enrolled in the browser lane), which drives the demo build: short labels, whole-path titles, the viewer's exact request, raw MD/TXT copies, raw fallbacks for sibling, outside, relative, Windows, UNC, Unicode and 300-character paths, pane switches, and a bare ChatView with nothing to open files in (text, whole-path title, no button) moved between PCs.
The phone viewer minimizes on Escape instead of closing, so the capture run left the first file's viewer docked under the next one: close it with its Close file button. A work block folds by itself when its turn settles, which can land between reading its state and clicking it: click once to make it the reader's choice, which the block keeps, and again if that folded it. Ran the regression three times in a row, each passing.
The phone viewer slides in and out, so a capture taken right after it opened or closed caught it mid-way. Wait for every running, finite animation to finish before each screenshot; checks are unchanged.
At 1440 the pointer stayed where the last expanding click left it, so a rest, focus or viewer capture showed a row's hover plate. Park it on empty page before every capture except hover and pressed.
A copy that takes a whole tool-file label now copies the path as written (data-raw-path, swapped into the label's text for the copy alone), so a shortened label never changes what the clipboard gets; a part of a label still copies that part. On a coarse pointer the file link grows to --touch-target both ways. The regression holds the demo's 4500 ms turn timer so the folder-less pane cannot finish its turn mid-check, holds a file's content to show the viewer's loading state at both widths before releasing it, copies the real labels in both forms, and measures every phone file link at 44x44 or more without overlap.
…s in the tool-path regression
521b76c to
d1f8614
Compare
|
Rebased onto main after #1831, #1890, #1895 and #1897, and pushed d1f8614 (was 521b76c). The two conflicts were additive and both sides are kept. In |
|
Merge pass review-work report. Overall: PASSED.
Manual QA:
Code review: four mutants are each caught:
Trailing slashes and Round 1 finding, fixed in cac4e35:
MINOR follow-ups:
All required checks are green and no review thread is open.
|
…//server folder's paths as written (#1606) (#2195) ## What it does for the user Closes the two gaps #1606 left open after #1837 (chat tool-card file labels read from the pane's folder): - **Select All, or any selection that reaches past the chat, copies the whole paths.** Before, a copy that started outside the chat (Select All from the page, a drag from a card out past the chat) was the browser's own copy and took the short labels (`app/src/b.ts`). Now such a copy carries the paths as written (`/work/app/src/b.ts`) whenever it takes a shown, shortened label whole. A selection past the chat that takes no shortened label stays the browser's own copy. - **A UNC folder written with forward slashes reads paths as written.** A pane on `//server/share/app` was treated as a POSIX folder, so its paths were shortened. It now reads like `\\server\share\app` already did: every path as written. ## How - `toolPathRoot` refuses a `//` start (`src/lib/workspacePath.ts`). - The chat's copy listener sits on the document: Chrome dispatches `copy` where the selection starts, so a Select All never reached the chat scroller. A copy from a field (the composer, a copy button's hidden textarea, xterm's textarea) stays native. - For a selection that reaches past the chat, `chatSelectionClipboardPayload` grows each **visible** shortened label the selection takes whole, and puts the browser's own `selection.toString()` on the clipboard as **plain text only**. It rebuilds no HTML from the page, so a composer's unsent draft, a hidden chat under a terminal peek, or folded sidebar lists cannot leak into a rich copy. A selection wholly inside the chat works as before (plain text + rebuilt HTML). Each chat on the page has its own document listener, so a chat declines a selection that has no part in it: with two chats mounted (split halves, herdr splits, a chat kept under a terminal peek), a copy wholly inside one is that chat's own, rich HTML included, whichever listener runs first. Follows T3 Code's workspace-relative paths, as #1837 did; the copy keeps the raw path the way its file labels do. ## How it was verified - `bun test src/lib/workspacePath.test.ts`: new `//server/share/app` cases fail on main (`toolPathRoot` returned the string) and pass here. - `scripts/chat-tool-paths-demo-regression.ts` (real Chromium, demo build, in the browser CI lane), new checks for both forms (link and bare label): - Select All and a drag from the first card past the chat copy every raw path, no `app/…` line, and no rebuilt HTML; - a selection past the chat with no shortened label is not claimed (native copy); - a bare chat on `//server/share/app` and a `//server/share/app/fwd.ts` card read as written; - with a second chat mounted, a copy wholly inside either chat keeps its raw paths and its rich HTML (fails on e3d095e: `the second chat: the copy keeps the chat's rich HTML: ""`). On main's code, the copy half fails (`the link, Select All: the copy keeps /work/app/src/b.ts`, clipboard held `app/src/b.ts`) and the UNC half fails (`machine unc`); both pass here. - `scripts/chat-selection-copy-regression.ts` and `scripts/replay-clipboard-demo-regression.ts` pass. - `bun run check fast` passes. - Reviews: omo-native-code-reviewer (APPROVE, no HIGH; its MEDIUM about hidden content in the rebuilt HTML is the plain-text-only change above) and Codex Sol 6.1 Fast xhigh (first round: one HIGH, a composer draft entering the rebuilt HTML, and two MEDIUMs, a hidden chat triggering the claim and the HTML dropping the labels; all fixed by the plain-text-only claim and the visibility check; re-review PASS). The merge pass's review of e3d095e found a MEDIUM (two mounted chats: the first-registered one took the other's copy and dropped its HTML) and a LOW (a `display:none` label counted as shown); both are fixed in the second commit. ## Left out - `[contenteditable=true]` in the field check does not match `contenteditable=""`/`plaintext-only`; nothing in `src` uses those today. - A rich (`text/html`) copy *inside* the chat still leaves a clickable tool-file label out, as on main (the follow-up #1837 named); the plain text carries the whole path. Closes #1606.
What it does for the user
A chat tool card names its files from the pane's folder, the way the file browser already does. In a pane on
/work/app, an edit to/work/app/src/a.tsreadsapp/src/a.tsinstead of the whole absolute path, so the part that matters fits on a phone.Only the label gets shorter:
Open /work/app/src/a.ts), the file the viewer opens and a copy's text keep the path as written; selecting the whole label copies/work/app/src/a.ts(data-raw-path), a part of it copies that part;/work/app-2), a relative or Windows/UNC path, or a pane with no known folder reads as written;--touch-target, so the files of a patch never share a hit area.Follows T3 Code's workspace-relative paths (
formatWorkspaceRelativePath), already credited for the file browser.Why
Absolute paths in tool cards repeat the pane's folder on every row and wrap on phones; the file browser already reads paths from the pane folder, and the chat now matches it.
How it was verified
bun test src/lib/workspacePath.test.ts(root/sibling/outside/relative/Windows/UNC cases) andscripts/ci-browser.test.tspass.scripts/chat-tool-paths-demo-regression.ts(added to the browser lane) passes on the rebased branch: labels, titles, viewer requests, whole/partial/all-cards copies, another PC's same pane id, no-folder and Windows-folder panes, 44px touch targets with no overlap at 390 px, no sideways scroll for a Unicode path and a 300-character name; 48 captures at 390 and 1440, light and dark, plus Korean.bun run check fastpasses./api/machines/eventsroster, so panes kept the demo folder after the rebase) is fixed in this branch.Known follow-up (not in this PR)
A rich-text (
text/html) copy leaves a clickable file label out entirely, as it already does on main for every tool-file button; the plain-text copy carries the whole path. The docs here say "a copy's text" for that reason.