GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(app): contain timeline rows to cut scroll layout work by Te-River · Pull Request #54293 · anomalyco/opencode

fix(app): contain timeline rows to cut scroll layout work #54293

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Te-River wants to merge 3 commits into anomalyco:dev from Te-River:timeline-containment

Uh oh!

There was an error while loading. Please reload this page.

Closed

fix(app): contain timeline rows to cut scroll layout work #54293

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit Hold shift + click to select a range
ac026c0
fix(app): contain timeline rows to cut scroll layout work
Te-River Oct 10, 2026
7007451
test(app): trim the scroll benchmark to frame-gap and long-task
Te-River Oct 10, 2026
c3fae03
test(app): drop the wheel-navigation claim from the scroll benchmark
Te-River Oct 10, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view
Prev Previous commit
Next Next commit
test(app): trim the scroll benchmark to frame-gap and long-task
Drop the cold-tail settle instrumentation (coldPending share, offsetHeight sweep, pending markdown counts) and the Chromium path override: they measure the settle path, which this change does not touch.

The retry for the first-scroll route reload is no longer needed now that the settle loop's budget is passed as an evaluate argument instead of read from module scope.
  • Loading branch information

Uh oh!

There was an error while loading. Please reload this page.

@Te-River
Te-River committed Oct 25, 2026
commit 7007451a910d3797bb13477ea4faec4681083f87

There are no files selected for viewing

68 changes: 12 additions & 56 deletions 68 packages/app/e2e/performance/timeline/session-timeline-scroll-benchmark.spec.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,12 @@ const upDelta = Number(process.env.SCROLL_BENCH_UP_DELTA ?? -900)
const fastSteps = Number(process.env.SCROLL_BENCH_FAST_STEPS ?? 8)
const fastDelta = Number(process.env.SCROLL_BENCH_FAST_DELTA ?? 2_600)

// Escape hatch for a machine whose installed Chromium revision does not match the one this
// Playwright build pins. Unset on CI, where the pinned browser is downloaded normally.
const chromiumExecutable = process.env.SCROLL_BENCH_CHROMIUM_EXECUTABLE

benchmark.use({ launchOptions: chromiumExecutable ? { executablePath: chromiumExecutable } : {} })

/**
* Scroll-path pacing for a long Markdown session.
*
* The cold tail settle re-reads every mounted row's `offsetHeight` on each scroll event while it is
* still pending, so these two scenarios bracket that gate: one scrolls as soon as the timeline
* mounts, the other waits until the settle finished and the gate is unreachable. Metrics are
* reported for before/after comparison only; no timing or frame-rate threshold is asserted.
* The two scenarios bracket the cold tail settle: one scrolls as soon as the timeline mounts,
* the other waits until the settle finished. Metrics are reported for before/after comparison
* only; no timing or frame-rate threshold is asserted.
*/
benchmark.describe("performance: session timeline scrolling", () => {
benchmark("scrolls a long session from the cold tail", async ({ page, report }) => {
Expand All @@ -42,9 +35,17 @@ benchmark.describe("performance: session timeline scrolling", () => {
async function runTimelineScrollBenchmark(page: Page, options: { waitForColdSettle: boolean }) {
const fixture = await setupTimelineBenchmark(page, { historyTurns, eventBatch: 1 })

// The settle removes the inline `visibility: hidden` from the virtual content once the cold
// tail finished; the second scenario starts only after that gate is gone.
if (options.waitForColdSettle)
await expect
.poll(() => fixture.scroller.evaluate(coldPending), { timeout: 120_000, intervals: [100, 250, 500] })
.poll(
() =>
fixture.scroller.evaluate(
() => document.querySelector<HTMLElement>("[data-timeline-virtual-content]")?.style.visibility === "hidden",
),
{ timeout: 120_000, intervals: [100, 250, 500] },
)
.toBe(false)

const maxScroll = await fixture.scroller.evaluate((element) => element.scrollHeight - element.clientHeight)
Expand Down Expand Up @@ -89,24 +90,8 @@ async function runTimelineScrollBenchmark(page: Page, options: { waitForColdSett
* Assigns `scrollTop` rather than wheeling: a wheel burst makes this app navigate, which destroys
* the execution context mid-measurement. The assignment still fires a real scroll event, so the
* settle path under measurement runs unchanged.
*
* The first scroll after load makes the app reload the same route once, which also destroys the
* context. The calibration step absorbs that reload; the measured steps then run on a settled
* document.
*/
async function wheelThrough(scroller: Locator, steps: number, delta: number) {
Comment thread

@opencode-agent opencode-agent Bot Oct 10, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This retries on Execution context was destroyed because "the first scroll after load makes the app reload the same route once". If the app really reloads on the first scroll, that's a bug worth its own issue. If it's caused by how the benchmark is set up, the retry hides it and the benchmark is likely to be flaky. Either way, I don't think a benchmark should work around it silently. Can you find out what triggers the reload?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
for (let attempt = 0; ; attempt++) {
try {
return await stepThrough(scroller, steps, delta)
} catch (error) {
if (attempt >= 1 || !/Execution context was destroyed/.test(String(error))) throw error

await settleNavigation(scroller)
}
}
}

async function stepThrough(scroller: Locator, steps: number, delta: number) {
const start = await scroller.evaluate((element) => element.scrollTop)

for (let step = 0; step < steps; step++) {
Expand All @@ -129,30 +114,6 @@ const stableFrames = 3

const settleFrameBudget = 1_200

/**
* Resolves once the scroller answers two consecutive reads, which proves the document stopped
* navigating. Reads the document rather than the geometry, so a cold tail stays cold.
*/
async function settleNavigation(scroller: Locator) {
let answered = 0

await expect
.poll(
async () => {
try {
await scroller.evaluate(() => document.readyState)
answered += 1
} catch {
answered = 0
}

return answered
},
{ timeout: 60_000, intervals: [100, 250, 500] },
)
.toBeGreaterThanOrEqual(2)
}

/**
* Resolves once scrollTop repeats across consecutive frames, or once the frame budget runs out.
*
Expand All @@ -178,8 +139,3 @@ function waitForScrollToSettle(element: HTMLElement, budget: { stableFrames: num
requestAnimationFrame(sample)
})
}

/** The settle owns the row sweep until it removes the content's inline `visibility: hidden`. */
function coldPending() {
return document.querySelector<HTMLElement>("[data-timeline-virtual-content]")?.style.visibility === "hidden"
}
163 changes: 51 additions & 112 deletions 163 packages/app/e2e/performance/timeline/session-timeline-scroll-probe.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import type { Page } from "@playwright/test"

const virtualContentSelector = "[data-timeline-virtual-content]"
const pendingMarkdownSelector = '[data-component="markdown"]:not([data-markdown-ready])'
const scrollerSelector = ".scroll-view__viewport"

type TimelineScrollProbe = {
Expand All @@ -11,11 +9,6 @@ type TimelineScrollProbe = {
scrollEvents: number
scrollTopStart: number
scrollTopEnd: number
/** Frames observed while the cold tail settle was still pending, the gate that owns the offsetHeight sweep. */
coldPendingFrames: number
peakPendingMarkdown: number
offsetHeightReads: number
offsetHeightReadsWhileColdPending: number
startedAt?: number
start: () => void
stop: () => void
Expand All @@ -31,113 +24,63 @@ export type TimelineScrollMetrics = {
maxLongTaskMs: number
scrollEvents: number
scrolledPx: number
coldPendingFrameShare: number
peakPendingMarkdown: number
offsetHeightReads: number
offsetHeightReadsWhileColdPending: number
}

/**
* Records scroll-path frame pacing plus the visibility of the cold tail settle.
*
* The settle gate reads `offsetHeight` on every mounted row, so the probe counts those reads
* instead of instrumenting production code. Reads are attributed to the gate only while
* `[data-timeline-virtual-content]` still carries its inline `visibility: hidden`, which is the
* element the settle owns until it finishes.
*/
/** Records scroll-path frame pacing and long tasks across the measured scroll window. */
export async function installTimelineScrollProbe(page: Page) {
await page.evaluate(
({ virtualContentSelector, pendingMarkdownSelector, scrollerSelector }) => {
const root = [...document.querySelectorAll<HTMLElement>(scrollerSelector)].find((element) =>
element.querySelector("[data-timeline-row]"),
)

if (!root) throw new Error("timeline scroller is not mounted")

// offsetHeight is declared on HTMLElement.prototype, so the read sweep is counted there.
const offsetHeight = Object.getOwnPropertyDescriptor(HTMLElement.prototype, "offsetHeight")!
let cached: HTMLElement | undefined
const virtualContent = () => {
if (cached?.isConnected) return cached
cached = document.querySelector<HTMLElement>(virtualContentSelector) ?? undefined
return cached
}
const coldPending = () => virtualContent()?.style.visibility === "hidden"

const probe: TimelineScrollProbe = {
frames: [],
longTasks: [],
scrollEvents: 0,
scrollTopStart: 0,
scrollTopEnd: 0,
coldPendingFrames: 0,
peakPendingMarkdown: 0,
offsetHeightReads: 0,
offsetHeightReadsWhileColdPending: 0,
start: () => {
probe.startedAt = performance.now()
probe.scrollTopStart = root.scrollTop
requestAnimationFrame(frame)
},
stop: () => {
probe.startedAt = undefined
observer?.disconnect()
probe.scrollTopEnd = root.scrollTop
Object.defineProperty(HTMLElement.prototype, "offsetHeight", offsetHeight)
},
}

Object.defineProperty(HTMLElement.prototype, "offsetHeight", {
configurable: true,
get(this: HTMLElement) {
if (probe.startedAt !== undefined) {
probe.offsetHeightReads += 1
if (coldPending()) probe.offsetHeightReadsWhileColdPending += 1
}

return offsetHeight.get!.call(this)
},
})

const observer = PerformanceObserver.supportedEntryTypes.includes("longtask")
? new PerformanceObserver((list) => {
probe.longTasks.push(
...list.getEntries().map((entry) => ({ startTime: entry.startTime, duration: entry.duration })),
)
})
: undefined

observer?.observe({ type: "longtask" })

function frame(time: number) {
if (probe.startedAt === undefined) return
await page.evaluate((selector) => {
const root = [...document.querySelectorAll<HTMLElement>(selector)].find((element) =>
element.querySelector("[data-timeline-row]"),
)

if (!root) throw new Error("timeline scroller is not mounted")

const probe: TimelineScrollProbe = {
frames: [],
longTasks: [],
scrollEvents: 0,
scrollTopStart: 0,
scrollTopEnd: 0,
start: () => {
probe.startedAt = performance.now()
probe.scrollTopStart = root.scrollTop
requestAnimationFrame(frame)
},
stop: () => {
probe.startedAt = undefined
observer?.disconnect()
probe.scrollTopEnd = root.scrollTop
},
}

probe.frames.push(time)
if (coldPending()) probe.coldPendingFrames += 1
// Pending markdown is sampled sparsely on purpose: a per-frame query would add the very
// layout work this probe exists to observe.
if (probe.frames.length % 15 === 0)
probe.peakPendingMarkdown = Math.max(
probe.peakPendingMarkdown,
virtualContent()?.querySelectorAll(pendingMarkdownSelector).length ?? 0,
const observer = PerformanceObserver.supportedEntryTypes.includes("longtask")
? new PerformanceObserver((list) => {
probe.longTasks.push(
...list.getEntries().map((entry) => ({ startTime: entry.startTime, duration: entry.duration })),
)
})
: undefined

requestAnimationFrame(frame)
}

root.addEventListener(
"scroll",
() => {
if (probe.startedAt === undefined) return
probe.scrollEvents += 1
},
{ passive: true },
)

;(window as Window & { __timelineScrollProbe?: TimelineScrollProbe }).__timelineScrollProbe = probe
},
{ virtualContentSelector, pendingMarkdownSelector, scrollerSelector },
)
observer?.observe({ type: "longtask" })

function frame(time: number) {
if (probe.startedAt === undefined) return

probe.frames.push(time)
requestAnimationFrame(frame)
}

root.addEventListener(
"scroll",
() => {
if (probe.startedAt === undefined) return
probe.scrollEvents += 1
},
{ passive: true },
)

;(window as Window & { __timelineScrollProbe?: TimelineScrollProbe }).__timelineScrollProbe = probe
}, scrollerSelector)
}

export async function startTimelineScrollProbe(page: Page) {
Expand Down Expand Up @@ -168,10 +111,6 @@ export async function collectTimelineScrollMetrics(page: Page): Promise<Timeline
maxLongTaskMs: longTasks.length === 0 ? 0 : Math.max(...longTasks.map((entry) => entry.duration)),
scrollEvents: probe.scrollEvents,
scrolledPx: Math.abs(probe.scrollTopEnd - probe.scrollTopStart),
coldPendingFrameShare: frames.length === 0 ? 0 : probe.coldPendingFrames / frames.length,
peakPendingMarkdown: probe.peakPendingMarkdown,
offsetHeightReads: probe.offsetHeightReads,
offsetHeightReadsWhileColdPending: probe.offsetHeightReadsWhileColdPending,
}

function median(values: number[]) {
Expand Down
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.