From 58617fd920c6d80a7b7d4fe1398bfeeea97daa0f Mon Sep 17 00:00:00 2001 From: Filip Hejmowski Date: Thu, 22 Oct 2026 18:50:07 +0200 Subject: [PATCH] feat(app): fold a finished compaction into one divider --- .../session-notice-truncation.spec.ts | 1 + .../e2e/regression/timeline-stream.spec.ts | 23 +++-- packages/app/src/settings/model.test.ts | 2 + .../src/components/timeline-separator.tsx | 9 +- .../src/message/message-content.tsx | 92 ++++++++++++------- packages/ui/src/i18n/en.ts | 1 - 6 files changed, 85 insertions(+), 43 deletions(-) diff --git a/packages/app/e2e/regression/session-notice-truncation.spec.ts b/packages/app/e2e/regression/session-notice-truncation.spec.ts index 424661a4a80..2bd87c1bd3a 100644 --- a/packages/app/e2e/regression/session-notice-truncation.spec.ts +++ b/packages/app/e2e/regression/session-notice-truncation.spec.ts @@ -59,6 +59,7 @@ for (const { width, ...profile } of [ notices.evaluateAll((nodes) => nodes.map((node) => { const style = getComputedStyle(node) + // SAFETY: the locator matches only rendered timeline notices, which are HTML elements. const element = node as HTMLElement return { diff --git a/packages/app/e2e/regression/timeline-stream.spec.ts b/packages/app/e2e/regression/timeline-stream.spec.ts index f40b91d7dd1..c154c09ac18 100644 --- a/packages/app/e2e/regression/timeline-stream.spec.ts +++ b/packages/app/e2e/regression/timeline-stream.spec.ts @@ -1449,15 +1449,17 @@ test.describe("compaction", () => { ) await expect(compaction).toContainText("Final implementation details.") await expect(compaction).not.toContainText("Streamed implementation details.") - await expect(compaction.getByText("Session compaction started", { exact: true })).toBeVisible() - await expect(compaction.getByText("Session compacted", { exact: true })).toBeVisible() - await expect(compaction.getByRole("button", { name: "Summary", exact: true })).toBeVisible() + + // Finished, the summary sits under a single divider that folds it. + const done = compaction.getByRole("button", { name: "Session compacted", exact: true }) + await expect(done).toHaveAttribute("aria-expanded", "true") + await expect(compaction.getByText("Session compaction started", { exact: true })).toHaveCount(0) await expect .poll(async () => { - const body = await summary.boundingBox() - const done = await compaction.getByText("Session compacted", { exact: true }).boundingBox() + const body = await compaction.locator('[data-component="text-part"]').boundingBox() + const divider = await done.boundingBox() - return !!body && !!done && done.y >= body.y + body.height + return !!body && !!divider && body.y >= divider.y + divider.height }) .toBe(true) await expect(compaction.getByRole("status")).toHaveCount(0) @@ -1475,9 +1477,9 @@ test.describe("compaction", () => { await expect(compaction.getByText("Streamed folded details.")).toBeHidden() await timeline.send(compactionEnded({ sessionID, reason: "auto", text: "Final folded details." })) - await expect(compaction.getByText("Session compacted", { exact: true })).toBeVisible() - const trigger = compaction.getByRole("button", { name: "Summary", exact: true }) + const trigger = compaction.getByRole("button", { name: "Session compacted", exact: true }) await expect(trigger).toHaveAttribute("aria-expanded", "false") + await expect(compaction.getByText("Session compaction started", { exact: true })).toHaveCount(0) await expect(compaction.getByText("Final folded details.")).toBeHidden() await trigger.click() @@ -1518,7 +1520,10 @@ test.describe("compaction", () => { for (const names of [["failed", "cancelled"], ["interrupted"]] as const) { test(`ends running compactions as ${names.join(", then ")}`, async ({ page }) => { // Expanded notices show the partial summary while it streams. - const settings = { timelineDetail: { ...detailed, notices: { placement: "grouped", details: "expanded" } } } as const + const settings = { + timelineDetail: { ...detailed, notices: { placement: "grouped", details: "expanded" } }, + } as const + const timeline = await setupTimeline( page, names[0] === "interrupted" diff --git a/packages/app/src/settings/model.test.ts b/packages/app/src/settings/model.test.ts index 57cb19c748a..75680fff920 100644 --- a/packages/app/src/settings/model.test.ts +++ b/packages/app/src/settings/model.test.ts @@ -37,9 +37,11 @@ describe("settings timeline detail migration", () => { test("gives saved notices the compaction summary detail their placement showed", () => { const { details: _, ...everythingNotices } = timelinePresets[0].value.notices + const everything = decode({ general: { timelineDetail: { ...timelinePresets[0].value, notices: everythingNotices } }, }) + const grouped = decode({ general: { timelineDetail: { notices: { placement: "grouped" } } } }) expect(everything.general.timelineDetail).toEqual(timelinePresets[0].value) diff --git a/packages/session-ui/src/components/timeline-separator.tsx b/packages/session-ui/src/components/timeline-separator.tsx index 1e9f733791f..8b559441741 100644 --- a/packages/session-ui/src/components/timeline-separator.tsx +++ b/packages/session-ui/src/components/timeline-separator.tsx @@ -1,6 +1,6 @@ import { ProviderIcon } from "@opencode/ui/provider-icon" import { Tooltip } from "@opencode/ui/tooltip" -import { Show } from "solid-js" +import { Show, type JSX } from "solid-js" export function TimelineSeparator(props: { label: string @@ -8,6 +8,8 @@ export function TimelineSeparator(props: { tooltip?: string providerID?: string variant?: string + /** Shown after the label, such as a 24px disclosure arrow. */ + suffix?: JSX.Element }) { const label = () => (