diff --git a/apps/electron-backend-e2e/src/performance/journey-renderer-probe.spec.ts b/apps/electron-backend-e2e/src/performance/journey-renderer-probe.spec.ts index 89b38ee08..105700dba 100644 --- a/apps/electron-backend-e2e/src/performance/journey-renderer-probe.spec.ts +++ b/apps/electron-backend-e2e/src/performance/journey-renderer-probe.spec.ts @@ -341,6 +341,8 @@ test('keeps summing shifts without recent input after the first-card cutoff unti [ { deltaHeight: 0, + deltaWidth: 0, + deltaX: 0, deltaY: -240, node: 'lib-dashboard-rail[data-test-id="dashboard-favorites-rail"]', }, @@ -800,9 +802,9 @@ test('drops performance entries from before the click and keeps recent-input shi hadRecentInput: true, sources: [ { - currentRect: { height: 40, y: 152 }, + currentRect: { height: 40, width: 300, x: 48, y: 152 }, node: fixture.card, - previousRect: { height: 40, y: 100 }, + previousRect: { height: 40, width: 320, x: 0, y: 100 }, }, ], startTime: now(), @@ -835,10 +837,14 @@ test('drops performance entries from before the click and keeps recent-input shi state.shifts.map((shift) => [ shift.hadRecentInput, shift.value, - shift.sources.map((source) => source.deltaY), + shift.sources.map((source) => [ + source.deltaX, + source.deltaY, + source.deltaWidth, + ]), ]), [ - [true, 0.25, [52]], + [true, 0.25, [[48, 52, -20]]], [false, 0.125, []], ] ); diff --git a/apps/electron-backend-e2e/src/performance/journey-renderer-probe.test-helpers.ts b/apps/electron-backend-e2e/src/performance/journey-renderer-probe.test-helpers.ts index 799aeeb48..3fcf9142f 100644 --- a/apps/electron-backend-e2e/src/performance/journey-renderer-probe.test-helpers.ts +++ b/apps/electron-backend-e2e/src/performance/journey-renderer-probe.test-helpers.ts @@ -17,9 +17,9 @@ export interface FakeEntry { entryType: string; hadRecentInput?: boolean; sources?: { - currentRect: { height: number; y: number }; + currentRect: { height: number; width?: number; x?: number; y: number }; node: unknown; - previousRect: { height: number; y: number }; + previousRect: { height: number; width?: number; x?: number; y: number }; }[]; startTime: number; value?: number; diff --git a/apps/electron-backend-e2e/src/performance/journey-renderer-probe.ts b/apps/electron-backend-e2e/src/performance/journey-renderer-probe.ts index 9d8be24bd..fda0f2259 100644 --- a/apps/electron-backend-e2e/src/performance/journey-renderer-probe.ts +++ b/apps/electron-backend-e2e/src/performance/journey-renderer-probe.ts @@ -171,7 +171,7 @@ export interface JourneyRendererProbeShift { readonly hadRecentInput: boolean; /** Entry start minus the journey start (navigation start for J1). */ readonly sinceStartMs: number; - /** `tag.class[data-test-id]` and the vertical move of each source. */ + /** `tag.class[data-test-id]` and the move of each source. */ readonly sources: JourneyRendererProbeLateShift['sources']; readonly value: number; } @@ -179,9 +179,11 @@ export interface JourneyRendererProbeShift { export interface JourneyRendererProbeLateShift { /** Entry start minus the first-card terminal epoch. */ readonly afterFirstCardMs: number; - /** `tag.class[data-test-id]` and the vertical move of each source. */ + /** `tag.class[data-test-id]` and the move of each source. */ readonly sources: readonly { readonly deltaHeight: number; + readonly deltaWidth: number; + readonly deltaX: number; readonly deltaY: number; readonly node: string; }[]; @@ -558,10 +560,11 @@ export function journeyRendererProbeScript( state.idle.status = 'done'; }, idle.durationMs); }; + type ShiftRect = { height: number; width?: number; x?: number; y: number }; type LateShiftSource = { - currentRect?: { height: number; y: number }; + currentRect?: ShiftRect; node?: Node | null; - previousRect?: { height: number; y: number }; + previousRect?: ShiftRect; }; const describeSource = (source: LateShiftSource) => { const node = source.node; @@ -578,9 +581,13 @@ export function journeyRendererProbeScript( } const before = source.previousRect; const after = source.currentRect; + const delta = (key: keyof ShiftRect) => + before && after ? (after[key] ?? 0) - (before[key] ?? 0) : 0; return { - deltaHeight: before && after ? after.height - before.height : 0, - deltaY: before && after ? after.y - before.y : 0, + deltaHeight: delta('height'), + deltaWidth: delta('width'), + deltaX: delta('x'), + deltaY: delta('y'), node: label, }; }; diff --git a/apps/electron-backend-e2e/src/performance/launch-journey-record.spec.ts b/apps/electron-backend-e2e/src/performance/launch-journey-record.spec.ts index b9a6e8efe..5f10032ec 100644 --- a/apps/electron-backend-e2e/src/performance/launch-journey-record.spec.ts +++ b/apps/electron-backend-e2e/src/performance/launch-journey-record.spec.ts @@ -65,6 +65,8 @@ function measurement( sources: [ { deltaHeight: 0, + deltaWidth: 0, + deltaX: 0, deltaY: -240, node: 'section.dashboard-rail', }, @@ -211,6 +213,8 @@ test('maps the probe, IPC capture and main counters to exact counters and spawn- sources: [ { deltaHeight: 0, + deltaWidth: 0, + deltaX: 0, deltaY: -240, node: 'section.dashboard-rail', }, diff --git a/apps/electron-backend-e2e/src/performance/open-source-journey-record.spec.ts b/apps/electron-backend-e2e/src/performance/open-source-journey-record.spec.ts index ccbec6a5b..24a2fbd7d 100644 --- a/apps/electron-backend-e2e/src/performance/open-source-journey-record.spec.ts +++ b/apps/electron-backend-e2e/src/performance/open-source-journey-record.spec.ts @@ -66,6 +66,8 @@ function measurement( sources: [ { deltaHeight: 0, + deltaWidth: 0, + deltaX: 0, deltaY: 52, node: 'div.content[data-test-id="category-list"]', }, @@ -168,6 +170,8 @@ test('maps the click-started probe, IPC window and mock ledger to exact counters sources: [ { deltaHeight: 0, + deltaWidth: 0, + deltaX: 0, deltaY: 52, node: 'div.content[data-test-id="category-list"]', }, diff --git a/docs/architecture/performance-journeys.md b/docs/architecture/performance-journeys.md index d16fb4f50..bf5da2b14 100644 --- a/docs/architecture/performance-journeys.md +++ b/docs/architecture/performance-journeys.md @@ -175,8 +175,8 @@ closed or closed before the cutoff. J2's probe has no settle window most 20): the time after the first card, the value and, for each source the browser attributes the shift to, the node (`tag.class[data-test-id]`; a component host such as `lib-dashboard-rail` takes its first child's test id) -and its vertical move. A late shift can therefore be traced to its component -from the summary alone. +and its move (`deltaX`, `deltaY`, `deltaWidth`, `deltaHeight`). A late shift +can therefore be traced to its component from the summary alone. First local measurement (macOS, 2026-09-29, `master` with #1738): all windows closed on `quiet`, `renderer.layoutShiftScore` stayed 0, and @@ -719,7 +719,7 @@ strings and stream paths carry credentials and are never stored. | `renderer.ipcCallsToFirstPage` | Bridge `start` trace events between the start and end sentinels, counted by a second `journey-main-ipc-capture.ts` instance installed with `startSentinelId`. Calls before the start marker are tallied separately (`callsBeforeStart`); a start marker that is missing, repeated or received after the end sentinel fails the iteration. | | `renderer.domMutationsToFirstPage` | `MutationRecord`s from the click until the terminal batch. Records produced before the click (hover, settling) are taken from the observer at the start and counted under `evidence.settle` instead. | | `renderer.cdTicksToFirstPage` | `ApplicationRef` ticks from the click until the terminal batch: the counter's running total read in the capture-phase click listener, before the app handles the click, subtracted from its value at the terminal batch (see [Change-detection ticks](#change-detection-ticks)). | -| `renderer.layoutShiftScore` | Sum of all `layout-shift` entries from the click until the post-paint cutoff, rounded to three decimals. Unlike J1 it includes entries with `hadRecentInput === true`: the journey is a response to the click and runs inside the 500 ms input window, so the CLS filter would always read 0. The split is under `evidence.layoutShift`. | +| `renderer.layoutShiftScore` | Sum of all `layout-shift` entries from the click until the post-paint cutoff, rounded to three decimals. Unlike J1 it includes entries with `hadRecentInput === true`: the journey is a response to the click and runs inside the 500 ms input window, so the CLS filter would always read 0. The split is under `evidence.layoutShift`, and `evidence.layoutShift.shifts` lists the first 20 counted shifts with their value, `hadRecentInput`, time since the click and the nodes that moved (`tag.class[data-test-id]` and their `deltaX`, `deltaY`, `deltaWidth` and `deltaHeight`, as J1's late shifts). | | `renderer.longTasks` | `longtask` entries over 50 ms whose time range overlaps the window from the click to the cutoff. The task that dispatches the click began before the event's timestamp and still counts; buffered J1 tasks that ended before the click are dropped. Evidence until it is shown to be stable on the CI runner, as for J1. | | `main.mockHttpRequestsToSettled` | Requests the proxy received from the click until, after the terminal batch, no new request had arrived for 1 s and none was in flight (a response slower than that, and what it triggers, stays inside the window). The window ends at the ledger position read by that accepted quiet sample; a request arriving after it was never seen in flight, so it goes to `evidence.httpRequestsAfterSettledByRoute` instead of the counter. The ledger is read 1 s after that sample, so that late traffic is actually observed. The window starts at the renderer's click stamp, the same boundary as every other J2 counter, not when Playwright began its actionability checks; the proxy stamps requests with the test process's wall clock, and both processes read the same host clock. Bounding by the terminal would compare the test process's clock with the renderer's, so the count up to the terminal epoch is evidence only (`evidence.httpRequestsToFirstPage`); `evidence.httpRequestsByRoute` names the requests. |