refactor: remove unreachable code and redundant tests (#6729)

* refactor: prune unreachable runtime and WebUI paths

* test: drop duplicate cases and assertions for obsolete selectors
This commit is contained in:
chengyongru authored and GitHub committed 2026-11-20 11:11:00 +08:00
1 parent b9b491e74c
commit 51fa1a7f74
20 files changed
+32 -163

No files matched your search

-30
View File
@@ -348,36 +348,6 @@
overflow: hidden;
}
.kv-cache-not-reused {
background: hsl(var(--usage-token) / 0.84);
}
.kv-cache-reused {
background-color: hsl(var(--usage-token) / 0.1);
background-image: repeating-linear-gradient(
135deg,
hsl(var(--usage-token) / 0.46) 0,
hsl(var(--usage-token) / 0.46) 1px,
transparent 1px,
transparent 4px
);
}
.dark .kv-cache-not-reused {
background: hsl(var(--usage-token) / 0.92);
}
.dark .kv-cache-reused {
background-color: hsl(var(--usage-token) / 0.15);
background-image: repeating-linear-gradient(
135deg,
hsl(var(--usage-token) / 0.58) 0,
hsl(var(--usage-token) / 0.58) 1px,
transparent 1px,
transparent 4px
);
}
.composer-model-badge::before {
content: "";
position: absolute;
+1 -1
View File
@@ -324,7 +324,7 @@ export function UpdateFlowProvider({ client, token, enabled, canSettleHandoff =
</div> : blocked ? ownerInstructions : null}
<div className={`mt-6 grid shrink-0 ${done || blocked ? "grid-cols-1" : "grid-cols-2"} gap-2.5`}>
{!done && !blocked && <Button variant="secondary" onClick={close}>
{t(done || failed || error || blocked ? "updates.close" : busy ? "updates.hide" : "updates.cancel")}
{t(failed || error ? "updates.close" : busy ? "updates.hide" : "updates.cancel")}
</Button>}
<Button variant="accent" className="min-w-0 whitespace-normal" disabled={!blocked && busy} aria-busy={busy}
onClick={blocked ? close : primary}>
-2
View File
@@ -1143,7 +1143,6 @@ describe("App layout", () => {
"text-[var(--temporary-control-active)]",
);
expect(screen.queryByRole("tooltip")).not.toBeInTheDocument();
expect(screen.queryByTestId("temporary-chat-outline")).not.toBeInTheDocument();
fireEvent.click(temporaryToggle);
expect(temporaryToggle).toHaveAttribute("aria-pressed", "false");
expect(within(temporaryToggle).getByTestId("temporary-chat-icon")).toHaveClass(
@@ -2380,7 +2379,6 @@ describe("App layout", () => {
expect(screen.getByTestId("sidebar-brand-row")).toHaveClass("pt-3");
expect(screen.getByTestId("sidebar-brand-mark")).toHaveClass("mt-5");
expect(screen.getByRole("separator", { name: "Resize sidebar" })).toHaveAttribute("aria-valuenow", "272");
expect(screen.queryByTestId("host-sidebar-toggle")).not.toBeInTheDocument();
expect(
screen.getByRole("navigation", { name: "Sidebar navigation" }),
).toBeInTheDocument();
@@ -672,7 +672,6 @@ describe("Automation task list and detail sheet", () => {
expect(header).toHaveClass("bg-foreground/[0.025]");
expect(header).not.toHaveClass("border-b");
expect(header?.querySelector(".automation-calendar-weekdays")).toBeInTheDocument();
expect(calendar.querySelector(".automation-meta-row")).toBeNull();
expect(calendar.querySelector(":scope > details")).toBeNull();
expect(screen.queryByRole("button", { name: /Paused backlog review/ })).not.toBeInTheDocument();
expect(calendar).not.toHaveTextContent("·");
+1 -2
View File
@@ -1346,11 +1346,10 @@ describe("MessageBubble", () => {
reasoningStreaming: true,
};
const { container } = render(<MessageBubble message={message} />);
render(<MessageBubble message={message} />);
const preview = screen.getByText("Step 1: parse intent. Step 2: compute.");
expect(preview).toBeInTheDocument();
expect(container.querySelector(".reasoning-sheen-stripe")).not.toBeInTheDocument();
expect(preview).toHaveClass("streaming-text-sheen");
expect(preview).toHaveAttribute(
"data-sheen-text",
-3
View File
@@ -1556,7 +1556,6 @@ describe("ThreadComposer", () => {
expect(screen.getByRole("button", { name: "Switch directory" })).toBeEnabled();
rerender(composer(false, "thread", true));
expect(screen.queryByRole("button", { name: "Switch directory" })).not.toBeInTheDocument();
expect(container.querySelector(".thread-composer-workspace-label")).not.toBeInTheDocument();
const accessAfterLock = screen.getByRole("button", { name: "Workspace access mode: Full Access" });
await user.click(accessAfterLock);
await user.click(screen.getByRole("menuitemradio", { name: "Default Permission" }));
@@ -1894,7 +1893,6 @@ describe("ThreadComposer", () => {
expect(input).toHaveValue("@Blender ");
expect(screen.getByTestId("composer-cli-mention-blender")).toHaveTextContent("@Blender");
expect(screen.queryByTestId("composer-cli-app-tray")).not.toBeInTheDocument();
expect(onSend).not.toHaveBeenCalled();
expect(screen.queryByRole("listbox", { name: "Mentions" })).not.toBeInTheDocument();
@@ -2750,7 +2748,6 @@ describe("ThreadComposer", () => {
expect(token.className).not.toContain("mx-");
expect(token).toHaveClass("text-foreground");
expect(token.style.textShadow).toBe("");
expect(screen.queryByTestId("composer-cli-app-tray")).not.toBeInTheDocument();
const logo = screen.getByTestId("composer-cli-mention-logo-gimp");
expect(logo.className).toContain("top-1/2");
expect(logo.className).toContain("left-0");
-1
View File
@@ -2145,7 +2145,6 @@ describe("ThreadShell", () => {
);
const badge = await screen.findByRole("button", { name: "Choose model" });
expect(screen.queryByTestId("composer-model-setup-icon")).not.toBeInTheDocument();
expect(badge.querySelector('[data-needs-setup="true"]')).toHaveClass(
"composer-model-pill-setup",
);