Skip to content

fix(dashboard): show a Windows gateway path's file name at every basename site - #17512

Merged
chenmingwei23 merged 1 commit into
mainfrom
fix/windows-basename-helper-14581
Oct 7, 2026
Merged

chenmingwei23 merged 1 commit into
mainfrom
fix/windows-basename-helper-14581

Conversation

@buluoray

@buluoray buluoray commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: On a Windows gateway, every dashboard surface that shows a file's name shows report.md, not the whole C:\Users\…\report.md path.

The sites listed on #14581 derived a file name with a /-only split (.split('/').pop(), lastIndexOf('/')). A Windows gateway reports native paths, so on Windows each of these surfaces showed the entire path where a file name belongs: the prose diff chip and diff header, composer attachment chips, the tool-call file chip, side-panel tab titles, the Files/Folder panel headers, the image viewer's alt text, the file-explorer app's names, and the name MarkdownPanel sends when adding a file to knowledge or artifacts.

Why it matters

Windows users see unreadable, truncated chips and tab titles (C:\Users\dev\repo\src\s…) on every file-related surface, and artifacts/knowledge sources created from a file get the full path as their name.

Not a goal

What changed (motivation → approach → change)

Symptom: a full Windows path where a file name belongs. Cause: each site split on / only. Splitting on \ everywhere would be wrong too, because a backslash is a legal POSIX file-name character (/tmp/we\ird.md is one name).

New dependency-free module website/src/utils/pathBasename.ts (no react-markdown import), using the rule breadcrumbSegments already uses: \ is a separator only when the path itself is Windows-shaped (drive-rooted C:\/C:/, or backslash UNC \\host\).

  • pathBasename(p): text after the last separator. For a non-Windows path it equals p.split('/').pop().
  • stripTrailingSeparators(p): for a non-Windows path it equals p.replace(/\/+$/, '').

UNC is included because this is display-only and decides nothing about which paths are read. The module comment and website/docs/frontend-conventions.md both say so.

Per-site verdicts for #14581's list (re-located on current main):

Site Verdict
components/MarkdownPanel.tsx (knowledge name, artifact name ×2, header fileName) fixed
components/FileRenderers.tsx ImageViewer alt fixed
ChatInput.tsx :857/:894 → now components/chat-input/FilePreviewStrip.tsx (aria-label + chip) fixed
pages/chat/ToolCallLine.tsx file chip basename fixed (also the diff chip chipView.path in the same file)
components/FoldableDiffBlock.tsx chip fixed
components/DiffBlock.tsx private basename fixed
pages/chat/FilesHomePanel.tsx private basename fixed
pages/chat/FolderPanel.tsx private basename fixed
apps/file-explorer/utils.ts basename fixed
hooks/usePanelTabs.ts private basename fixed
components/FileChangeChips.tsx already covered on main (normalizeWindowsPath)
apps/mochi/panel/composerDrop.ts left for #10952
Existing either-separator copies (pathReferences.basenameOf, VectorMemoryCard, FolderPanel dual lastIndexOf) unchanged: they already show Windows names correctly

Backwards compatibility

Compatible: for every non-Windows-shaped path the helpers return exactly what the replaced expressions returned. The test suite pins this with pathBasename(p) === p.split('/').pop() and stripTrailingSeparators(p) === p.replace(/\/+$/, '') over POSIX inputs that include backslashes.

Removes nothing: only display-name derivation changes. No key, export, or record is removed or renamed (file-explorer/utils.ts keeps exporting basename).

Tests

  • website/src/test/pathBasename.test.ts (49 cases): Windows backslash, forward-slash drive, mixed separators, UNC (both spellings), trailing separators, POSIX names containing \, relative paths, and the POSIX-equivalence properties above.
  • website/src/test/windowsBasenameSites.test.tsx (29 cases): mounts the real FoldableDiffBlock chip, FilePreviewStrip chip and image label, ImageViewer alt, usePanelTabs tab titles and file-explorer basename with Windows, UNC and POSIX paths. It also includes a source scan pinning each listed file against the /-only shapes returning.
  • Red on base: running the site test unchanged on origin/main gives 19 failures (every Windows case plus the source scan) and all POSIX cases passing.
  • Mutations: making backslashIsSeparator always false reddens 22 cases, including every Windows site case. Making it always true reddens 19, including every POSIX-backslash site case. Both were restored and verified.

Local gates run: tsc --noEmit, eslint on the touched files, i18n:check, scripts/docs-lint.sh, check_brand_name.py, check_comment_history.py.

Manual verification

This host is Linux, so there was no live Windows gateway. Instead, the real SPA (Vite dev server, /api/** and the websocket stubbed) rendered an assistant message with two prose diff fences: one whose headers carry a native Windows path (as a Windows gateway's difflib emits them) and one POSIX control. This ran on origin/main and on this branch. CI's Windows lanes are the live proof.

Screenshots / video

Before (origin/main): the Windows fence's chip and diff header show the whole C:\Users\dev\repo\src\kiro_crew\state.py.

before

After (this branch): both show state.py. The POSIX control is identical in both.

after

Related Issues

Closes #14581

Related: #10952 (Mochi drop site), #8012 (origin of this follow-up).

Pattern harvest

Rule candidate: lint
Pattern: deriving a displayed file name from a gateway path with .split('/').pop() / lastIndexOf('/') instead of pathBasename. A lint rule can be added once the remaining non-path uses are waived or migrated.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributions are accepted under the project's Apache-2.0 license.

@buluoray
buluoray requested a review from a team as a code owner October 6, 2026 20:01
@buluoray
buluoray requested a review from chenmingwei23 October 6, 2026 20:01
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 6, 2026
@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of f854b7556bf88d10c3d002b2f66a26616194f3ef — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Check that fileTokens.ts should take its WIN_PRODUCER_PATH_RE from pathBasename.ts. That module calls itself "display-only", yet send-payload normalization now depends on its regex.

[DESIGN-REVIEWED] f854b75

Description read

[DESCRIPTION-READ] 8ee27c5d858ff7c88b9b50476436ce9cca929a41560c811b9f7cb70c33a3e3ef

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of f854b7556bf88d10c3d002b2f66a26616194f3ef — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: PASS

Check before merge: knowledge sources and artifacts created from a Windows file will now be named by the file name. Ones already created keep their full-path names.

Not justified as shipped

  • Item 5 — undeclared: the description never says that fileTokens.ts's WIN_PRODUCER_PATH_RE is now an alias of the new WINDOWS_SHAPED_PATH_RE. It only merges one regex definition and changes no behaviour.

What this change ships

Inventory (7 items) — 6 justified

Intent: Windows users want to see a file's name, not its whole C:\… path, on every dashboard file surface (#14581). This is a FIX.

  1. Diff chips and diff headers show state.py, not the whole Windows path — justified
  2. Composer attachment chips and image preview labels show the file name — justified
  3. Tool-call file and diff chips, side-panel tab titles, and Files/Folder panel headers show the file name — justified
  4. Knowledge sources and artifacts created from a Windows file are named by the file name — justified
  5. The attachment-path regex in fileTokens now reuses the shared Windows-shape regex — undeclared
  6. File-explorer breadcrumbs stay exactly as before, through the new crumbLabel (its one consumer is PathBar.tsx) — justified
  7. The frontend conventions doc says to use pathBasename when showing a file's name — justified

[FIRST-PRINCIPLES-REVIEWED] f854b75

Description read

[DESCRIPTION-READ] 0f013e328834e7e47f936289fbe8a5b0faa28ddda4d2e049cee2398b731b8e52

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed f854b7556bf88d10c3d002b2f66a26616194f3ef — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] f854b75

Verdict parsed from the review's SHA-scoped output markers for commit f854b7556bf88d10c3d002b2f66a26616194f3ef.

False positive or not applicable? A repository writer can comment:
/ai-review override fable f854b7556bf88d10c3d002b2f66a26616194f3ef: <one-sentence reason>

@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of f854b7556bf88d10c3d002b2f66a26616194f3ef — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

UX-Verdict: PASS

Check the other Windows surfaces before merge: composer chips, side-panel tab titles and Files/Folder headers aren't in the screenshots, which show only the diff chip.

[UX-REVIEWED] f854b75

Description read

[DESCRIPTION-READ] 8c3364e1f97a8be59ccc9e6af6cc132be08aa1c2f704d252557d986e5f447712

That sha256 names everything this verdict read: the PR description, plus the 5 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of f854b7556bf88d10c3d002b2f66a26616194f3ef and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] f854b75

False positive or not applicable? A repository writer can comment:
/ai-review override gpt f854b7556bf88d10c3d002b2f66a26616194f3ef: <one-sentence reason>

@buluoray
buluoray force-pushed the fix/windows-basename-helper-14581 branch from 4900ebe to 9199dbe Compare October 6, 2026 22:45
@buluoray

buluoray commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

Review dispositions for head 9199dbe51f (findings were raised on 4900ebefc4):

  • Opus 5.5 finding (PathBar collapses a Windows root to its last folder): agreed, fixed. Confirmed in source: parentChain('C:\Users\u\repo') returned ['/', 'C:\Users\u\repo'], and the now separator-aware basename showed that segment as repo. Changes: parentChain now climbs to a drive or share root (C:\, \\host\share\) and splits on \ for Windows-shaped paths. PathBar labels the root crumb with the root itself (C:) instead of a hard-coded /. POSIX chains are unchanged, including /tmp/we\ird. Seven parentChain cases were added to windowsBasenameSites.test.tsx; stubbing out the Windows branch reddens 5 of them. dirname (the explorer's "up" button) still splits on / only and is left out of scope: it is navigation, not a name-display site.
  • First Principles CONCERNS (duplicate Windows-shape regex): agreed, fixed. pathBasename.ts now exports WINDOWS_SHAPED_PATH_RE, and fileTokens.ts imports it for WIN_PRODUCER_PATH_RE instead of keeping its own identical literal. The direction is fileTokens → pathBasename, so pathBasename stays import-free. A test pins that fileTokens.ts no longer contains the literal. isWindowsShapedPath keeps its wider forward-UNC arm. That arm differs on purpose and is documented in fileTokens.
  • Design suggestion (browsePath.isWindowsPath): checked, declined. That predicate classifies path-bar input while it is being typed (C: with no separator, a bare \\), so it has to accept prefixes. The display rule here must not accept them: C: alone is not split. The two rules answer different questions, and merging them would change what the browse input accepts.
  • UX note (no live Windows check of the composer chips, tab titles and panel headers): acknowledged. This host is Linux. Those sites are covered by mounted unit tests with Windows, UNC and POSIX paths, and CI's Windows lanes are the live run.
  • GPT 6.1: no findings.

Tests run on the rebased head, by path: npx vitest run src/test/windowsBasenameSites.test.tsx src/test/pathBasename.test.ts → 86 passed. tsc --noEmit and check_comment_history.py are clean.

Note: the PR description still reads as written for 4900ebefc4. The per-site table has no parentChain/PathBar row, the site-test count is now 37 instead of 29, and fileTokens now imports the regex. This comment is the current account of those changes.

@buluoray
buluoray force-pushed the fix/windows-basename-helper-14581 branch from 9199dbe to f854b75 Compare October 7, 2026 00:56
@buluoray

buluoray commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

Review dispositions for head f854b7556b (findings were raised on 9199dbe51f):

  • UX Review BLOCK (no screenshot of the Windows breadcrumb) / First Principles CONCERNS item 6 / Design CONCERNS "navigation change not described": agreed, resolved by subtraction. The parentChain Windows branch, WIN_ROOT_RE and the PathBar root-crumb hunk are removed, so breadcrumb navigation is byte-for-byte main's behaviour again and there is no new breadcrumb UI to screenshot. To keep the earlier Opus regression closed (a Windows root crumb collapsing to repo once basename became separator-aware), PathBar now labels crumbs with a new crumbLabel that splits on / only, as the /-split chain was always labelled on main. Tests pin parentChain('C:\\Users\\u\\repo') to main's ['/', 'C:\\Users\\u\\repo'] and crumbLabel of that root to the whole path. Pointing PathBar back at basename, or crumbLabel at pathBasename, each reddens a test. Windows breadcrumb navigation is left to its own change.
  • Design CONCERNS "send-path regex now lives in a display-only module" / First Principles item 7: acknowledged, kept. normalizeWindowsPath decides only how a path that is already Windows-shaped gets its separators normalised. The shared regex is the shape definition, and a test in windowsBasenameSites.test.tsx already ties isWindowsShapedPath to WINDOWS_SHAPED_PATH_RE, so a change to the shape shows up as a test diff in both places. That coupling is intentional: First Principles asked on the previous head for one definition instead of two copies.
  • UX Watch "two pills now look identical" (state.py Windows vs POSIX in shot-02): acknowledged, not a defect. The screenshot fixture deliberately uses the same file name in two path styles to show they now render the same way. In a real turn, the full path is still in the chip's tooltip and in the diff header it opens. Disambiguating same-named files across folders is a separate design question this PR does not raise.
  • Opus 5.5 / GPT 6.1: no findings on 9199dbe51f.

Not run locally: CI's Windows lanes. Run locally on f854b7556b: the two changed test files plus fileExplorer.test.tsx (127 passed), tsc --noEmit, and eslint on the touched files.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 7, 2026
@chenmingwei23
chenmingwei23 merged commit d7c7c03 into main Oct 7, 2026
101 checks passed
@chenmingwei23
chenmingwei23 deleted the fix/windows-basename-helper-14581 branch October 7, 2026 04:14
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 7, 2026
chenmingwei23 pushed a commit to chenmingwei23/KiroCrew that referenced this pull request Oct 7, 2026
… labels (kirodotdev#13829)

Composer preview tiles rendered only the basename, so two staged files named
`report.txt` from different directories were indistinguishable on screen. The
full path lived only in `title` (pointer hover) and the group `aria-label`
(screen reader), serving neither a sighted keyboard-only user nor a pointer
user glancing at the row.

Render each tile's visible label with `buildFileLabels` -- the shared rule the
folder chips in this same component already use -- which is basename-first and
widens by parent segments only until unique among the staged tiles. Image
chips, which showed no text at all, gain a visible truncated caption under the
thumbnail. One map is computed over all files so images and non-images widen
against each other. The full path stays in `title`/`aria-label`.

Windows-aware: `\` is normalized to `/` for the label only when it is actually
a separator (drive-rooted / UNC), reusing `backslashIsSeparator`, so a POSIX
file name containing a literal `\` is not split -- preserving the kirodotdev#17512
Windows-basename invariants.
chenmingwei23 pushed a commit to chenmingwei23/KiroCrew that referenced this pull request Oct 7, 2026
… labels (kirodotdev#13829)

Composer preview tiles rendered only the basename, so two staged files named
`report.txt` from different directories were indistinguishable on screen. The
full path lived only in `title` (pointer hover) and the group `aria-label`
(screen reader), serving neither a sighted keyboard-only user nor a pointer
user glancing at the row.

Render each tile's visible label with `buildFileLabels` -- the shared rule the
folder chips in this same component already use -- which is basename-first and
widens by parent segments only until unique among the staged tiles. Non-image
file chips show the widened label. Image chips, which showed no text at all,
gain a visible truncated caption under the thumbnail ONLY when their name
collides with another staged file, so a lone pasted screenshot stays
caption-free. One label map spans all files so images and non-images widen
against each other. The full path stays in `title`/`aria-label`.

Windows-aware: `\` is normalized to `/` for the label only when it is actually
a separator (drive-rooted / UNC), reusing `backslashIsSeparator`, so a POSIX
file name containing a literal `\` is not split -- preserving the kirodotdev#17512
Windows-basename invariants.
iamwhatever pushed a commit that referenced this pull request Oct 7, 2026
… labels (#13829) (#17403)

* fix(dashboard): disambiguate same-basename composer tiles by widening labels (#13829)

Composer preview tiles rendered only the basename, so two staged files named
`report.txt` from different directories were indistinguishable on screen. The
full path lived only in `title` (pointer hover) and the group `aria-label`
(screen reader), serving neither a sighted keyboard-only user nor a pointer
user glancing at the row.

Render each tile's visible label with `buildFileLabels` -- the shared rule the
folder chips in this same component already use -- which is basename-first and
widens by parent segments only until unique among the staged tiles. Non-image
file chips show the widened label. Image chips, which showed no text at all,
gain a visible truncated caption under the thumbnail ONLY when their name
collides with another staged file, so a lone pasted screenshot stays
caption-free. One label map spans all files so images and non-images widen
against each other. The full path stays in `title`/`aria-label`.

Windows-aware: `\` is normalized to `/` for the label only when it is actually
a separator (drive-rooted / UNC), reusing `backslashIsSeparator`, so a POSIX
file name containing a literal `\` is not split -- preserving the #17512
Windows-basename invariants.

* evidence: screenshots for #13829 under temp-screenshots/

Dark + light renders of two same-basename images and two same-basename files
showing distinct widened labels at rest. Committed under temp-screenshots/
(the path the AI-review evidence gate reads at the head SHA); the one-off
capture harness is kept out of the product tree.

---------

Co-authored-by: kirocrew-agent <agent@kirocrew.local>
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.

Windows gateway paths: shared separator-aware basename helper for the remaining POSIX-only sites

2 participants