Skip to content

Commit d8525d7

Browse files
committed
fix(app): preserve framed row paint
1 parent ae27fed commit d8525d7

2 files changed

Lines changed: 41 additions & 2 deletions

File tree

packages/app/e2e/regression/session-timeline-shell-outline.spec.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
assistantMessage,
44
setupTimeline,
55
shell,
6+
textPart,
67
toolPart,
78
userMessage,
89
} from "../performance/timeline-stability/fixture"
@@ -119,6 +120,44 @@ test("keeps the patch card inside a fractionally short virtual row", async ({ pa
119120
expect(geometry.clipMargin).toBe("0.5px")
120121
})
121122

123+
test("allows paint rounding for every framed row but not fixed turn gaps", async ({ page }) => {
124+
const secondUserID = "msg_outline_second_user"
125+
await setupTimeline(page, {
126+
messages: [
127+
userMessage(undefined, {
128+
summary: {
129+
diffs: [
130+
{
131+
file: "src/summary.ts",
132+
additions: 1,
133+
deletions: 1,
134+
patch: "@@ -1 +1 @@\n-export const value = 1\n+export const value = 2",
135+
},
136+
],
137+
},
138+
}),
139+
assistantMessage([textPart("prt_outline_text", "Assistant text")]),
140+
userMessage(undefined, { id: secondUserID, created: 1700000010000 }),
141+
assistantMessage([], {
142+
id: "msg_outline_second_assistant",
143+
parentID: secondUserID,
144+
created: 1700000011000,
145+
}),
146+
],
147+
})
148+
await expect(page.locator('[data-timeline-row="DiffSummary"]')).toBeVisible()
149+
await expect(page.locator('[data-timeline-row="TurnGap"]')).toBeVisible()
150+
151+
const rows = await page.locator("[data-timeline-key]").evaluateAll((elements) =>
152+
elements.map((element) => ({
153+
tag: element.querySelector<HTMLElement>("[data-timeline-row]")?.dataset.timelineRow,
154+
clipMargin: getComputedStyle(element).overflowClipMargin,
155+
})),
156+
)
157+
expect(rows.filter((row) => row.tag !== "TurnGap").every((row) => row.clipMargin === "0.5px")).toBe(true)
158+
expect(rows.filter((row) => row.tag === "TurnGap")).toEqual([{ tag: "TurnGap", clipMargin: "0px" }])
159+
})
160+
122161
async function captureCardEdges(page: Page, card: Locator) {
123162
const box = await card.boundingBox()
124163
if (!box) throw new Error("Tool card bounds are unavailable")

packages/app/src/pages/session/timeline/message-timeline.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,8 +1279,8 @@ export function MessageTimeline(props: {
12791279
width: "100%",
12801280
height: `${item().size}px`,
12811281
overflow: "clip",
1282-
// Rounded virtual measurements can otherwise clip a tool card's outer border pixel.
1283-
"overflow-clip-margin": tool() ? "0.5px" : undefined,
1282+
// Rounded virtual measurements can otherwise clip a framed row's outer paint.
1283+
"overflow-clip-margin": row()._tag === "TurnGap" ? undefined : "0.5px",
12841284
}}
12851285
>
12861286
<div

0 commit comments

Comments
 (0)