Skip to content

Your lightweight open-source personal agent.

fix(webui): preserve file edit stats and left-truncate long paths (#6388)

chengyongruf9257c35483a
diff --git a/webui/browser/file-edit-path-fixture.tsx b/webui/browser/file-edit-path-fixture.tsx
new file mode 100644
index 000000000..0f71bf4dc
--- /dev/null
+++ b/webui/browser/file-edit-path-fixture.tsx
@@ -0,0 +1,28 @@
+import { useState } from "react";
+import { FileActionsProvider } from "@/components/FileActions";
+import { FileEditGroup, type FileEditSummary } from "@/components/thread/activity/FileEditRow";
+
+export const longEditPath = "C:/Users/HR/.nanobot-ncode/workspace/artifacts/nan284-local-file-attachments/review-fixes-20261022-133833/serve_fixture.py";
+const paths = [longEditPath, "src/verify.py", `C:/项目/带空格的目录/${"very_long_file_name_".repeat(12)}verify.py`, longEditPath.replace("serve_fixture.py", "screenshot.png")];
+export function FileEditPathFixture() {
+ const [opened, setOpened] = useState("");
+ return <FileActionsProvider value={{
+ resolveMetadata: async (path) => ({ path, relative_path: null }),
+ loadPreview: async (path) => ({
+ path, display_path: path, project_path: path, size: 68, kind: "image", mime_type: "image/png",
+ data_url: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+/l9sAAAAASUVORK5CYII=",
+ }),
+ }}><main className="p-4">
+ <section aria-label="File edits" style={{ maxWidth: 640 }}>
+ {paths.map((path, index) => {
+ const edit: FileEditSummary = {
+ key: path, path, added: index === 1 ? 33 : 12345, deleted: index === 1 ? 0 : 6789,
+ approximate: false, binary: false, status: "done", pending: false,
+ diff: { format: "unified", text: "--- a/file\n+++ b/file\n@@ -1 +1 @@\n-old\n+new\n" },
+ };
+ return <FileEditGroup key={path} edits={[edit]} displayMode="collapsed_diff" onOpenFilePreview={setOpened} />;
+ })}
+ </section>
+ <output aria-label="Opened file">{opened}</output>
+ </main></FileActionsProvider>;
+}
diff --git a/webui/browser/file-edit-path.spec.ts b/webui/browser/file-edit-path.spec.ts
new file mode 100644
index 000000000..e0d6d3142
--- /dev/null
+++ b/webui/browser/file-edit-path.spec.ts
@@ -0,0 +1,69 @@
+import { expect, test } from "@playwright/test";
+const longEditPath = "C:/Users/HR/.nanobot-ncode/workspace/artifacts/nan284-local-file-attachments/review-fixes-20261022-133833/serve_fixture.py";
+
+for (const width of [360, 1024]) {
+ test(`file edit paths preserve statistics and reveal full paths at ${width}px`, async ({ page }, testInfo) => {
+ await page.setViewportSize({ width, height: 800 });
+ await page.goto("/browser/fixture.html?case=file-edit-path");
+ const references = page.getByTestId("activity-file-reference");
+ await expect(references).toHaveCount(4);
+ for (let index = 0; index < 4; index++) {
+ const row = page.getByTestId("activity-step").nth(index);
+ const stats = row.getByTestId("activity-diff-pair");
+ await expect(stats).toHaveText(index === 1 ? "+33-0" : "+12345-6789");
+ const geometry = await row.evaluate((element) => {
+ const path = element.querySelector('[data-testid="activity-file-reference"]')!.getBoundingClientRect();
+ const stats = element.querySelector('[data-testid="activity-diff-pair"]')!.getBoundingClientRect();
+ return { pathRight: path.right, statsLeft: stats.left, statsRight: stats.right, rowRight: element.getBoundingClientRect().right };
+ });
+ expect(geometry.pathRight).toBeLessThanOrEqual(geometry.statsLeft);
+ expect(geometry.statsRight).toBeLessThanOrEqual(geometry.rowRight);
+ }
+ const longPath = references.first();
+ await expect(longPath).toContainText("…");
+ await expect(references.nth(1)).not.toContainText("…");
+ // The last filename stays inside the clipping viewport, without reversing text direction.
+ const filename = longPath.locator(".font-semibold");
+ const tail = await filename.evaluate((element) => {
+ const clip = element.parentElement!.parentElement!.getBoundingClientRect();
+ const name = element.getBoundingClientRect();
+ return { left: name.left, right: name.right, clipLeft: clip.left, clipRight: clip.right };
+ });
+ expect(tail.left).toBeGreaterThanOrEqual(tail.clipLeft - 1);
+ expect(tail.right).toBeLessThanOrEqual(tail.clipRight + 1);
+ await page.screenshot({ path: testInfo.outputPath("summary.png") });
+ await longPath.hover();
+ const hint = page.getByRole("tooltip");
+ await expect(hint).toHaveText(longEditPath);
+ const surface = page.locator('[data-radix-popper-content-wrapper] > [data-state="delayed-open"], [data-radix-popper-content-wrapper] > [data-state="instant-open"]');
+ const hintBounds = await surface.boundingBox();
+ expect(hintBounds!.x).toBeGreaterThanOrEqual(0);
+ expect(hintBounds!.x + hintBounds!.width).toBeLessThanOrEqual(width);
+ expect(await surface.evaluate((element) => element.scrollWidth <= element.clientWidth)).toBe(true);
+ await page.screenshot({ path: testInfo.outputPath("full-path-hint.png") });
+ await page.mouse.move(0, 0);
+ await longPath.focus();
+ await expect(hint).toHaveText(longEditPath);
+ await longPath.press("Enter");
+ await expect(page.getByLabel("Opened file")).toHaveText(longEditPath);
+ await expect(hint).toBeHidden();
+ await page.getByRole("button", { name: /View changes/ }).first().click();
+ await expect(page.getByTestId("file-edit-diff")).toBeVisible();
+ const imagePath = references.nth(3);
+ await expect(imagePath).toContainText("…");
+ await imagePath.hover();
+ await expect(hint).toContainText(longEditPath.replace("serve_fixture.py", "screenshot.png"));
+ await expect(surface.locator(".select-text")).toHaveText(longEditPath.replace("serve_fixture.py", "screenshot.png"));
+ await expect(page.getByTestId("file-image-quick-look")).toHaveCount(1);
+ await expect(surface.locator('[data-testid="file-image-quick-look"] img:visible')).toHaveCount(1);
+ expect(await surface.evaluate((element) => element.scrollWidth <= element.clientWidth)).toBe(true);
+ await page.screenshot({ path: testInfo.outputPath("image-path-hint.png") });
+ await page.mouse.move(0, 0);
+ await imagePath.focus();
+ await expect(hint).toContainText(longEditPath.replace("serve_fixture.py", "screenshot.png"));
+ await page.setViewportSize({ width: 1600, height: 800 });
+ await page.getByLabel("File edits").evaluate((element) => { (element as HTMLElement).style.maxWidth = "none"; });
+ await expect(longPath).not.toContainText("…");
+ expect(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth)).toBe(true);
+ });
+}
diff --git a/webui/browser/fixture.tsx b/webui/browser/fixture.tsx
index 6384955ae..b65cbd2f8 100644
--- a/webui/browser/fixture.tsx
+++ b/webui/browser/fixture.tsx
@@ -31,6 +31,7 @@ import { AnswerOrderFixture } from "./answer-order-fixture";
import { SidebarActivityFixture } from "./sidebar-activity-fixture";
import { HistoryHydrationFixture } from "./history-hydration-fixture";
import { IdleCompactionFixture, installIdleCompactionApi } from "./idle-compaction-fixture";
+import { FileEditPathFixture } from "./file-edit-path-fixture";
const history: UIMessage[] = [
{ id: "question", role: "user", content: "Earlier question", createdAt: 1_700_000_000_000 },
@@ -172,7 +173,9 @@ if (parameters.get("case") === "skeleton-additions") installSkeletonPreviewApi()
if (parameters.get("case") === "idle-compaction") installIdleCompactionApi();
await initializeI18n();
createRoot(document.getElementById("root")!).render(<TooltipProvider>
- {parameters.get("case") === "answer-order"
+ {parameters.get("case") === "file-edit-path"
+ ? <FileEditPathFixture />
+ : parameters.get("case") === "answer-order"
? <AnswerOrderFixture />
: parameters.get("case") === "sidebar-activity"
? <SidebarActivityFixture />
diff --git a/webui/src/components/FileReferenceChip.tsx b/webui/src/components/FileReferenceChip.tsx
index cbf1a8e20..cb0866f42 100644
--- a/webui/src/components/FileReferenceChip.tsx
+++ b/webui/src/components/FileReferenceChip.tsx
@@ -1,4 +1,4 @@
-import { useEffect, useState, type KeyboardEvent, type MouseEvent } from "react";
+import { useEffect, useLayoutEffect, useRef, useState, type KeyboardEvent, type MouseEvent, type HTMLAttributes } from "react";
import { File, FileCode2, FileImage, FileJson2, FileText, FileVideo2, type LucideIcon } from "lucide-react";
import { useTranslation } from "react-i18next";
import { FileActions, useFilePreviewLoader } from "@/components/FileActions";
@@ -32,6 +32,7 @@ interface FileReferenceChipProps {
tooltipPath?: string;
display?: "name" | "path";
showIcon?: boolean;
+ truncateFromStart?: boolean;
active?: boolean;
className?: string;
textClassName?: string;
@@ -45,6 +46,7 @@ export function FileReferenceChip({
tooltipPath,
display = "name",
showIcon = true,
+ truncateFromStart = false,
active = false,
className,
textClassName,
@@ -68,18 +70,19 @@ export function FileReferenceChip({
setTooltipOpen(false);
onOpen(targetPath);
};
+ const Text = truncateFromStart ? StartTruncatedText : "span";
const onKeyDown = (event: KeyboardEvent) => {
if (event.key !== "Enter" && event.key !== " ") return;
openPreview(event);
};
return (
- <FileActions path={targetPath}>
+ <FileActions path={targetPath} className={truncateFromStart ? "min-w-0" : undefined}>
<TooltipProvider>
<Tooltip open={tooltipOpen} onOpenChange={setTooltipOpen}>
<TooltipTrigger asChild>
<span
onContextMenuCapture={() => setTooltipOpen(false)}
- className={cn("not-prose inline-flex max-w-full align-baseline leading-[inherit]", className)}
+ className={cn("not-prose inline-flex max-w-full align-baseline leading-[inherit]", truncateFromStart && "min-w-0", className)}
>
<span
data-testid={testId}
@@ -90,6 +93,7 @@ export function FileReferenceChip({
onKeyDown={interactive ? onKeyDown : undefined}
className={cn(
"inline-flex max-w-full items-baseline gap-[0.28em] font-medium leading-[inherit]",
+ truncateFromStart && "min-w-0",
interactive
? "text-sky-600 transition-colors hover:text-sky-700 dark:text-sky-300 dark:hover:text-sky-200"
: "text-muted-foreground",
@@ -100,11 +104,12 @@ export function FileReferenceChip({
)}
>
{showIcon ? <FileReferenceIcon kind={kind} className="translate-y-[0.12em]" /> : null}
- <span
+ <Text
data-sheen-text={active ? displayText : undefined}
className={cn(
- "min-w-0 max-w-full [overflow-wrap:anywhere] sm:truncate",
- active && "streaming-text-sheen file-reference-sheen",
+ "min-w-0 max-w-full",
+ !truncateFromStart && "[overflow-wrap:anywhere] sm:truncate",
+ active && !truncateFromStart && "streaming-text-sheen file-reference-sheen",
textClassName,
)}
>
@@ -116,26 +121,28 @@ export function FileReferenceChip({
) : (
displayText
)}
- </span>
+ </Text>
</span>
</span>
</TooltipTrigger>
<TooltipContent
- aria-label={imageQuickLook ? t("filePreview.aria") : undefined}
+ aria-label={truncateFromStart ? fullPath : imageQuickLook ? t("filePreview.aria") : undefined}
side="top"
- align="center"
+ align={truncateFromStart ? "start" : "center"}
sideOffset={8}
collisionPadding={12}
className={cn(
"rounded-control text-popover-foreground",
+ imageQuickLook && truncateFromStart && "space-y-2",
imageQuickLook
- ? "w-max max-w-[calc(100vw-2rem)] p-2"
- : "max-w-[min(38rem,calc(100vw-2rem))] break-all px-2.5 py-1.5 font-mono text-[11px] leading-snug",
+ ? cn("w-max p-2", truncateFromStart ? "max-w-[min(38rem,calc(100vw-2rem))]" : "max-w-[calc(100vw-2rem)]")
+ : cn("max-w-[min(38rem,calc(100vw-2rem))] px-2.5 py-1.5 font-mono text-[11px] leading-snug", truncateFromStart ? "text-left [overflow-wrap:anywhere]" : "break-all"),
)}
>
- {imageQuickLook
- ? tooltipOpen ? <FileImageQuickLook key={targetPath} path={targetPath} /> : null
- : fullPath}
+ {truncateFromStart ? <span className="block max-w-full select-text whitespace-pre-wrap text-left font-mono text-[11px] leading-snug [overflow-wrap:anywhere]">{fullPath.split(/([\\/])/).map((part, index) => (
+ <span key={index}>{part}{/^[\\/]$/.test(part) ? <wbr /> : null}</span>
+ ))}</span> : !imageQuickLook ? fullPath : null}
+ {imageQuickLook && tooltipOpen ? <FileImageQuickLook key={targetPath} path={targetPath} /> : null}
</TooltipContent>
</Tooltip>
</TooltipProvider>
@@ -143,6 +150,26 @@ export function FileReferenceChip({
);
}
+function StartTruncatedText({ children, className, ...props }: HTMLAttributes<HTMLSpanElement> & { "data-sheen-text"?: string }) {
+ const container = useRef<HTMLSpanElement>(null);
+ const content = useRef<HTMLSpanElement>(null);
+ const [clipped, setClipped] = useState(false);
+ useLayoutEffect(() => {
+ const update = () => setClipped(content.current!.getBoundingClientRect().width > container.current!.getBoundingClientRect().width);
+ const observer = new ResizeObserver(update);
+ observer.observe(container.current!);
+ observer.observe(content.current!);
+ update();
+ return () => observer.disconnect();
+ }, []);
+ return <span ref={container} className={cn("inline-flex items-baseline overflow-hidden whitespace-nowrap", className)}>
+ {clipped ? <span aria-hidden className="shrink-0">…</span> : null}
+ <span className="flex min-w-0 justify-end overflow-hidden">
+ <span ref={content} className={cn("shrink-0", props["data-sheen-text"] && "streaming-text-sheen file-reference-sheen")} {...props}>{children}</span>
+ </span>
+ </span>;
+}
+
/** Only loads after the normal hover/focus delay, through the session's guarded preview API. */
function FileImageQuickLook({ path }: { path: string }) {
const { t } = useTranslation();
diff --git a/webui/src/components/thread/activity/FileEditRow.tsx b/webui/src/components/thread/activity/FileEditRow.tsx
index 49e19325d..7abd6ccc8 100644
--- a/webui/src/components/thread/activity/FileEditRow.tsx
+++ b/webui/src/components/thread/activity/FileEditRow.tsx
@@ -108,17 +108,21 @@ function FileEditRow({
? t("message.fileEditPreparing", { defaultValue: "Preparing file edit…" })
: (
<span className="flex min-w-0 items-center gap-1.5 overflow-hidden whitespace-nowrap">
- <FileReferenceChip
- path={edit.path}
- previewPath={edit.absolute_path || edit.path}
- onOpen={onOpenFilePreview}
- display="path"
- showIcon={false}
- active={editing}
- className="min-w-0"
- textClassName="truncate text-[12px]"
- testId="activity-file-reference"
- />
+ <span className="flex min-w-0 shrink overflow-hidden">
+ <FileReferenceChip
+ path={edit.path}
+ tooltipPath={edit.absolute_path || edit.path}
+ previewPath={edit.absolute_path || edit.path}
+ onOpen={onOpenFilePreview}
+ display="path"
+ showIcon={false}
+ active={editing}
+ className="min-w-0"
+ truncateFromStart
+ textClassName="text-[12px]"
+ testId="activity-file-reference"
+ />
+ </span>
{hasCountedDiff ? <DiffPair added={edit.added} deleted={edit.deleted} /> : null}
</span>
)}
@@ -194,10 +198,6 @@ function FileUnifiedDiff({
: EMPTY_VISIBLE_DIFF,
[lineLimit, renderableDiff, shouldRenderBody, totalLineCount],
);
- const lineCountLabel = t("message.fileEditDiffLineCount", {
- count: diff.truncated ? `${totalLineCount}+` : totalLineCount,
- defaultValue: "{{count}} lines",
- });
const viewDiffLabel = shouldAutoCollapse
? tx("message.fileEditViewLargeDiff", "View large diff")
: tx("message.fileEditViewDiff", "View diff");
@@ -319,7 +319,6 @@ function FileUnifiedDiff({
aria-hidden
/>
<span className="min-w-0 flex-1">{viewDiffLabel}</span>
- <span className="shrink-0 text-muted-foreground">{lineCountLabel}</span>
</button>
<DisclosureContent id={contentId} open={open} onExitComplete={releaseBody}>
{shouldRenderBody ? renderBody() : null}
diff --git a/webui/src/i18n/locales/en/common.json b/webui/src/i18n/locales/en/common.json
index f6d2342e0..e2ccad147 100644
--- a/webui/src/i18n/locales/en/common.json
+++ b/webui/src/i18n/locales/en/common.json
@@ -2538,7 +2538,6 @@
"turnLatencyTitle": "Response time (end-to-end)",
"fileEditViewDiff": "View changes",
"fileEditViewLargeDiff": "Expand changes",
- "fileEditDiffLineCount": "{{count}} lines",
"fileEditUnchangedLinesHidden": "{{count}} unchanged lines hidden",
"fileEditShowMoreLines": "Show {{count}} more lines",
"fileEditShowFewerLines": "Show fewer lines",
diff --git a/webui/src/i18n/locales/es/common.json b/webui/src/i18n/locales/es/common.json
index 807fb597e..e1ec9d10e 100644
--- a/webui/src/i18n/locales/es/common.json
+++ b/webui/src/i18n/locales/es/common.json
@@ -2160,7 +2160,6 @@
"turnLatencyTitle": "Tiempo de respuesta (extremo a extremo)",
"fileEditViewDiff": "Ver cambios",
"fileEditViewLargeDiff": "Expandir cambios",
- "fileEditDiffLineCount": "{{count}} líneas",
"fileEditUnchangedLinesHidden": "{{count}} líneas sin cambios ocultas",
"fileEditShowMoreLines": "Mostrar {{count}} líneas más",
"fileEditShowFewerLines": "Mostrar menos líneas",
diff --git a/webui/src/i18n/locales/fr/common.json b/webui/src/i18n/locales/fr/common.json
index bbbb7554a..8c908605e 100644
--- a/webui/src/i18n/locales/fr/common.json
+++ b/webui/src/i18n/locales/fr/common.json
@@ -2159,7 +2159,6 @@
"turnLatencyTitle": "Temps de réponse (de bout en bout)",
"fileEditViewDiff": "Voir les modifications",
"fileEditViewLargeDiff": "Déplier les modifications",
- "fileEditDiffLineCount": "{{count}} lignes",
"fileEditUnchangedLinesHidden": "{{count}} lignes inchangées masquées",
"fileEditShowMoreLines": "Afficher {{count}} lignes de plus",
"fileEditShowFewerLines": "Afficher moins de lignes",
diff --git a/webui/src/i18n/locales/id/common.json b/webui/src/i18n/locales/id/common.json
index 4a0d18f2b..57aec7b24 100644
--- a/webui/src/i18n/locales/id/common.json
+++ b/webui/src/i18n/locales/id/common.json
@@ -2159,7 +2159,6 @@
"turnLatencyTitle": "Waktu respons (ujung ke ujung)",
"fileEditViewDiff": "Lihat perubahan",
"fileEditViewLargeDiff": "Perluas perubahan",
- "fileEditDiffLineCount": "{{count}} baris",
"fileEditUnchangedLinesHidden": "{{count}} baris tidak berubah disembunyikan",
"fileEditShowMoreLines": "Tampilkan {{count}} baris lagi",
"fileEditShowFewerLines": "Tampilkan lebih sedikit baris",
diff --git a/webui/src/i18n/locales/ja/common.json b/webui/src/i18n/locales/ja/common.json
index 9415083db..ce081603c 100644
--- a/webui/src/i18n/locales/ja/common.json
+++ b/webui/src/i18n/locales/ja/common.json
@@ -2159,7 +2159,6 @@
"turnLatencyTitle": "応答時間(全行程)",
"fileEditViewDiff": "変更を表示",
"fileEditViewLargeDiff": "変更を展開",
- "fileEditDiffLineCount": "{{count}} 行",
"fileEditUnchangedLinesHidden": "未変更の {{count}} 行を非表示",
"fileEditShowMoreLines": "さらに {{count}} 行を表示",
"fileEditShowFewerLines": "表示行数を減らす",
diff --git a/webui/src/i18n/locales/ko/common.json b/webui/src/i18n/locales/ko/common.json
index a6137c1b4..92786701c 100644
--- a/webui/src/i18n/locales/ko/common.json
+++ b/webui/src/i18n/locales/ko/common.json
@@ -2159,7 +2159,6 @@
"turnLatencyTitle": "응답 시간(엔드투엔드)",
"fileEditViewDiff": "변경 보기",
"fileEditViewLargeDiff": "변경 펼치기",
- "fileEditDiffLineCount": "{{count}}줄",
"fileEditUnchangedLinesHidden": "변경되지 않은 {{count}}줄 숨김",
"fileEditShowMoreLines": "{{count}}줄 더 보기",
"fileEditShowFewerLines": "간략히 보기",
diff --git a/webui/src/i18n/locales/pt-BR/common.json b/webui/src/i18n/locales/pt-BR/common.json
index cf03b139f..b989863a0 100644
--- a/webui/src/i18n/locales/pt-BR/common.json
+++ b/webui/src/i18n/locales/pt-BR/common.json
@@ -2352,7 +2352,6 @@
"turnLatencyTitle": "Tempo de resposta (ponta a ponta)",
"fileEditViewDiff": "Ver alterações",
"fileEditViewLargeDiff": "Expandir alterações",
- "fileEditDiffLineCount": "{{count}} linhas",
"fileEditUnchangedLinesHidden": "{{count}} linhas inalteradas ocultas",
"fileEditShowMoreLines": "Mostrar mais {{count}} linhas",
"fileEditShowFewerLines": "Mostrar menos linhas",
diff --git a/webui/src/i18n/locales/vi/common.json b/webui/src/i18n/locales/vi/common.json
index 7dda930b5..500c149de 100644
--- a/webui/src/i18n/locales/vi/common.json
+++ b/webui/src/i18n/locales/vi/common.json
@@ -2159,7 +2159,6 @@
"turnLatencyTitle": "Thời gian phản hồi (end-to-end)",
"fileEditViewDiff": "Xem thay đổi",
"fileEditViewLargeDiff": "Mở rộng thay đổi",
- "fileEditDiffLineCount": "{{count}} dòng",
"fileEditUnchangedLinesHidden": "Đã ẩn {{count}} dòng không đổi",
"fileEditShowMoreLines": "Hiển thị thêm {{count}} dòng",
"fileEditShowFewerLines": "Hiển thị ít dòng hơn",
diff --git a/webui/src/i18n/locales/zh-CN/common.json b/webui/src/i18n/locales/zh-CN/common.json
index d912d0cac..9d4cb5397 100644
--- a/webui/src/i18n/locales/zh-CN/common.json
+++ b/webui/src/i18n/locales/zh-CN/common.json
@@ -2538,7 +2538,6 @@
"turnLatencyTitle": "回复耗时",
"fileEditViewDiff": "查看修改",
"fileEditViewLargeDiff": "展开修改",
- "fileEditDiffLineCount": "{{count}} 行",
"fileEditUnchangedLinesHidden": "已隐藏 {{count}} 行未修改内容",
"fileEditShowMoreLines": "显示剩余 {{count}} 行",
"fileEditShowFewerLines": "收起部分行",
diff --git a/webui/src/i18n/locales/zh-TW/common.json b/webui/src/i18n/locales/zh-TW/common.json
index 3bd58b831..5e148a5ae 100644
--- a/webui/src/i18n/locales/zh-TW/common.json
+++ b/webui/src/i18n/locales/zh-TW/common.json
@@ -2158,7 +2158,6 @@
"turnLatencyTitle": "回覆耗時",
"fileEditViewDiff": "檢視修改",
"fileEditViewLargeDiff": "展開修改",
- "fileEditDiffLineCount": "{{count}} 行",
"fileEditUnchangedLinesHidden": "已隱藏 {{count}} 行未修改內容",
"fileEditShowMoreLines": "顯示其餘 {{count}} 行",
"fileEditShowFewerLines": "收起部分行",
diff --git a/webui/src/tests/agent-activity-cluster.test.tsx b/webui/src/tests/agent-activity-cluster.test.tsx
index d4779c79f..2f057a160 100644
--- a/webui/src/tests/agent-activity-cluster.test.tsx
+++ b/webui/src/tests/agent-activity-cluster.test.tsx
@@ -471,7 +471,7 @@ describe("AgentActivityCluster", () => {
expect(screen.queryByText("Edited files")).not.toBeInTheDocument();
const fileRef = screen.getByTestId("activity-file-reference");
expect(fileRef).toHaveTextContent("src/app.tsx");
- expect(fileRef).toHaveAttribute("aria-label", "src/app.tsx");
+ expect(fileRef).toHaveAttribute("aria-label", "/Users/renxubin/project/src/app.tsx");
expect(screen.queryByTestId("activity-header-file-reference")).not.toBeInTheDocument();
expect(screen.queryByTestId("file-edit-diff")).not.toBeInTheDocument();
for (const diffPair of screen.getAllByTestId("activity-diff-pair")) {
@@ -794,8 +794,7 @@ describe("AgentActivityCluster", () => {
const toggle = screen.getByTestId("file-edit-diff-toggle");
expect(toggle).toHaveAttribute("aria-expanded", "false");
- expect(toggle).toHaveTextContent("Expand changes");
- expect(toggle).toHaveTextContent("165 lines");
+ expect(toggle).toHaveTextContent(/^Expand changes$/);
expect(screen.queryByTestId("file-edit-diff")).not.toBeInTheDocument();
expect(screen.queryByText("line-1")).not.toBeInTheDocument();
@@ -883,8 +882,7 @@ describe("AgentActivityCluster", () => {
const toggle = screen.getByTestId("file-edit-diff-toggle");
expect(toggle).toHaveAttribute("aria-expanded", "false");
- expect(toggle).toHaveTextContent("View changes");
- expect(toggle).toHaveTextContent("3 lines");
+ expect(toggle).toHaveTextContent(/^View changes$/);
expect(screen.queryByTestId("file-edit-diff")).not.toBeInTheDocument();
expect(screen.queryByText("return <New />;")).not.toBeInTheDocument();