diff --git a/app/lib/ui/adaptive/glass_pill.dart b/app/lib/ui/adaptive/glass_pill.dart index f42bfd3b..0beea5cf 100644 --- a/app/lib/ui/adaptive/glass_pill.dart +++ b/app/lib/ui/adaptive/glass_pill.dart @@ -31,7 +31,12 @@ class GlassPill extends StatelessWidget { final Color? fill; /// Blur radius of the content behind a piece. - static const double blurSigma = 16; + /// + /// Under the [fillOpacity] fill, 4 looks the same as a larger radius (the + /// content behind is already an indistinct tint) and stays on the + /// renderer's direct blur path: above about 4, Skia (CanvasKit) downscales, + /// blurs and upscales every piece on every frame content scrolls behind it. + static const double blurSigma = 4; /// How much of the fill covers the blurred content. static const double fillOpacity = 0.84; @@ -65,8 +70,10 @@ class GlassPill extends StatelessWidget { : Material(type: MaterialType.transparency, child: child), ); if (!solid) { - // One blur per piece, clipped to it. - surface = BackdropFilter( + // One blur per piece, clipped to it. Pieces under a common + // [BackdropGroup] (a bar's row) share one read of the content behind + // them where the engine supports it (Impeller) instead of one each. + surface = BackdropFilter.grouped( filter: ImageFilter.blur(sigmaX: blurSigma, sigmaY: blurSigma), child: surface, ); diff --git a/app/lib/ui/adaptive/segmented_bar.dart b/app/lib/ui/adaptive/segmented_bar.dart index 3eda670b..be5aa4a2 100644 --- a/app/lib/ui/adaptive/segmented_bar.dart +++ b/app/lib/ui/adaptive/segmented_bar.dart @@ -163,6 +163,12 @@ class _SegmentedBarState extends State { final _titleLink = LayerLink(); final _expandedTitle = OverlayPortalController(); + /// The row's pieces sit side by side, so they share one read of the + /// content behind them. The expanded title overlaps the content below the + /// bar and is drawn later, in the overlay, so it reads its own. + final _piecesBackdrop = BackdropKey(); + final _expandedTitleBackdrop = BackdropKey(); + @override void didUpdateWidget(covariant SegmentedBar oldWidget) { super.didUpdateWidget(oldWidget); @@ -269,7 +275,10 @@ class _SegmentedBarState extends State { constraints: BoxConstraints( maxWidth: titleSpace.maxWidth, ), - child: titlePill(true), + child: BackdropGroup( + backdropKey: _expandedTitleBackdrop, + child: titlePill(true), + ), ), ), ), @@ -365,7 +374,7 @@ class _SegmentedBarState extends State { ), child: MediaQuery.withClampedTextScaling( maxScaleFactor: SegmentedBar.maxTextScale, - child: bar, + child: BackdropGroup(backdropKey: _piecesBackdrop, child: bar), ), ), ), diff --git a/app/notes/perf-glass-chrome.md b/app/notes/perf-glass-chrome.md new file mode 100644 index 00000000..2c3e2643 --- /dev/null +++ b/app/notes/perf-glass-chrome.md @@ -0,0 +1,48 @@ +# Frosted-glass chrome: cheaper blurs + +Every `GlassPill` (top bar pieces, status strip, page and main tab bars, chat +composer, expanded run title) is one `BackdropFilter`. While content scrolls +behind the bars, each re-blurs it every frame. + +## Change + +- `GlassPill.blurSigma` 16 -> 4. Under the 84% fill the larger radius adds + nothing visible, but above about 4 Skia (CanvasKit) downscales, blurs and + upscales each piece every frame. +- `GlassPill` uses `BackdropFilter.grouped`; `SegmentedBar` puts its row of + pieces in one `BackdropGroup` so Impeller reads the content behind them once + instead of once per piece. The expanded title (drawn in the overlay, over + the content below the bar) gets its own key. The web renderer ignores + backdrop keys. + +## Measurement + +`tool/perf/glass_scroll_bench.mjs` over the release probe build +(`?runs=400`, `?steps=400` filler rows), 560x900, Material light. Interleaved +rounds against a `main` build because other agents loaded the machine. Medians +of 6 rounds of 4 s each, CPU CanvasKit (no WebGL): + +| scenario | blurs on screen | frame p50 | frame p90 | missed vsyncs | +| --- | --- | --- | --- | --- | +| Runs list, before | 3 | 25.3 ms | 50.0 ms | 129 | +| Runs list, after | 3 (2 reads) | 19.9 ms | 38.9 ms | 102 | +| Run timeline, before | 5 | 31.8 ms | 58.6 ms | 159 | +| Run timeline, after | 5 (3 reads) | 22.1 ms | 33.1 ms | 91 | + +Without any blur the same frames take about 10-12 ms, so blur was most of the +frame. With the M2 Pro GPU (`--gpu`) frames take about 2-3 ms before and after: +the GPU path is not blur-bound on this machine. Android (Impeller) was not +measured on a device. + +Tried and dropped: + +- Sigma 6 or 8: no measurable gain over 16 on CPU CanvasKit. +- One backdrop per bar, clipped to the union of its pieces (a custom render + object): 5 -> 3 backdrop layers on the run timeline, but no measurable gain + over per-piece blurs at sigma 4, so not worth the code. +- `RepaintBoundary` around the bars: scrolling repaints only the viewport (a + repaint boundary already), so the bars are not repainted. + +Pixels (`tool/perf/compare_shots.mjs`, before vs after at a fixed scroll, both +platforms and themes): no pixel differs by more than 13/255, and 0-0.6% differ +by more than 2/255. The differences are only inside the pieces. diff --git a/app/test/ui/adaptive/glass_backdrop_group_test.dart b/app/test/ui/adaptive/glass_backdrop_group_test.dart new file mode 100644 index 00000000..2ab396a8 --- /dev/null +++ b/app/test/ui/adaptive/glass_backdrop_group_test.dart @@ -0,0 +1,57 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/rendering.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:pipelines_app/ui/adaptive/glass_pill.dart'; +import 'package:pipelines_app/ui/adaptive/segmented_bar.dart'; + +List _keys(WidgetTester tester) => tester.layers + .whereType() + .map((layer) => layer.backdropKey) + .toList(); + +void main() { + testWidgets('a bar\'s pieces share one backdrop read; the expanded title ' + 'reads its own', (tester) async { + await tester.pumpWidget( + MaterialApp( + home: Scaffold( + extendBodyBehindAppBar: true, + appBar: SegmentedBar( + cupertino: false, + title: 'Release train run', + subtitle: 'Run 7', + expandableTitle: true, + leading: const BackButton(), + actions: [ + IconButton(icon: const Icon(Icons.more_vert), onPressed: () {}), + ], + ), + body: const SizedBox.expand(), + ), + ), + ); + + final pieces = _keys(tester); + expect(pieces, hasLength(3)); + final shared = pieces.first; + expect(shared, isNotNull); + expect(pieces, everyElement(same(shared))); + + await tester.tap(find.text('Release train run')); + await tester.pumpAndSettle(); + final keys = _keys(tester); + expect(keys, hasLength(4)); + final expanded = keys.where((k) => !identical(k, shared)).toList(); + expect(expanded, hasLength(1)); + expect(expanded.single, isNotNull); + }); + + testWidgets('a lone piece reads the backdrop on its own', (tester) async { + await tester.pumpWidget( + const MaterialApp( + home: Center(child: GlassPill(cupertino: false, child: Text('Tabs'))), + ), + ); + expect(_keys(tester), [isNull]); + }); +} diff --git a/app/tool/perf/backdrop_census.dart b/app/tool/perf/backdrop_census.dart new file mode 100644 index 00000000..846433b8 --- /dev/null +++ b/app/tool/perf/backdrop_census.dart @@ -0,0 +1,48 @@ +// A page-side census of the backdrop blurs on screen, for the glass scroll +// bench (tool/perf/glass_scroll_bench.mjs): `window.__backdropCensus()` +// returns `{ blurs, reads }`: the backdrop filter layers in the current scene +// (offstage routes are not in it), and how many reads of the content behind +// they take where the engine shares a `BackdropGroup`'s read (Impeller; the +// web renderer ignores the grouping and reads once per blur). +import 'dart:js_interop'; + +import 'package:flutter/rendering.dart'; + +@JS('__backdropCensus') +external set _backdropCensus(JSFunction census); + +void installBackdropCensus() { + _backdropCensus = (() { + var blurs = 0; + var ungrouped = 0; + final keys = {}; + void visit(Layer layer) { + if (layer is BackdropFilterLayer) { + blurs++; + final key = layer.backdropKey; + if (key == null) { + ungrouped++; + } else { + keys.add(key); + } + } + if (layer is ContainerLayer) { + for ( + var child = layer.firstChild; + child != null; + child = child.nextSibling + ) { + visit(child); + } + } + } + + for (final view in RendererBinding.instance.renderViews) { + // The scene's root layer. + // ignore: invalid_use_of_protected_member + final root = view.layer; + if (root != null) visit(root); + } + return {'blurs': blurs, 'reads': ungrouped + keys.length}.jsify(); + }).toJS; +} diff --git a/app/tool/perf/compare_shots.mjs b/app/tool/perf/compare_shots.mjs new file mode 100644 index 00000000..181061f6 --- /dev/null +++ b/app/tool/perf/compare_shots.mjs @@ -0,0 +1,54 @@ +#!/usr/bin/env node +// Pixel comparison of two same-sized screenshots, decoded in headless Chrome +// (no npm packages): +// +// node tool/perf/compare_shots.mjs before.png after.png [diff.png] +// +// Prints the share of pixels that differ (any channel > 2/255 and > 16/255), +// the mean and maximum channel difference, and per 60px horizontal band the +// mean difference, so a change confined to the bars shows where it is. With a +// third path it writes a diff image (differences amplified 8x). +import { readFile, writeFile } from 'node:fs/promises'; +import { openBrowser } from '../capture/browser.mjs'; + +const [a, b, out] = process.argv.slice(2); +if (!a || !b) throw new Error('usage: compare_shots.mjs [diff.png]'); +const browser = await openBrowser(); +try { + const url = (buf) => `data:image/png;base64,${buf.toString('base64')}`; + const expression = `(async () => { + const load = (src) => new Promise((ok, fail) => { const i = new Image(); i.onload = () => ok(i); i.onerror = fail; i.src = src; }); + const [ia, ib] = await Promise.all([load(${JSON.stringify(url(await readFile(a)))}), load(${JSON.stringify(url(await readFile(b)))})]); + if (ia.width !== ib.width || ia.height !== ib.height) return { error: 'size mismatch' }; + const w = ia.width, h = ia.height; + const px = (img) => { const c = new OffscreenCanvas(w, h); const g = c.getContext('2d'); g.drawImage(img, 0, 0); return g.getImageData(0, 0, w, h).data; }; + const da = px(ia), db = px(ib); + const diff = new OffscreenCanvas(w, h); const dg = diff.getContext('2d'); const dd = dg.createImageData(w, h); + let over2 = 0, over16 = 0, sum = 0, max = 0; + const bands = new Array(Math.ceil(h / 60)).fill(0); + for (let i = 0; i < w * h; i++) { + let m = 0; + for (let k = 0; k < 3; k++) { const d = Math.abs(da[i * 4 + k] - db[i * 4 + k]); m = Math.max(m, d); sum += d; dd.data[i * 4 + k] = Math.min(255, d * 8); } + dd.data[i * 4 + 3] = 255; + if (m > 2) over2++; if (m > 16) over16++; max = Math.max(max, m); + bands[Math.floor(i / w / 60)] += m; + } + dg.putImageData(dd, 0, 0); + const blob = await diff.convertToBlob({ type: 'image/png' }); + const bytes = new Uint8Array(await blob.arrayBuffer()); + let bin = ''; for (const x of bytes) bin += String.fromCharCode(x); + const r = (x) => Math.round(x * 1000) / 1000; + return { pixels: w * h, over2: r(over2 / (w * h)), over16: r(over16 / (w * h)), mean: r(sum / (w * h * 3)), max, + bands: bands.map((s, i) => r(s / (w * Math.min(60, h - i * 60)))), diff: btoa(bin) }; + })()`; + const page = await browser.newPage(); + const res = await page.send('Runtime.evaluate', { expression, returnByValue: true, awaitPromise: true }); + await page.close(); + const v = res.result.value; + if (!v || v.error) throw new Error(v?.error ?? JSON.stringify(res.exceptionDetails ?? res)); + if (out) await writeFile(out, Buffer.from(v.diff, 'base64')); + delete v.diff; + console.log(JSON.stringify(v)); +} finally { + await browser.close(); +} diff --git a/app/tool/perf/glass_scroll_bench.mjs b/app/tool/perf/glass_scroll_bench.mjs new file mode 100644 index 00000000..5cd17a8f --- /dev/null +++ b/app/tool/perf/glass_scroll_bench.mjs @@ -0,0 +1,187 @@ +#!/usr/bin/env node +// Frame-time bench: scrolls a long list behind the frosted bars of the +// full-app fixture (tool/search_selection_probe_entry.dart) and reports the +// browser's frame cadence. +// +// node tool/perf/glass_scroll_bench.mjs --build build/probe-app \ +// --out /tmp/perf-glass/before [--gpu] [--size 560x900] [--seconds 6] \ +// [--repeat 3] [--platform material|cupertino] [--theme light|dark] \ +// [--shots] [--only runs-list|run-timeline] [--flags=""] +// +// Per scenario (the Runs list: 3 glass pieces; a run's Timeline tab: 5) it +// opens the route, wheels the list one notch per animation frame for +// --seconds, and records Flutter's frames: the interval between them, the +// main-thread time each takes (build, layout, paint and rasterisation, up to +// the next task) and how many 60 Hz vsyncs the intervals would miss. Chrome +// runs with vsync and its frame-rate limit off, so an interval is a frame's +// cost rather than a display tick. Without --gpu there is no WebGL and +// CanvasKit rasterises on the CPU, where the blur cost shows (a proxy for a +// weak GPU); with --gpu a desktop GPU usually hides it. It writes a +// screenshot per scenario and `bench-*.json`, and prints the backdrop census +// (tool/perf/backdrop_census.dart). --shots skips timing and writes a still at +// a fixed scroll offset per scenario, for comparing the bars' pixels with +// tool/perf/compare_shots.mjs. +import { spawn } from 'node:child_process'; +import { mkdir, mkdtemp, rm, writeFile } from 'node:fs/promises'; +import { tmpdir } from 'node:os'; +import { join } from 'node:path'; +import { parseArgs } from 'node:util'; +import { setTimeout as delay } from 'node:timers/promises'; +import { openBrowser } from '../capture/browser.mjs'; +import { serveBuild } from '../capture/serve.mjs'; + +const { values: opts } = parseArgs({ + options: { + build: { type: 'string' }, out: { type: 'string' }, gpu: { type: 'boolean' }, + size: { type: 'string', default: '560x900' }, seconds: { type: 'string', default: '6' }, + repeat: { type: 'string', default: '3' }, platform: { type: 'string', default: 'material' }, + theme: { type: 'string', default: 'light' }, only: { type: 'string' }, + flags: { type: 'string', default: '' }, shots: { type: 'boolean' }, + }, +}); +if (!opts.build || !opts.out) throw new Error('usage: --build --out [--gpu]'); +const [width, height] = opts.size.split('x').map(Number); + +// Scenario: an app route plus the filler rows that make it long. +const SCENARIOS = [ + { name: 'runs-list', route: '/runs', extra: { runs: '400' } }, + // The Timeline tab (second page tab, Material layout at 560 wide). + { name: 'run-timeline', route: '/runs/7', extra: { steps: '400' }, click: [396, 853] }, +]; + +// Installed before the app starts. Flutter's own animation-frame callbacks +// are timed (main-thread frame work); the driver wheels the list from the +// page itself, one notch per frame, and notes each frame's timestamp, so the +// cadence is the browser's and not a DevTools round trip. +const RECORDER = `(() => { + const raf = window.requestAnimationFrame.bind(window); + const rec = { on: false, work: [], starts: [], ticks: [] }; + window.__bench = rec; + // Flutter rasterises after its frame callback returns (in microtasks), so a + // frame's work runs until a message posted at the callback's end arrives. + const channel = new MessageChannel(); + const pending = []; + channel.port1.onmessage = () => { const t0 = pending.shift(); if (rec.on) rec.work.push(performance.now() - t0); }; + window.requestAnimationFrame = (cb) => raf((ts) => { + const t0 = performance.now(); + if (rec.on) rec.starts.push(t0); + try { cb(ts); } finally { pending.push(t0); channel.port2.postMessage(0); } + }); + rec.drive = (ms, x, y, dy) => new Promise((done) => { + rec.work = []; rec.starts = []; rec.ticks = []; rec.on = true; + const end = performance.now() + ms; + const tick = (ts) => { + rec.ticks.push(ts); + if (ts > end) { rec.on = false; return done({ ticks: rec.ticks, work: rec.work, starts: rec.starts }); } + const target = document.elementFromPoint(x, y); + target.dispatchEvent(new WheelEvent('wheel', { deltaY: dy, deltaMode: 0, clientX: x, clientY: y, + screenX: x, screenY: y, bubbles: true, cancelable: true, composed: true })); + raf(tick); + }; + raf(tick); + }); +})();`; + +async function launchChrome() { + const profile = await mkdtemp(join(tmpdir(), 'pipelines-bench-chrome-')); + const args = ['--headless=new', '--no-first-run', '--no-default-browser-check', '--hide-scrollbars', + '--mute-audio', '--disable-frame-rate-limit', '--disable-gpu-vsync', + '--disable-renderer-backgrounding', '--disable-background-timer-throttling', + '--remote-debugging-port=0', `--user-data-dir=${profile}`, 'about:blank']; + if (!opts.gpu) args.splice(3, 0, '--disable-gpu'); + args.splice(3, 0, ...opts.flags.split(' ').filter(Boolean)); + const chrome = spawn(process.env.CHROME_PATH ?? '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', + args, { stdio: ['ignore', 'ignore', 'pipe'] }); + let stderr = ''; + chrome.stderr.on('data', (d) => { stderr += d; }); + for (let i = 0; i < 150 && !/DevTools listening on ws:\/\/127\.0\.0\.1:(\d+)/.test(stderr); i++) await delay(100); + const port = stderr.match(/DevTools listening on ws:\/\/127\.0\.0\.1:(\d+)/)?.[1]; + const close = async () => { chrome.kill('SIGKILL'); await rm(profile, { recursive: true, force: true }).catch(() => {}); }; + if (!port) { await close(); throw new Error(`Chrome did not start: ${stderr.slice(-500)}`); } + return { cdp: `http://127.0.0.1:${port}`, close }; +} + +const pct = (sorted, p) => sorted[Math.min(sorted.length - 1, Math.floor(p * sorted.length))]; +function summarise({ ticks, work, starts }) { + const intervals = ticks.slice(1).map((t, i) => t - ticks[i]).sort((a, b) => a - b); + const seconds = (ticks.at(-1) - ticks[0]) / 1000; + const flutterIntervals = starts.slice(1).map((t, i) => t - starts[i]).sort((a, b) => a - b); + work = [...work].sort((a, b) => a - b); + const r = (x) => Math.round(x * 100) / 100; + const stats = (xs) => ({ p50: r(pct(xs, 0.5)), p90: r(pct(xs, 0.9)), p99: r(pct(xs, 0.99)) }); + return { + frames: ticks.length, + interval: stats(intervals), + work: stats(work), + flutterFrames: starts.length, + flutterFps: r(starts.length / seconds), + flutterInterval: stats(flutterIntervals), + // Each extra vsync an interval spans is one dropped frame. + dropped: intervals.reduce((n, d) => n + Math.max(0, Math.round(d / 16.67) - 1), 0), + }; +} + +await mkdir(opts.out, { recursive: true }); +const server = await serveBuild(opts.build); +const chrome = await launchChrome(); +const browser = await openBrowser({ cdp: chrome.cdp }); +const { send } = browser; +const evaluate = async (expression) => (await send('Runtime.evaluate', { expression, returnByValue: true, awaitPromise: true })).result.value; +const results = { build: opts.build, gpu: Boolean(opts.gpu), size: opts.size, platform: opts.platform, theme: opts.theme, scenarios: {} }; +try { + await send('Page.enable'); + await send('Runtime.enable'); + await send('Page.bringToFront'); + await send('Page.addScriptToEvaluateOnNewDocument', { source: RECORDER }); + await send('Emulation.setDeviceMetricsOverride', { width, height, deviceScaleFactor: 1, mobile: false }); + await send('Emulation.setEmulatedMedia', { features: [{ name: 'prefers-color-scheme', value: opts.theme }] }); + results.renderer = await evaluate(`(() => { const gl = document.createElement('canvas').getContext('webgl2'); + return gl ? gl.getParameter(gl.getExtension('WEBGL_debug_renderer_info').UNMASKED_RENDERER_WEBGL) : 'none (CPU)'; })()`); + console.log('renderer:', results.renderer); + for (const s of SCENARIOS.filter((s) => !opts.only || s.name === opts.only)) { + const runs = []; + for (let rep = 0; rep < Number(opts.repeat); rep++) { + const url = new URL('/', server.origin); + url.searchParams.set('route', s.route); + url.searchParams.set('platform', opts.platform); + url.searchParams.set('theme', opts.theme); + for (const [k, v] of Object.entries(s.extra)) url.searchParams.set(k, v); + await send('Page.navigate', { url: url.href }); + for (let i = 0; i < 300 && !(await evaluate("Boolean(document.querySelector('flt-glass-pane'))")); i++) await delay(100); + await delay(2500); + const x = width / 2; + const y = height / 2; + if (s.click) { + for (const type of ['mouseMoved', 'mousePressed', 'mouseReleased']) { + await send('Input.dispatchMouseEvent', { type, x: s.click[0], y: s.click[1], button: 'left', clickCount: 1 }); + } + await delay(1500); + } + await send('Input.dispatchMouseEvent', { type: 'mouseMoved', x, y }); + await delay(300); + const census = await evaluate('window.__backdropCensus?.()'); + if (rep === 0) console.log(`${s.name} backdrops on screen:`, JSON.stringify(census)); + if (opts.shots) { + // A still at a fixed scroll offset, for before/after comparison. + await send('Input.dispatchMouseEvent', { type: 'mouseWheel', x, y, deltaX: 0, deltaY: 250 }); + await send('Input.dispatchMouseEvent', { type: 'mouseMoved', x: 1, y: height / 2 }); + await delay(1500); + const still = (await send('Page.captureScreenshot', { format: 'png' })).data; + await writeFile(join(opts.out, `${s.name}-${opts.platform}-${opts.theme}-still.png`), Buffer.from(still, 'base64')); + break; + } + const frames = await evaluate(`window.__bench.drive(${Number(opts.seconds) * 1000}, ${x}, ${y}, 6)`); + runs.push({ ...summarise(frames), census }); + await delay(500); + const shot = rep === 0 ? (await send('Page.captureScreenshot', { format: 'png' })).data : null; + if (shot) await writeFile(join(opts.out, `${s.name}-${opts.platform}-${opts.theme}.png`), Buffer.from(shot, 'base64')); + } + results.scenarios[s.name] = runs; + console.log(s.name, JSON.stringify(runs)); + } + if (!opts.shots) await writeFile(join(opts.out, `bench-${opts.gpu ? 'gpu' : 'sw'}-${opts.platform}-${opts.theme}.json`), JSON.stringify(results, null, 2)); +} finally { + await browser.close().catch(() => {}); + await chrome.close(); + await server.close(); +} diff --git a/app/tool/search_selection_probe_entry.dart b/app/tool/search_selection_probe_entry.dart index b786b9aa..1a03bbc9 100644 --- a/app/tool/search_selection_probe_entry.dart +++ b/app/tool/search_selection_probe_entry.dart @@ -27,6 +27,7 @@ import 'package:flutter/widgets.dart'; import 'package:web/web.dart' as web; import 'package:web_socket_channel/web_socket_channel.dart'; +import 'perf/backdrop_census.dart'; import 'probe_folder_fixture.dart'; /// The run every run-scoped hit names. Its recorded sequences are deliberately @@ -79,9 +80,42 @@ JsonMap probeRunDetail() => { 'started_at': '2026-10-20T08:12:00Z', 'finished_at': '2026-10-20T08:14:00Z', }, + ..._fillerSteps(), ], }; +/// Extra rows for scroll-performance captures (`?runs=N`, `?steps=N`). Both +/// default to none, so every other capture sees the fixture unchanged. +int _fillerRunCount = 0; +int _fillerStepCount = 0; + +List _fillerSteps() => [ + for (var i = 0; i < _fillerStepCount; i++) + { + 'stage': i.isEven ? 'build' : 'plan', + 'sequence': 100 + i, + 'status': 'completed', + 'outcome': 'success', + 'target': i.isEven ? 'plan' : 'build', + 'started_at': '2026-10-20T08:32:00Z', + 'finished_at': '2026-10-20T08:33:00Z', + 'diagnostic': 'filler step $i for scroll captures', + }, +]; + +List _fillerRuns() => [ + for (var i = 0; i < _fillerRunCount; i++) + { + 'id': 1000 + i, + 'title': 'Filler run $i for scroll captures', + 'name': 'filler-$i', + 'status': i % 3 == 0 ? 'failed' : 'succeeded', + 'created_at': '2026-10-18T08:12:00Z', + 'finished_at': '2026-10-18T08:42:00Z', + 'pipeline_id': i.isEven ? 24 : 22, + }, +]; + List probeRuns() => [ { 'id': 7, @@ -101,6 +135,7 @@ List probeRuns() => [ 'finished_at': '2026-10-19T22:03:00Z', 'pipeline_id': 22, }, + ..._fillerRuns(), ]; List probePipelines() => [ @@ -480,6 +515,8 @@ class _FixtureSink implements WebSocketSink { /// fallback for `/runs/7`) can still open a deep location: /// /// `?route=/runs/7/stage/build%3Fvisit%3D1` opens that app location; +/// `?runs=200` / `?steps=60` append filler runs / run-7 steps for scroll +/// performance captures; /// `?q=release` types that query into Search once its field is shown; /// `?platform=cupertino` renders the Cupertino host (`material`, the /// default, renders Material as browsers do); @@ -489,6 +526,9 @@ class _FixtureSink implements WebSocketSink { /// app/tool/capture/ drives this entry generically; see its README. void main() { final params = Uri.base.queryParameters; + installBackdropCensus(); + _fillerRunCount = int.tryParse(params['runs'] ?? '') ?? 0; + _fillerStepCount = int.tryParse(params['steps'] ?? '') ?? 0; final cupertino = params['platform'] == 'cupertino'; final route = params['route']; if (route != null && route.startsWith('/')) {