GeezerVison is showing github.com — feat(app): make session timelines much faster AND without flicker or … · moonug/opencode@3b811bd
File treeExpand file treeCollapse file tree Open diff view settings Some content is hiddenLarge Commits have some content hidden by default. Use the searchbox below for content that may be hidden. Dismiss bannerExpand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: bun.lock +72-28Lines changed: 72 additions & 28 deletions Collapse file Copy file name to clipboardExpand all lines: bunfig.toml +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 2 | 2 | exact = true | 3 | 3 | # Only install newly resolved package versions published at least 3 days ago. | 4 | 4 | minimumReleaseAge = 259200 | 5 | | -minimumReleaseAgeExcludes = ["@ai-sdk/amazon-bedrock", "@ai-sdk/anthropic", "@opentui/core", "@opentui/core-darwin-arm64", "@opentui/core-darwin-x64", "@opentui/core-linux-arm64", "@opentui/core-linux-arm64-musl", "@opentui/core-linux-x64", "@opentui/core-linux-x64-musl", "@opentui/core-win32-arm64", "@opentui/core-win32-x64", "@opentui/keymap", "@opentui/solid", "opentui-spinner", "gitlab-ai-provider", "opencode-gitlab-auth", "@ff-labs/fff-node", "@ff-labs/fff-bun", "@ff-labs/fff-bin-darwin-arm64", "@ff-labs/fff-bin-darwin-x64", "@ff-labs/fff-bin-linux-arm64-gnu", "@ff-labs/fff-bin-linux-arm64-musl", "@ff-labs/fff-bin-linux-x64-gnu", "@ff-labs/fff-bin-linux-x64-musl", "@ff-labs/fff-bin-win32-arm64", "@ff-labs/fff-bin-win32-x64", "app-builder-lib", "dmg-builder", "electron-builder", "electron-publish"] | | 5 | +minimumReleaseAgeExcludes = ["@ai-sdk/amazon-bedrock", "@ai-sdk/anthropic", "@opentui/core", "@opentui/core-darwin-arm64", "@opentui/core-darwin-x64", "@opentui/core-linux-arm64", "@opentui/core-linux-arm64-musl", "@opentui/core-linux-x64", "@opentui/core-linux-x64-musl", "@opentui/core-win32-arm64", "@opentui/core-win32-x64", "@opentui/keymap", "@opentui/solid", "opentui-spinner", "gitlab-ai-provider", "opencode-gitlab-auth", "@ff-labs/fff-node", "@ff-labs/fff-bun", "@ff-labs/fff-bin-darwin-arm64", "@ff-labs/fff-bin-darwin-x64", "@ff-labs/fff-bin-linux-arm64-gnu", "@ff-labs/fff-bin-linux-arm64-musl", "@ff-labs/fff-bin-linux-x64-gnu", "@ff-labs/fff-bin-linux-x64-musl", "@ff-labs/fff-bin-win32-arm64", "@ff-labs/fff-bin-win32-x64", "@pierre/diffs", "@pierre/theming", "app-builder-lib", "dmg-builder", "electron-builder", "electron-publish"] | 6 | 6 |
| 7 | 7 | [test] | 8 | 8 | root = "./do-not-run-tests-from-root" |
Collapse file Copy file name to clipboardExpand all lines: package.json +7-5Lines changed: 7 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 42 | 42 | "@opentui/core": "0.3.4", | 43 | 43 | "@opentui/keymap": "0.3.4", | 44 | 44 | "@opentui/solid": "0.3.4", | | 45 | + "@tanstack/solid-virtual": "3.13.28", | | 46 | + "@shikijs/stream": "4.2.0", | 45 | 47 | "ulid": "3.0.1", | 46 | 48 | "@kobalte/core": "0.13.11", | 47 | 49 | "@types/luxon": "3.7.1", | | 51 | 53 | "@tsconfig/bun": "1.0.9", | 52 | 54 | "@cloudflare/workers-types": "4.20251008.0", | 53 | 55 | "@openauthjs/openauth": "0.0.0-20250322224806", | 54 | | - "@pierre/diffs": "1.1.0-beta.18", | | 56 | + "@pierre/diffs": "1.2.10", | 55 | 57 | "opentui-spinner": "0.0.7", | 56 | 58 | "@solid-primitives/storage": "4.3.3", | 57 | 59 | "@tailwindcss/vite": "4.1.11", | | 76 | 78 | "zod": "4.1.8", | 77 | 79 | "remeda": "2.26.0", | 78 | 80 | "sst": "4.13.1", | 79 | | - "shiki": "3.20.0", | | 81 | + "shiki": "4.2.0", | 80 | 82 | "solid-list": "0.3.0", | 81 | 83 | "tailwindcss": "4.1.11", | 82 | | - "virtua": "0.49.1", | 83 | 84 | "vite": "7.1.4", | 84 | 85 | "@solidjs/meta": "0.29.4", | 85 | 86 | "@solidjs/router": "0.15.4", | | 145 | 146 | | 146 | 147 | | 147 | 148 | | 148 | | - | 149 | 149 | | 150 | 150 | | 151 | 151 | | 152 | 152 | | | 153 | + | 153 | 154 | | 154 | | - | | 155 | + | | 156 | + | 155 | 157 | } | 156 | 158 | } |
Collapse file Copy file name to clipboardExpand all lines: packages/app/e2e/regression/session-timeline-collapse-state.spec.ts +96-6Lines changed: 96 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -147,7 +147,8 @@ test.describe("regression: session timeline local row state", () => { | 147 | 147 |
| 148 | 148 | const wrapper = page.locator(`[data-timeline-part-id="${editPartID}"]`).first() | 149 | 149 | await expectAppVisible(wrapper) | 150 | | - await expectAppVisible(wrapper.locator('[data-component="file"][data-mode="diff"]').first()) | | 150 | + const file = wrapper.locator('[data-component="file"][data-mode="diff"]').first() | | 151 | + await expectAppVisible(file) | 151 | 152 | await markDiffProbe(page) | 152 | 153 |
| 153 | 154 | events.push({ | @@ -159,7 +160,15 @@ test.describe("regression: session timeline local row state", () => { | 159 | 160 | }) | 160 | 161 |
| 161 | 162 | await expect(page.locator(`[data-timeline-part-id="${textPartID}"]`).first()).toBeVisible({ timeout: 10_000 }) | 162 | | - expect(await readDiffProbe(page)).toEqual({ fileMarker: "before", shadowRoots: 0, toolMarker: "before" }) | | 163 | + const siblingProbe = await readDiffProbe(page) | | 164 | + expect(siblingProbe).toEqual({ | | 165 | + fileMarker: "before", | | 166 | + frameMarker: "before", | | 167 | + rowKey: `assistant-part:${userMessageID}:part:${assistantMessageID}:${editPartID}`, | | 168 | + rowMarker: "before", | | 169 | + shadowRoots: 0, | | 170 | + toolMarker: "before", | | 171 | + }) | 163 | 172 |
| 164 | 173 | await markDiffProbe(page) | 165 | 174 | events.push({ | @@ -173,7 +182,72 @@ test.describe("regression: session timeline local row state", () => { | 173 | 182 | await expect(wrapper.locator('[data-slot="diff-changes-additions"]').filter({ hasText: "+2" }).first()).toBeVisible( | 174 | 183 | { timeout: 10_000 }, | 175 | 184 | ) | 176 | | - expect(await readDiffProbe(page)).toEqual({ fileMarker: "before", shadowRoots: 0, toolMarker: "before" }) | | 185 | + expect(await readDiffProbe(page)).toEqual({ | | 186 | + fileMarker: "before", | | 187 | + frameMarker: "before", | | 188 | + rowKey: `assistant-part:${userMessageID}:part:${assistantMessageID}:${editPartID}`, | | 189 | + rowMarker: "before", | | 190 | + shadowRoots: 0, | | 191 | + toolMarker: "before", | | 192 | + }) | | 193 | + }) | | 194 | + | | 195 | + test("keeps a sticky edit header aligned with a multi-hunk diff", async ({ page }) => { | | 196 | + const events: EventPayload[] = [] | | 197 | + const lines = Array.from({ length: 1_000 }, (_, index) => `export const value${index} = ${index}\n`).join("") | | 198 | + const after = [100, 300, 500, 700, 900].reduce( | | 199 | + (result, index) => result.replace(`export const value${index} = ${index}`, `export const value${index} = compute(${index})`), | | 200 | + lines, | | 201 | + ) | | 202 | + const part = { | | 203 | + ...editPart, | | 204 | + state: { | | 205 | + ...editPart.state, | | 206 | + metadata: { | | 207 | + ...editPart.state.metadata, | | 208 | + filediff: { | | 209 | + file: "src/regression.ts", | | 210 | + additions: 1, | | 211 | + deletions: 1, | | 212 | + before: lines, | | 213 | + after, | | 214 | + }, | | 215 | + }, | | 216 | + }, | | 217 | + } | | 218 | + await mockServer(page, events, [userMessage, { ...assistantMessage, parts: [part] }]) | | 219 | + await configurePage(page) | | 220 | + | | 221 | + await page.goto(`/${base64Encode(directory)}/session/${sessionID}`) | | 222 | + await expectSessionTitle(page, title) | | 223 | + | | 224 | + const wrapper = page.locator(`[data-timeline-part-id="${editPartID}"]`).first() | | 225 | + const trigger = wrapper.locator('[data-slot="collapsible-trigger"]').first() | | 226 | + const diff = wrapper.locator('[data-component="edit-content"]').first() | | 227 | + await expectAppVisible(diff) | | 228 | + await expect.poll(() => wrapper.evaluate((element) => element.getBoundingClientRect().height)).toBeGreaterThan(500) | | 229 | + const samples = await wrapper.evaluate(async (element) => { | | 230 | + const root = element.closest<HTMLElement>(".scroll-view__viewport")! | | 231 | + element.scrollIntoView({ block: "start" }) | | 232 | + const result = [] | | 233 | + for (const offset of [0, 120, 240, 360, 480]) { | | 234 | + root.scrollBy(0, offset - (result.at(-1)?.offset ?? 0)) | | 235 | + await new Promise(requestAnimationFrame) | | 236 | + const trigger = element.querySelector<HTMLElement>('[data-slot="collapsible-trigger"]')! | | 237 | + const diff = element.querySelector<HTMLElement>('[data-component="edit-content"]')! | | 238 | + result.push({ | | 239 | + offset, | | 240 | + trigger: trigger.getBoundingClientRect().y, | | 241 | + diff: diff.getBoundingClientRect().y, | | 242 | + bottom: element.getBoundingClientRect().bottom, | | 243 | + }) | | 244 | + } | | 245 | + return result | | 246 | + }) | | 247 | + | | 248 | + expect(samples[0]!.trigger).toBeLessThan(samples[0]!.diff) | | 249 | + expect(samples.every((sample) => Math.abs(sample.trigger - samples[0]!.trigger) <= 1)).toBe(true) | | 250 | + expect(samples.every((sample) => sample.trigger < sample.bottom)).toBe(true) | 177 | 251 | }) | 178 | 252 | }) | 179 | 253 |
| @@ -247,10 +321,16 @@ async function markDiffProbe(page: Page) { | 247 | 321 | .evaluate((element) => { | 248 | 322 | const tool = element as HTMLElement | 249 | 323 | const file = tool.querySelector<HTMLElement>('[data-component="file"][data-mode="diff"]') | | 324 | + const row = tool.closest<HTMLElement>("[data-timeline-key]") | | 325 | + const frame = tool.closest<HTMLElement>("[data-timeline-row]") | 250 | 326 | if (!file) throw new Error("missing edit diff file") | | 327 | + if (!row) throw new Error("missing virtual timeline row") | | 328 | + if (!frame) throw new Error("missing timeline row frame") | 251 | 329 |
| 252 | 330 | tool.dataset.timelineProbe = "before" | 253 | 331 | file.dataset.timelineProbe = "before" | | 332 | + row.dataset.timelineProbe = "before" | | 333 | + frame.dataset.timelineProbe = "before" | 254 | 334 | window.__timelineDiffProbe.reset() | 255 | 335 | }) | 256 | 336 | } | @@ -262,10 +342,15 @@ async function readDiffProbe(page: Page) { | 262 | 342 | .evaluate((element) => { | 263 | 343 | const tool = element as HTMLElement | 264 | 344 | const file = tool.querySelector<HTMLElement>('[data-component="file"][data-mode="diff"]') | | 345 | + const row = tool.closest<HTMLElement>("[data-timeline-key]") | | 346 | + const frame = tool.closest<HTMLElement>("[data-timeline-row]") | 265 | 347 | return { | 266 | 348 | fileMarker: file?.dataset.timelineProbe, | 267 | 349 | shadowRoots: window.__timelineDiffProbe.shadowRoots(), | 268 | 350 | toolMarker: tool.dataset.timelineProbe, | | 351 | + rowMarker: row?.dataset.timelineProbe, | | 352 | + rowKey: row?.dataset.timelineKey, | | 353 | + frameMarker: frame?.dataset.timelineProbe, | 269 | 354 | } | 270 | 355 | }) | 271 | 356 | } | @@ -300,14 +385,19 @@ function readExpanded(element: Element) { | 300 | 385 | return !!content && content.getBoundingClientRect().height > 0 | 301 | 386 | } | 302 | 387 |
| 303 | | -async function mockServer(page: Page, events: EventPayload[]) { | | 388 | +async function mockServer( | | 389 | + page: Page, | | 390 | + events: EventPayload[], | | 391 | + messages = [userMessage, assistantMessage], | | 392 | +) { | 304 | 393 | await mockOpenCodeServer(page, { | 305 | 394 | directory, | 306 | 395 | project: project(), | 307 | 396 | provider: provider(), | 308 | 397 | sessions: [session()], | 309 | | - pageMessages: () => ({ items: [userMessage, assistantMessage] }), | 310 | | - events: () => events.splice(0), | | 398 | + pageMessages: () => ({ items: messages }), | | 399 | + events: () => events.splice(0, 1), | | 400 | + eventRetry: 16, | 311 | 401 | }) | 312 | 402 | } | 313 | 403 |
| |
Collapse file Copy file name to clipboardExpand all lines: packages/app/e2e/regression/session-timeline-context-resize.spec.ts +9-9Lines changed: 9 additions & 9 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -32,8 +32,6 @@ test.describe("regression: session timeline context group resize", () => { | 32 | 32 | const samples = await sampleExpansion(page) | 33 | 33 | const visibleOverlap = samples.filter((sample) => sample.frame >= 1 && sample.overlap > 0.5) | 34 | 34 |
| 35 | | - console.log("context resize samples", JSON.stringify(samples, null, 2)) | 36 | | - | 37 | 35 | expect(samples[0]?.overlap).toBe(0) | 38 | 36 | expect(visibleOverlap).toEqual([]) | 39 | 37 | expect(samples.at(-1)?.expanded).toBe("true") | @@ -115,13 +113,15 @@ async function sampleExpansion(page: Page) { | 115 | 113 |
| 116 | 114 | let frame = 1 | 117 | 115 | const tick = () => { | 118 | | - capture(frame, "raf") | 119 | | - frame += 1 | 120 | | - if (frame > 8) { | 121 | | - resolve(samples) | 122 | | - return | 123 | | - } | 124 | | - requestAnimationFrame(tick) | | 116 | + setTimeout(() => { | | 117 | + capture(frame, "painted") | | 118 | + frame += 1 | | 119 | + if (frame > 8) { | | 120 | + resolve(samples) | | 121 | + return | | 122 | + } | | 123 | + requestAnimationFrame(tick) | | 124 | + }, 0) | 125 | 125 | } | 126 | 126 | requestAnimationFrame(tick) | 127 | 127 | }), | |
|