Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.
Python aicode-complexitycode-healthcode-intelligencecode-qualitydead-codedeveloper-toolsdocumentationgit-analyticsmcpopen-sourcepythonrefactoringstatic-analysistechnical-debt
fix(ui): keep the Overview header intact while a job runs (#4735)
JG Tromp922a5099575b
diff --git a/packages/ui/__tests__/dashboard/quick-actions.test.tsx b/packages/ui/__tests__/dashboard/quick-actions.test.tsxindex 111e7d379..89f8f76f2 100644--- a/packages/ui/__tests__/dashboard/quick-actions.test.tsx+++ b/packages/ui/__tests__/dashboard/quick-actions.test.tsx@@ -61,6 +61,20 @@ describe("QuickActions", () => {expect(screen.queryByRole("button", { name: /^Sync$/ })).not.toBeInTheDocument();});+ it("bounds the job panel's width in the header variant", () => {+ // The header's actions slot does not shrink, so an unbounded panel takes+ // its content's width and crushes the repo name beside it (#4690).+ render(+ <QuickActions+ onAction={vi.fn()}+ variant="header"+ activeJobSlot={<div data-testid="job-progress">progress</div>}+ />,+ );+ const container = screen.getByTestId("job-progress").parentElement!;+ expect(container).toHaveClass("min-w-0", "sm:w-80");+ });+it("fires non-confirming actions immediately (dead-code path)", () => {const onAction = vi.fn().mockResolvedValue(undefined);render(<QuickActions onAction={onAction} />);diff --git a/packages/ui/__tests__/jobs/job-log.test.tsx b/packages/ui/__tests__/jobs/job-log.test.tsxnew file mode 100644index 000000000..46f97fb01--- /dev/null+++ b/packages/ui/__tests__/jobs/job-log.test.tsx@@ -0,0 +1,28 @@+import { describe, it, expect, vi, beforeAll } from "vitest";+import { render, screen } from "@testing-library/react";+import { JobLog } from "../../src/jobs/job-log.js";++describe("JobLog", () => {+ beforeAll(() => {+ // jsdom has no layout, so no scrollIntoView; the log calls it on update.+ Object.defineProperty(Element.prototype, "scrollIntoView", {+ configurable: true,+ value: vi.fn(),+ });+ });++ it("shows only the last maxLines entries", () => {+ render(<JobLog entries={["a", "b", "c"].map((text) => ({ text }))} maxLines={2} />);+ expect(screen.queryByText("a")).not.toBeInTheDocument();+ expect(screen.getByText("b")).toBeInTheDocument();+ expect(screen.getByText("c")).toBeInTheDocument();+ });++ it("overrides the viewport's table wrapper so long lines truncate", () => {+ // Radix's `display:table` wrapper grows to the widest line; left alone, a+ // long line widened the panel instead of truncating (#4690).+ const { container } = render(<JobLog entries={[{ text: "x".repeat(500) }]} />);+ const viewport = container.querySelector("[data-radix-scroll-area-viewport]");+ expect(viewport).toHaveClass("[&>div]:block!");+ });+});diff --git a/packages/ui/src/dashboard/quick-actions.tsx b/packages/ui/src/dashboard/quick-actions.tsxindex e73b8ac3f..236e3387e 100644--- a/packages/ui/src/dashboard/quick-actions.tsx+++ b/packages/ui/src/dashboard/quick-actions.tsx@@ -171,6 +171,12 @@ export function QuickActions({}if (activeJobSlot) {+ // In the header the panel sits in a slot that does not shrink, beside the+ // repo identity. Unbounded, it took the width of its longest log line and+ // squeezed the repo name down to one character per line.+ if (variant === "header") {+ return <div className="w-full min-w-0 sm:w-80 lg:w-96">{activeJobSlot}</div>;+ }return <div className="mb-2">{activeJobSlot}</div>;}diff --git a/packages/ui/src/jobs/job-log.tsx b/packages/ui/src/jobs/job-log.tsxindex fb080a616..092aacc00 100644--- a/packages/ui/src/jobs/job-log.tsx+++ b/packages/ui/src/jobs/job-log.tsx@@ -31,7 +31,13 @@ export function JobLog({ entries, maxLines = 6 }: JobLogProps) {const visible = entries.slice(-maxLines);return (- <ScrollArea className="h-28 rounded border border-[var(--color-border-default)] bg-[var(--color-bg-elevated)]">+ // Radix wraps the viewport's content in a `display:table` div that grows to+ // its widest line, so `truncate` below never applied and a long line+ // widened the whole panel. `block` holds the content to the panel's width.+ <ScrollArea+ className="h-28 rounded border border-[var(--color-border-default)] bg-[var(--color-bg-elevated)]"+ viewportClassName="[&>div]:block!"+ ><div className="p-2 space-y-0.5 font-mono text-xs">{visible.map((e, i) => (<div key={i} className={cn("leading-5 truncate", levelClass(e.level))}>