Skip to content

Commit 5e5bd4a

Browse files
npub17jjz49l9jjmhhk7cac63j8yt9z555n9cw8vk7v5jz4vzw4ppld5qgj57ccTyler Longwell
andcommitted
test(desktop): impl-agnostic readiness wait + bite-set max-px co-gate
The >50 mounted [data-message-id] readiness wait baked in an un-virtualized-DOM assumption: it only passes when the impl mounts every visible-band row at once, so a real virtualizer (which windows the mount set below 50 by design) times out and never yields a number — the exact impl-coupling this fixture's rekey exists to remove. Replace it with the signal any timeline exposes once loaded: the scroll container overflows its client box by a wide multiple (corpus ingested, whether it mounts 12 rows or 500) AND >=1 message row present (sampler needs a live anchor). Zero per-impl branches. Add the post-momentum-bite-set restricted max-px print (Dawn's co-gate): the discriminator is bite count AND bite max-px both down, not count alone — a candidate could drop count while leaving survivors larger (fewer, more violent snaps). Global max spans all reversals; this is the max snap within the bite set the discriminator counts. Both engines reproduce the survivor class on the patched fixture: chromium 22 reversals / all tracking-failure / aboveΔ=0 / 21 still-frame / bite 21 @ 60px; webkit 19 / all tracking-failure / aboveΔ=0 / 19 still-frame / bite 19 @ 60px. Co-authored-by: Tyler Longwell <[email protected]> Signed-off-by: Tyler Longwell <[email protected]>
1 parent 04a7e28 commit 5e5bd4a

1 file changed

Lines changed: 43 additions & 5 deletions

File tree

‎desktop/tests/e2e/upscroll-portable-classify.perf.ts‎

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,11 @@ import { installMockBridge } from "../helpers/bridge";
4646
* column on WebKit, that's the headline.
4747
*
4848
* VERDICT COLUMNS (per engine): reversal count, max reversal px, still-frame
49-
* count (|dScroll| < REVERSAL_PX — the felt case, eye barely moving), and the
50-
* reflow-driven / tracking-failure split. Same numbers for every impl.
49+
* count (|dScroll| < REVERSAL_PX — the felt case, eye barely moving), the
50+
* reflow-driven / tracking-failure split, the mid-momentum one-way regression
51+
* guard, and the post-momentum bite count + its restricted max-px (THE
52+
* discriminator, co-gated: pass = bite count AND bite max-px both down). Same
53+
* numbers for every impl.
5154
*
5255
* HONESTY BOUND (carried from the W4a fixture): Playwright `mouse.wheel` is a
5356
* synthetic discrete event; the real WKWebView coalesced-momentum still frame
@@ -137,12 +140,33 @@ test("PORTABLE upscroll classify: reflow-driven vs tracking-failure reversals",
137140
}
138141
}, SEED_ROWS);
139142

140-
await page.waitForFunction(() => {
143+
// Impl-agnostic readiness. The OLD wait ("> 50 mounted [data-message-id]")
144+
// baked in an un-virtualized-DOM assumption: it only passes when the impl
145+
// mounts every visible-band row into the DOM at once. A real virtualizer
146+
// WINDOWS the mount set below 50 by design (that is the whole point), so the
147+
// wait times out on a correct candidate and never yields a perf number — the
148+
// exact impl-coupling this fixture's rekey exists to remove. Replace it with
149+
// the signal ANY timeline exposes once its corpus is loaded and scrollable:
150+
// (1) the scroll container overflows its own client box by a wide margin —
151+
// 500 heterogeneous rows produce many screens of content, so a scroll
152+
// container whose scrollHeight is a large multiple of its clientHeight
153+
// has clearly ingested the corpus, whether it mounts 12 rows or 500. A
154+
// generous multiple (not a fixed px total) keeps this height-estimator
155+
// neutral: a windowed impl reports its FULL estimated scrollHeight even
156+
// while mounting a fraction of the rows.
157+
// (2) at least one message row is present — the sampler needs a live anchor.
158+
// Zero per-impl branches: both conditions read only DOM every timeline exposes.
159+
const MIN_OVERFLOW_RATIO = 8; // scrollHeight must exceed clientHeight by >=8x
160+
await page.waitForFunction((minRatio) => {
141161
const el = document.querySelector(
142162
'[data-testid="message-timeline"]',
143163
) as HTMLDivElement | null;
144-
return !!el && el.querySelectorAll("[data-message-id]").length > 50;
145-
});
164+
if (!el) return false;
165+
const overflows =
166+
el.clientHeight > 0 && el.scrollHeight >= el.clientHeight * minRatio;
167+
const hasRow = el.querySelectorAll("[data-message-id]").length >= 1;
168+
return overflows && hasRow;
169+
}, MIN_OVERFLOW_RATIO);
146170
await page.waitForTimeout(500); // let live emits settle
147171

148172
await timeline.evaluate((element) => {
@@ -323,6 +347,17 @@ test("PORTABLE upscroll classify: reflow-driven vs tracking-failure reversals",
323347
Math.abs(r.dScroll) < REVERSAL_PX &&
324348
hadRecentMomentum(r.i),
325349
);
350+
// Restricted max px — Dawn's co-gate (thread evt 04a7e28b response). The
351+
// discriminator is bite COUNT *and* bite MAX-PX both down, not count alone: a
352+
// candidate could drop bite count while leaving the survivors larger (fewer,
353+
// more violent snaps — worse felt), and count-only would score that a win.
354+
// The GLOBAL maxReversalPx above spans ALL reversals; this is the max snap
355+
// WITHIN the post-momentum-bite set, so the co-gate reads the felt severity of
356+
// exactly the frames the discriminator counts.
357+
const postMomentumBiteMaxPx =
358+
postMomentumBite.length === 0
359+
? 0
360+
: Math.max(...postMomentumBite.map((r) => Math.abs(r.rowMove)));
326361
const momentumFrames = (() => {
327362
let n = 0;
328363
for (let i = 1; i < frames.length; i += 1) {
@@ -359,6 +394,9 @@ test("PORTABLE upscroll classify: reflow-driven vs tracking-failure reversals",
359394
console.log(
360395
` POST-momentum bite (still-frame ≤${POST_MOMENTUM_FRAMES}f after flick): ${postMomentumBite.length} (#1662 signature — the real discriminator)`,
361396
);
397+
console.log(
398+
` └ bite-set max px (co-gate w/ count): ${postMomentumBiteMaxPx.toFixed(1)}`,
399+
);
362400
for (const r of reversals
363401
.slice()
364402
.sort((x, y) => x.rowMove - y.rowMove)

0 commit comments

Comments
 (0)