@decocms/parity 0.35.30 → 0.35.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/cli.js +799 -11
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -9,6 +9,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
9
9
 
10
10
  ### Added
11
11
 
12
+ * **`first-viewport-ssr` check (html module)** answers "is what the user sees in the first viewport
13
+ already in the server response, or does it arrive later?". A deferred header (a skeleton in the
14
+ server HTML that client JS fills in) passed `ssr-no-js` (the rest of the page carried the text)
15
+ and `lazy-section-presence` (the final DOM has the section on both sides). `capturePage` now
16
+ compares, per top-level section, the final DOM with the navigation response's raw HTML (text,
17
+ links, images, form fields; `<script>` payloads never count), matched by manifest key / landmark.
18
+ Cand defers a first-viewport section prod server-renders: `high`. Both sides defer it: `medium`
19
+ `first-viewport:improve:*`, worded as an improvement and left to the owner's `as-is` / `upgrade`
20
+ call; no cap, never critical. A localhost cand whose every judged section is deferred (the page
21
+ rendered client-side) is inconclusive. New optional `PageCapture.firstViewport`; older
22
+ recordings and `--golden` files parse unchanged and judge inconclusive. Tolerances in
23
+ `TOLERANCES.firstViewportSsr`.
24
+ * **`click-blocker-parity` check (visual module)** answers "can the user click the page on the
25
+ candidate where they can on prod?". `capturePage` now samples a 5x5 grid of viewport points
26
+ with `elementFromPoint` (one `page.evaluate`, at first-visit state, before the autoscroll and
27
+ before any consent dismissal) and records the overlay each hit belongs to, whether it paints,
28
+ and what sits beneath it. An overlay that swallows clicks on cand only is `high` when it paints
29
+ nothing (a transparent layer is invisible to every pixel check), and also `high` when it is a
30
+ visible modal or scrim blocking at least half the grid (`visibleBlockHighShare`); `medium` below. New optional `PageCapture.clickProbe`; older recordings and `--golden` files
31
+ parse unchanged and judge inconclusive for this check. Tolerances in `TOLERANCES.clickProbe`.
12
32
  * **`parity run --record <dir>`** saves the exact input the checks ran on (captures with
13
33
  html, resolved config, visual probes, screenshots incl. the prod noise-floor frame, and the
14
34
  fetches the checks made) as a versioned recording, the input a later replay needs. The run's
package/dist/cli.js CHANGED
@@ -76806,6 +76806,70 @@ var TOLERANCES = {
76806
76806
  note: "A page-height difference at or above this is `high`: a block of content is missing or extra."
76807
76807
  }
76808
76808
  },
76809
+ clickProbe: {
76810
+ gridCols: {
76811
+ value: 5,
76812
+ unit: "count",
76813
+ basis: "assumed",
76814
+ note: "Columns of the click-probe grid, sampled at the centres of equal cells (x = 10/30/50/70/90% of the viewport). 5x5 = 25 points: enough that a banner strip or a centred modal shows up as several points, few enough that one `elementsFromPoint` pass costs milliseconds. Not calibrated against real storefronts."
76815
+ },
76816
+ gridRows: {
76817
+ value: 5,
76818
+ unit: "count",
76819
+ basis: "assumed",
76820
+ note: "Rows of the click-probe grid (y = 10/30/50/70/90% of the viewport). Same reasoning as gridCols. The grid is part of what a recording stores, so changing it makes older recordings inconclusive for this check (point counts differ), not wrong."
76821
+ },
76822
+ overlayMinCoverage: {
76823
+ value: 0.5,
76824
+ unit: "ratio (0-1)",
76825
+ basis: "assumed",
76826
+ note: "An overlay counts as page-blocking at a point when its box covers at least this share of the viewport. A sticky header, a chat bubble or a back-to-top button covers a few percent; a backdrop, a drawer scrim or a full-screen wrapper covers most of it. A half-viewport side drawer sits right on the line, on purpose."
76827
+ },
76828
+ blockedShareMin: {
76829
+ value: 0.2,
76830
+ unit: "ratio (0-1)",
76831
+ basis: "assumed",
76832
+ note: "Share of grid points newly blocked on cand (not blocked on prod) at which click-blocker-parity files a finding: 5 of 25. Below it the difference is a thin strip (an edge-hugging bar a few px taller), which the grid cannot tell from sampling noise."
76833
+ },
76834
+ visibleBlockHighShare: {
76835
+ value: 0.5,
76836
+ unit: "ratio (0-1)",
76837
+ basis: "assumed",
76838
+ note: "Share of grid points newly blocked on cand by a VISIBLE overlay at which click-blocker-parity files high instead of medium. At a majority of the viewport the page is unusable until the overlay is dismissed, and prod does not ask for that; the probe cannot verify the overlay offers a way to dismiss it (a confirm button can itself be nearly illegible), so 'the user can close it' is not assumed. Below it, down to blockedShareMin, the finding stays medium."
76839
+ },
76840
+ paintAlpha: {
76841
+ value: 0.05,
76842
+ unit: "alpha (0-1)",
76843
+ basis: "assumed",
76844
+ note: "A background, border or `::backdrop` colour with alpha below this, or an element chain whose opacity multiplies down below it, is treated as painting nothing. Matches 'nearly invisible' (a confirm button at opacity 0.02) without calling a faint tint invisible. Baked into the recorded `paints` flag, so changing it applies to new captures only."
76845
+ }
76846
+ },
76847
+ firstViewportSsr: {
76848
+ minViewportShare: {
76849
+ value: 0.05,
76850
+ unit: "ratio (0-1)",
76851
+ basis: "assumed",
76852
+ note: "A section counts as 'in the first viewport' for first-viewport-ssr only when it covers at least this share of the viewport area (a full-width band about 65 px tall on a 900 px viewport). Below it the section merely pokes in: a cart count, a thin promo strip, a sliver of the next block. Bottom-anchored fixed layers (consent bar, chat bubble) are dropped by the probe itself."
76853
+ },
76854
+ deferredBelow: {
76855
+ value: 0.5,
76856
+ unit: "ratio (0-1)",
76857
+ basis: "assumed",
76858
+ note: "A section is deferred when the mean, over the content kinds it has in the final DOM (text, links, images, form fields), of min(1, server count / final count) is at or below this. A skeleton keeps a logo or a wrapper link and loses the rest, so a single well-covered kind must not clear it (that is why it is a mean, not a max); a section the client merely adds to (a few more links after hydration, extra carousel slides) stays well above it. Not calibrated against real storefronts."
76859
+ },
76860
+ contentMinChars: {
76861
+ value: 20,
76862
+ unit: "chars",
76863
+ basis: "assumed",
76864
+ note: "Text counts as a content kind of a section only when its final DOM holds at least this many characters; a cart '3' or a 'Menu' label is not content. Links, images and form fields count from 1. A section with no content kind at or above the floor is not judgeable (it is empty in the final render too, which is another check's question)."
76865
+ },
76866
+ maxSections: {
76867
+ value: 40,
76868
+ unit: "count",
76869
+ basis: "assumed",
76870
+ note: "Sections recorded per page, first-viewport ones first. Bounds the size of a recording; below-the-fold sections are only kept so the other side's counterpart can be found."
76871
+ }
76872
+ },
76809
76873
  geometry: {
76810
76874
  subpixelPx: {
76811
76875
  value: 1,
@@ -78360,6 +78424,154 @@ function detailFor(prod, cand, viewport) {
78360
78424
  `);
78361
78425
  }
78362
78426
 
78427
+ // src/checks/click-blocker-parity.ts
78428
+ var MIN_COVERAGE = TOLERANCES.clickProbe.overlayMinCoverage.value;
78429
+ var MIN_SHARE = TOLERANCES.clickProbe.blockedShareMin.value;
78430
+ var HIGH_VISIBLE_SHARE = TOLERANCES.clickProbe.visibleBlockHighShare.value;
78431
+ function clickBlockerParity(ctx) {
78432
+ const start = Date.now();
78433
+ const { pairs } = pairCaptures(ctx.prodPages, ctx.candPages);
78434
+ const issues = [];
78435
+ const judged = [];
78436
+ const unjudged = [];
78437
+ for (const pair of pairs) {
78438
+ const why = unjudgeable(pair.prod.clickProbe, pair.cand.clickProbe);
78439
+ if (why) {
78440
+ unjudged.push(pair.key);
78441
+ issues.push({
78442
+ id: `click-blocker:no-probe:${pair.key}`,
78443
+ severity: "low",
78444
+ inconclusive: true,
78445
+ category: "functional",
78446
+ page: pair.key,
78447
+ check: "click-blocker-parity",
78448
+ summary: `[${pair.viewport}] ${pair.key}: click probe unavailable (${why}) — not compared by click-blocker-parity`,
78449
+ details: "Without a probe on both sides there is nothing to compare, and absence is not evidence that nothing blocks clicks. Re-capture with a current parity."
78450
+ });
78451
+ continue;
78452
+ }
78453
+ judged.push(pair.key);
78454
+ issues.push(...judgePair(pair));
78455
+ }
78456
+ const live = issues.filter((i) => !i.inconclusive);
78457
+ const compared = judged.length;
78458
+ const status = live.some((i) => i.severity === "high" || i.severity === "critical") ? "fail" : live.length > 0 ? "warn" : compared === 0 ? "skipped" : "pass";
78459
+ const summary = compared === 0 ? `nothing compared: ${pairs.length === 0 ? "no prod x cand page pairs" : `${unjudged.length} of ${pairs.length} page pair(s) had no click probe on a side`}` : `${compared} page pair(s) compared, ${live.length} click-blocking finding(s)${unjudged.length ? `, ${unjudged.length} without a probe` : ""}`;
78460
+ return {
78461
+ name: "click-blocker-parity",
78462
+ status,
78463
+ severity: "high",
78464
+ durationMs: Date.now() - start,
78465
+ summary,
78466
+ issues,
78467
+ ...unitCounts({
78468
+ unit: "page-pair",
78469
+ judged,
78470
+ unjudged,
78471
+ issues,
78472
+ informational: (i) => i.id.startsWith("click-blocker:prod-only:")
78473
+ }),
78474
+ data: { pairs: pairs.length, compared, withoutProbe: unjudged.length }
78475
+ };
78476
+ }
78477
+ function unjudgeable(prod, cand) {
78478
+ if (!prod || !cand)
78479
+ return `no probe on ${!prod && !cand ? "either side" : !prod ? "prod" : "cand"}`;
78480
+ if (prod.points.length === 0 || cand.points.length === 0)
78481
+ return "probe sampled no points";
78482
+ if (prod.points.length !== cand.points.length)
78483
+ return "grids differ between sides";
78484
+ return null;
78485
+ }
78486
+ function isBlocked(p) {
78487
+ return p.overlay !== null && p.overlay.coverage >= MIN_COVERAGE && p.pointerEvents !== "none" && p.under !== null;
78488
+ }
78489
+ function judgePair(pair) {
78490
+ const prodPts = pair.prod.clickProbe?.points ?? [];
78491
+ const candPts = pair.cand.clickProbe?.points ?? [];
78492
+ const n = candPts.length;
78493
+ const newInvisible = [];
78494
+ const newVisible = [];
78495
+ const prodOnly = [];
78496
+ candPts.forEach((c, i) => {
78497
+ const p = prodPts[i];
78498
+ if (!p)
78499
+ return;
78500
+ const cb = isBlocked(c);
78501
+ const pb = isBlocked(p);
78502
+ if (cb && !pb)
78503
+ (c.paints ? newVisible : newInvisible).push(c);
78504
+ else if (pb && !cb)
78505
+ prodOnly.push(p);
78506
+ });
78507
+ const out = [];
78508
+ const common = {
78509
+ category: "functional",
78510
+ page: pair.key,
78511
+ check: "click-blocker-parity"
78512
+ };
78513
+ const evidence = pair.cand.screenshotPath ? [{ kind: "screenshot", path: pair.cand.screenshotPath }] : undefined;
78514
+ if (newInvisible.length / n >= MIN_SHARE) {
78515
+ out.push({
78516
+ ...common,
78517
+ id: `click-blocker:invisible:${pair.key}`,
78518
+ severity: "high",
78519
+ summary: `[${pair.viewport}] cand has an invisible overlay swallowing clicks (${describeBlock(newInvisible, n)}); prod does not block those points`,
78520
+ details: `${blockDetails(newInvisible, n)} The layer paints nothing at the sampled points, so the page looks fine and does not respond. Typical cause: a drawer, modal or consent section that a signal kept closed in the source mounts open, or without content, in the port. Page URL: ${pair.cand.url}`,
78521
+ suggestedFix: "Find the overlay named above in the candidate and check what mounts it: it should render nothing (or `pointer-events: none`) until its trigger fires, as it does on prod.",
78522
+ evidence
78523
+ });
78524
+ }
78525
+ if (newVisible.length / n >= MIN_SHARE) {
78526
+ const high = newVisible.length / n >= HIGH_VISIBLE_SHARE;
78527
+ out.push({
78528
+ ...common,
78529
+ id: `click-blocker:overlay-cand-only:${pair.key}`,
78530
+ severity: high ? "high" : "medium",
78531
+ summary: `[${pair.viewport}] cand has a visible overlay blocking the page (${describeBlock(newVisible, n)}) that prod does not have`,
78532
+ details: `${blockDetails(newVisible, n)} The overlay is visible, but ${high ? "it blocks most of the page, which stays unusable until the overlay is dismissed" : "it blocks part of the page"}, and prod's page is usable at the same moment; whether the overlay offers a way to dismiss it is not verified. Typical cause: a modal or drawer open in the port that starts closed on prod. Page URL: ${pair.cand.url}`,
78533
+ evidence
78534
+ });
78535
+ }
78536
+ if (prodOnly.length / n >= MIN_SHARE) {
78537
+ out.push({
78538
+ ...common,
78539
+ id: `click-blocker:prod-only:${pair.key}`,
78540
+ severity: "low",
78541
+ inconclusive: true,
78542
+ summary: `[${pair.viewport}] prod blocks the page with an overlay (${describeBlock(prodOnly, n)}) that cand does not render`,
78543
+ details: "The candidate is more clickable than prod here, so this is not a click-blocking defect. Informational: a consent or promo layer prod shows and the port does not (see the visual and html checks)."
78544
+ });
78545
+ }
78546
+ return out;
78547
+ }
78548
+ function describeBlock(points, n) {
78549
+ const { selector } = dominantOverlay(points);
78550
+ return `${selector}, ${Math.round(points.length / n * 100)}% of the viewport grid`;
78551
+ }
78552
+ function dominantOverlay(points) {
78553
+ const counts = new Map;
78554
+ for (const p of points) {
78555
+ if (!p.overlay)
78556
+ continue;
78557
+ const e = counts.get(p.overlay.selector) ?? { n: 0, coverage: 0 };
78558
+ e.n++;
78559
+ e.coverage = Math.max(e.coverage, p.overlay.coverage);
78560
+ counts.set(p.overlay.selector, e);
78561
+ }
78562
+ const [selector, e] = [...counts.entries()].sort((a, b) => b[1].n - a[1].n)[0] ?? [
78563
+ "unknown",
78564
+ { coverage: 0 }
78565
+ ];
78566
+ return { selector, coverage: e.coverage };
78567
+ }
78568
+ function blockDetails(points, n) {
78569
+ const { selector, coverage } = dominantOverlay(points);
78570
+ const under = [...new Set(points.map((p) => p.underInteractive ?? p.under).filter(Boolean))].slice(0, 3).join("; ");
78571
+ const interactive = points.filter((p) => p.underInteractive).length;
78572
+ return `Overlay ${selector} covers ${Math.round(coverage * 100)}% of the viewport and intercepts ${points.length} of ${n} sampled points (${interactive} with a link/button/field underneath). Underneath: ${under || "page content"}.`;
78573
+ }
78574
+
78363
78575
  // src/diff/console.ts
78364
78576
  var HYDRATION_PATTERNS = [
78365
78577
  /hydration (?:failed|mismatch|error)/i,
@@ -79738,6 +79950,156 @@ function withHtmlSnapshot(check) {
79738
79950
  return guarded;
79739
79951
  }
79740
79952
 
79953
+ // src/checks/first-viewport-ssr.ts
79954
+ var T = TOLERANCES.firstViewportSsr;
79955
+ function firstViewportSsr(ctx) {
79956
+ const start = Date.now();
79957
+ const { pairs } = pairCaptures(ctx.prodPages, ctx.candPages);
79958
+ const issues = [];
79959
+ const judged = [];
79960
+ const unjudged = [];
79961
+ for (const pair of pairs) {
79962
+ const why = unjudgeable2(pair.prod.firstViewport, pair.cand.firstViewport);
79963
+ if (why) {
79964
+ unjudged.push(pair.key);
79965
+ issues.push({
79966
+ id: `first-viewport:no-probe:${pair.key}`,
79967
+ severity: "low",
79968
+ inconclusive: true,
79969
+ category: "performance",
79970
+ page: pair.key,
79971
+ check: "first-viewport-ssr",
79972
+ summary: `${pair.key}: first-viewport probe unavailable (${why}) — not compared by first-viewport-ssr`,
79973
+ details: "Without server HTML and judgeable first-viewport sections on both sides there is nothing to compare, and absence is not evidence that the server rendered them. Re-capture with a current parity."
79974
+ });
79975
+ continue;
79976
+ }
79977
+ judged.push(pair.key);
79978
+ issues.push(...judgePair2(pair));
79979
+ }
79980
+ const live = issues.filter((i) => !i.inconclusive);
79981
+ const compared = judged.length;
79982
+ const status = live.some((i) => i.severity === "high" || i.severity === "critical") ? "fail" : live.length > 0 ? "warn" : compared === 0 ? "skipped" : "pass";
79983
+ const regressions = live.filter((i) => i.id.startsWith("first-viewport:regression:")).length;
79984
+ const summary = compared === 0 ? `nothing compared: ${pairs.length === 0 ? "no prod x cand page pairs" : `${unjudged.length} of ${pairs.length} page pair(s) had no judgeable first-viewport probe`}` : `${compared} page pair(s) compared, ${regressions} first-viewport regression(s), ${live.length - regressions} deferred section(s) prod shares${unjudged.length ? `, ${unjudged.length} without a probe` : ""}`;
79985
+ return {
79986
+ name: "first-viewport-ssr",
79987
+ status,
79988
+ severity: "high",
79989
+ durationMs: Date.now() - start,
79990
+ summary,
79991
+ issues,
79992
+ ...unitCounts({
79993
+ unit: "page-pair",
79994
+ judged,
79995
+ unjudged,
79996
+ issues,
79997
+ informational: (i) => i.id.startsWith("first-viewport:prod-deferred:")
79998
+ }),
79999
+ data: { pairs: pairs.length, compared, withoutProbe: unjudged.length }
80000
+ };
80001
+ }
80002
+ function kindsOf(final, server) {
80003
+ const s = server ?? { text: 0, links: 0, images: 0, inputs: 0 };
80004
+ const all = [
80005
+ { label: "text chars", final: final.text, server: s.text },
80006
+ { label: "links", final: final.links, server: s.links },
80007
+ { label: "images", final: final.images, server: s.images },
80008
+ { label: "inputs", final: final.inputs, server: s.inputs }
80009
+ ];
80010
+ return all.filter((k) => k.final >= (k.label === "text chars" ? T.contentMinChars.value : 1));
80011
+ }
80012
+ var judgeable = (s) => kindsOf(s.final, s.server).length > 0;
80013
+ var inViewport = (s) => s.share >= T.minViewportShare.value && judgeable(s);
80014
+ function serverShare(s) {
80015
+ const kinds = kindsOf(s.final, s.server);
80016
+ return kinds.reduce((sum, k) => sum + Math.min(1, k.server / k.final), 0) / kinds.length;
80017
+ }
80018
+ var isDeferred = (s) => serverShare(s) <= T.deferredBelow.value;
80019
+ function unjudgeable2(prod, cand) {
80020
+ if (!prod || !cand)
80021
+ return `no probe on ${!prod && !cand ? "either side" : !prod ? "prod" : "cand"}`;
80022
+ if (prod.serverChars === 0 || cand.serverChars === 0)
80023
+ return "no server HTML recorded on a side";
80024
+ if (!cand.sections.some(inViewport))
80025
+ return "no judgeable section in cand's first viewport";
80026
+ return null;
80027
+ }
80028
+ function counterpart(s, others, used) {
80029
+ const free = others.filter((o) => !used.has(o));
80030
+ const hit = free.find((o) => o.keys.some((k) => s.keys.includes(k))) ?? (s.landmark ? free.find((o) => o.landmark === s.landmark) : undefined) ?? null;
80031
+ if (hit)
80032
+ used.add(hit);
80033
+ return hit;
80034
+ }
80035
+ function missing(s) {
80036
+ return kindsOf(s.final, s.server).map((k) => `${k.server} of ${k.final} ${k.label}`).join(", ");
80037
+ }
80038
+ function judgePair2(pair) {
80039
+ const prod = pair.prod.firstViewport;
80040
+ const cand = pair.cand.firstViewport;
80041
+ const candView = cand.sections.filter(inViewport);
80042
+ const wholePageClientSide = isLocalhost(pair.cand.finalUrl) && candView.length > 0 && candView.every(isDeferred);
80043
+ const caveat = wholePageClientSide ? " Measured against a local dev server on which every judged first-viewport section is deferred, i.e. the whole page rendered client-side, which several frameworks do in dev: reconfirm on a production build before treating this as a defect." : "";
80044
+ const out = [];
80045
+ const usedProd = new Set;
80046
+ const names = new Map;
80047
+ const idFor = (kind, name) => {
80048
+ const n = (names.get(`${kind}:${name}`) ?? 0) + 1;
80049
+ names.set(`${kind}:${name}`, n);
80050
+ return `first-viewport:${kind}:${name}${n > 1 ? `#${n}` : ""}:${pair.key}`;
80051
+ };
80052
+ const common = { category: "performance", page: pair.key, check: "first-viewport-ssr" };
80053
+ const where = `[${pair.viewport}] ${pair.cand.url}`;
80054
+ for (const s of candView) {
80055
+ const p = counterpart(s, prod.sections, usedProd);
80056
+ if (!isDeferred(s))
80057
+ continue;
80058
+ const pct = Math.round(s.share * 100);
80059
+ const lack = `${missing(s)} in the server HTML`;
80060
+ const prodState = p && judgeable(p) ? isDeferred(p) ? "deferred" : "rendered" : "unknown";
80061
+ const fix = "Server-render this section (do not wrap it in a lazy/deferred section, or mark it eager) so it is in the first response; if it must stay deferred, give its fallback the section's real size.";
80062
+ const inconclusive = wholePageClientSide ? { inconclusive: true } : {};
80063
+ if (prodState === "rendered") {
80064
+ out.push({
80065
+ ...common,
80066
+ ...inconclusive,
80067
+ id: idFor("regression", s.name),
80068
+ severity: "high",
80069
+ summary: `cand defers the ${s.name} section in the first viewport that prod server-renders (${lack})`,
80070
+ details: `${where}: ${s.name} covers ${pct}% of the first viewport and reaches the browser as a skeleton until client JS runs, while prod's server HTML already holds it (${missing(p)}).${caveat}`,
80071
+ suggestedFix: fix
80072
+ });
80073
+ } else {
80074
+ const why = prodState === "deferred" ? "prod defers it too, so this is not a regression: prod has the same flaw and the candidate can fix it" : "prod has no first-viewport counterpart to compare with";
80075
+ out.push({
80076
+ ...common,
80077
+ ...inconclusive,
80078
+ id: idFor("improve", s.name),
80079
+ severity: "medium",
80080
+ summary: `${s.name} is deferred in the first viewport on cand (${lack}); ${prodState === "deferred" ? "prod has the same flaw, the candidate can fix it" : "no prod counterpart to compare"}`,
80081
+ details: `${where}: ${s.name} covers ${pct}% of the first viewport and arrives after client JS runs; ${why}. Reported because content in the first viewport arriving late is a defect on its own. Whether to fix it or keep it as-is is the owner's decision (accept it with an expectedDivergences entry for this id).${caveat}`,
80082
+ suggestedFix: fix
80083
+ });
80084
+ }
80085
+ }
80086
+ const usedCand = new Set;
80087
+ for (const p of prod.sections.filter(inViewport)) {
80088
+ const c = counterpart(p, cand.sections, usedCand);
80089
+ if (!isDeferred(p) || !c || !judgeable(c) || isDeferred(c))
80090
+ continue;
80091
+ out.push({
80092
+ ...common,
80093
+ id: idFor("prod-deferred", p.name),
80094
+ severity: "low",
80095
+ inconclusive: true,
80096
+ summary: `prod defers the ${p.name} section in the first viewport (${missing(p)} in the server HTML) and cand server-renders it`,
80097
+ details: `${where}: informational, the candidate is better than prod here.`
80098
+ });
80099
+ }
80100
+ return out;
80101
+ }
80102
+
79741
80103
  // src/checks/login-flow.ts
79742
80104
  var STEP_LABELS = {
79743
80105
  "visit-home": "Visitar home",
@@ -83235,7 +83597,7 @@ async function pickCategoryLink(candidates) {
83235
83597
  return null;
83236
83598
  if (usable.length === 1)
83237
83599
  return usable[0];
83238
- const filtered = usable.filter((c) => !isBlocked(c.href));
83600
+ const filtered = usable.filter((c) => !isBlocked2(c.href));
83239
83601
  if (filtered.length === 0)
83240
83602
  return usable[0] ?? null;
83241
83603
  if (filtered.length === 1)
@@ -83255,7 +83617,7 @@ function isAccountLink(c) {
83255
83617
  } catch {}
83256
83618
  return ACCOUNT_LINK.test(`${c.text} ${path}`);
83257
83619
  }
83258
- function isBlocked(href) {
83620
+ function isBlocked2(href) {
83259
83621
  try {
83260
83622
  const path = new URL(href, "http://placeholder.invalid").pathname.toLowerCase();
83261
83623
  return PATH_BLOCKLIST.some((b) => path.startsWith(b));
@@ -83431,6 +83793,164 @@ ${compacted}
83431
83793
  return null;
83432
83794
  }
83433
83795
 
83796
+ // src/engine/click-probe.ts
83797
+ var CLICK_PROBE_SOURCE = `(function (cols, rows, minPaintAlpha) {
83798
+ var vw = window.innerWidth;
83799
+ var vh = window.innerHeight;
83800
+ var INTERACTIVE =
83801
+ 'a[href],button,input:not([type=hidden]),select,textarea,summary,[role=button],[role=link],[role=menuitem],[role=tab],[onclick]';
83802
+
83803
+ function describe(el) {
83804
+ var s = el.tagName.toLowerCase();
83805
+ if (el.id) s += '#' + el.id;
83806
+ var cls = typeof el.className === 'string' ? el.className.split(/\\s+/).filter(Boolean) : [];
83807
+ // Hashed utility classes (css-1x2y3z, long generated names) are noise, not identity.
83808
+ cls = cls.filter(function (c) { return c.length <= 30; }).slice(0, 2);
83809
+ if (cls.length) s += '.' + cls.join('.');
83810
+ var role = el.getAttribute('role');
83811
+ if (role) s += '[role=' + role + ']';
83812
+ return s;
83813
+ }
83814
+ function describeInteractive(el) {
83815
+ var t = (el.getAttribute('aria-label') || el.textContent || '').replace(/\\s+/g, ' ').trim();
83816
+ return describe(el) + (t ? ' "' + t.slice(0, 24) + '"' : '');
83817
+ }
83818
+ function alphaOf(color) {
83819
+ if (!color || color === 'transparent') return 0;
83820
+ var m = color.match(/^rgba?\\(([^)]+)\\)$/);
83821
+ if (m) {
83822
+ var parts = m[1].split(/[ ,\\/]+/).filter(Boolean);
83823
+ return parts.length > 3 ? parseFloat(parts[3]) : 1;
83824
+ }
83825
+ // color(srgb r g b / a), oklch(... / a): alpha follows the slash, absent means opaque.
83826
+ var slash = color.split('/');
83827
+ return slash.length > 1 ? parseFloat(slash[1]) : 1;
83828
+ }
83829
+ function viewportCoverage(el) {
83830
+ var r = el.getBoundingClientRect();
83831
+ var w = Math.max(0, Math.min(r.right, vw) - Math.max(r.left, 0));
83832
+ var h = Math.max(0, Math.min(r.bottom, vh) - Math.max(r.top, 0));
83833
+ return vw * vh > 0 ? (w * h) / (vw * vh) : 0;
83834
+ }
83835
+ function isModalDialog(el) {
83836
+ if (el.tagName !== 'DIALOG' || !el.hasAttribute('open')) return false;
83837
+ try { return el.matches(':modal'); } catch (e) { return false; }
83838
+ }
83839
+ function overlayKind(el, cs) {
83840
+ if (el.tagName === 'DIALOG' && el.hasAttribute('open')) return 'dialog';
83841
+ try { if (el.matches(':popover-open') || el.matches(':fullscreen')) return 'top-layer'; } catch (e) {}
83842
+ if (cs.position === 'fixed') return 'fixed';
83843
+ // An absolutely positioned layer is an overlay only when it spans (nearly) the whole viewport:
83844
+ // ordinary absolute children (badges, dropdowns) are page content.
83845
+ if (cs.position === 'absolute' && viewportCoverage(el) >= 0.9) return 'absolute-cover';
83846
+ return null;
83847
+ }
83848
+ function paintsSelf(el, cs) {
83849
+ if (alphaOf(cs.backgroundColor) >= minPaintAlpha) return true;
83850
+ // 'initial' is what a DOM without a style engine reports for an unset image; browsers say 'none'.
83851
+ if (cs.backgroundImage && cs.backgroundImage !== 'none' && cs.backgroundImage !== 'initial') return true;
83852
+ var bw = parseFloat(cs.borderTopWidth) + parseFloat(cs.borderRightWidth) +
83853
+ parseFloat(cs.borderBottomWidth) + parseFloat(cs.borderLeftWidth);
83854
+ if (bw > 0 && cs.borderTopStyle !== 'none' && cs.borderTopStyle !== 'initial' && alphaOf(cs.borderTopColor) >= minPaintAlpha) return true;
83855
+ var tag = el.tagName;
83856
+ if (tag === 'IMG' || tag === 'VIDEO' || tag === 'CANVAS' || tag === 'SVG' || tag === 'PICTURE' || tag === 'IFRAME') return true;
83857
+ if (alphaOf(cs.color) >= minPaintAlpha) {
83858
+ for (var n = el.firstChild; n; n = n.nextSibling) {
83859
+ if (n.nodeType === 3 && n.nodeValue && n.nodeValue.trim()) return true;
83860
+ }
83861
+ }
83862
+ return false;
83863
+ }
83864
+
83865
+ var points = [];
83866
+ for (var r = 0; r < rows; r++) {
83867
+ for (var c = 0; c < cols; c++) {
83868
+ var x = Math.round(((c + 0.5) / cols) * vw);
83869
+ var y = Math.round(((r + 0.5) / rows) * vh);
83870
+ var hitEl = vw > 0 && vh > 0 ? document.elementFromPoint(x, y) : null;
83871
+ var point = { x: x, y: y, hit: null, pointerEvents: 'auto', paints: false, overlay: null, under: null, underInteractive: null };
83872
+ if (hitEl) {
83873
+ var hcs = getComputedStyle(hitEl);
83874
+ point.hit = describe(hitEl);
83875
+ point.pointerEvents = hcs.pointerEvents || 'auto';
83876
+ // Nearest overlay ancestor (inclusive), collecting the chain to test what is painted.
83877
+ var chain = [];
83878
+ var root = null;
83879
+ var kind = null;
83880
+ for (var el = hitEl; el && el !== document.body && el !== document.documentElement; el = el.parentElement) {
83881
+ chain.push(el);
83882
+ kind = overlayKind(el, getComputedStyle(el));
83883
+ if (kind) { root = el; break; }
83884
+ }
83885
+ // Point-level paint test. Opacity multiplies down the chain: a fully faded button inside
83886
+ // an opaque-looking wrapper still paints nothing.
83887
+ var opacity = 1;
83888
+ var paints = false;
83889
+ var scan = root ? chain : [hitEl];
83890
+ for (var i = 0; i < scan.length; i++) {
83891
+ var cs = getComputedStyle(scan[i]);
83892
+ var o = parseFloat(cs.opacity);
83893
+ opacity *= isNaN(o) ? 1 : o;
83894
+ if (paintsSelf(scan[i], cs)) paints = true;
83895
+ }
83896
+ if (root && kind === 'dialog' && isModalDialog(root)) {
83897
+ // A modal dialog's ::backdrop paints the page outside the dialog box; the dialog itself
83898
+ // is what elementFromPoint reports there.
83899
+ var rr = root.getBoundingClientRect();
83900
+ var inside = x >= rr.left && x <= rr.right && y >= rr.top && y <= rr.bottom;
83901
+ if (!inside) {
83902
+ var bcs = getComputedStyle(root, '::backdrop');
83903
+ paints = alphaOf(bcs.backgroundColor) >= minPaintAlpha;
83904
+ }
83905
+ }
83906
+ point.paints = paints && opacity >= minPaintAlpha;
83907
+ if (root) {
83908
+ point.overlay = {
83909
+ selector: describe(root),
83910
+ kind: kind,
83911
+ // A modal dialog makes the whole page inert whatever its own box measures.
83912
+ coverage: Math.round((kind === 'dialog' && isModalDialog(root) ? 1 : viewportCoverage(root)) * 100) / 100,
83913
+ };
83914
+ if (kind === 'dialog' && isModalDialog(root)) {
83915
+ // The page behind a modal dialog is inert, and an inert element is not hit-testable:
83916
+ // elementsFromPoint lists nothing beneath it. That is not "nothing to click" (the
83917
+ // clicks are swallowed all the same), so name the first page control it disables.
83918
+ point.under = 'page (inert behind modal dialog)';
83919
+ var ctl = Array.prototype.find.call(document.querySelectorAll(INTERACTIVE), function (e) {
83920
+ return !root.contains(e);
83921
+ });
83922
+ if (ctl) point.underInteractive = describeInteractive(ctl);
83923
+ points.push(point);
83924
+ continue;
83925
+ }
83926
+ var stack = document.elementsFromPoint(x, y);
83927
+ var seen = false;
83928
+ for (var j = 0; j < stack.length; j++) {
83929
+ var s = stack[j];
83930
+ if (s === root) { seen = true; continue; }
83931
+ if (!seen) continue;
83932
+ // Ancestors of the overlay (app wrappers, body) are not "beneath" it.
83933
+ if (s === document.body || s === document.documentElement || s.contains(root)) continue;
83934
+ if (point.under === null) point.under = describe(s);
83935
+ if (point.underInteractive === null && s.matches(INTERACTIVE)) {
83936
+ point.underInteractive = describeInteractive(s);
83937
+ break;
83938
+ }
83939
+ }
83940
+ }
83941
+ }
83942
+ points.push(point);
83943
+ }
83944
+ }
83945
+ return { viewportWidth: vw, viewportHeight: vh, points: points };
83946
+ })`;
83947
+ async function readClickProbe(page) {
83948
+ const { gridCols, gridRows, paintAlpha } = TOLERANCES.clickProbe;
83949
+ return await page.evaluate(`${CLICK_PROBE_SOURCE}(${gridCols.value}, ${gridRows.value}, ${paintAlpha.value})`).then((r) => r).catch(() => {
83950
+ return;
83951
+ }) ?? undefined;
83952
+ }
83953
+
83434
83954
  // src/engine/cookie-banner.ts
83435
83955
  var ACCEPT_SELECTORS = [
83436
83956
  "#onetrust-accept-btn-handler",
@@ -83486,6 +84006,205 @@ async function acceptCookieBanner(page, opts = {}) {
83486
84006
  return false;
83487
84007
  }
83488
84008
 
84009
+ // src/engine/first-viewport-probe.ts
84010
+ var FIRST_VIEWPORT_PROBE_SOURCE = `(function (arg) {
84011
+ var vw = window.innerWidth;
84012
+ var vh = window.innerHeight;
84013
+ var SKIP = { SCRIPT: 1, STYLE: 1, NOSCRIPT: 1, TEMPLATE: 1, LINK: 1, META: 1 };
84014
+ var LANDMARK = 'header,[role=banner],main,[role=main],footer,[role=contentinfo],nav,[role=navigation]';
84015
+ var KEY = 'data-manifest-key';
84016
+
84017
+ function landmarkName(el) {
84018
+ var tag = el.tagName.toLowerCase();
84019
+ var role = el.getAttribute('role');
84020
+ if (tag === 'header' || role === 'banner') return 'header';
84021
+ if (tag === 'main' || role === 'main') return 'main';
84022
+ if (tag === 'footer' || role === 'contentinfo') return 'footer';
84023
+ if (tag === 'nav' || role === 'navigation') return 'nav';
84024
+ return null;
84025
+ }
84026
+ function landmarkOf(el) {
84027
+ var self = el.matches(LANDMARK) ? el : el.querySelector(LANDMARK);
84028
+ return self ? landmarkName(self) : null;
84029
+ }
84030
+ // Outermost keyed elements; a landmark only when nothing keyed lives inside it (otherwise the
84031
+ // keyed children are the sections and the landmark is just their container).
84032
+ function collect(doc) {
84033
+ var out = [];
84034
+ (function walk(parent) {
84035
+ for (var c = parent.firstElementChild; c; c = c.nextElementSibling) {
84036
+ if (SKIP[c.tagName]) continue;
84037
+ if (c.hasAttribute(KEY)) { out.push(c); continue; }
84038
+ if (c.matches(LANDMARK)) {
84039
+ if (c.querySelector('[' + KEY + ']')) walk(c); else out.push(c);
84040
+ continue;
84041
+ }
84042
+ walk(c);
84043
+ }
84044
+ })(doc.body || doc.documentElement);
84045
+ return out;
84046
+ }
84047
+ function ownId(el) {
84048
+ var k = el.getAttribute(KEY);
84049
+ return k ? 'k:' + k : 't:' + el.tagName.toLowerCase() + ':' + (el.getAttribute('role') || '');
84050
+ }
84051
+ function innerKeys(el) {
84052
+ var seen = {};
84053
+ var keys = [];
84054
+ var nodes = el.querySelectorAll('[' + KEY + ']');
84055
+ for (var i = 0; i < nodes.length && keys.length < 6; i++) {
84056
+ var k = nodes[i].getAttribute(KEY);
84057
+ if (k && !seen[k]) { seen[k] = 1; keys.push(k); }
84058
+ }
84059
+ return keys;
84060
+ }
84061
+ function keysOf(el) {
84062
+ var inner = innerKeys(el);
84063
+ if (inner.length) return inner;
84064
+ var own = el.getAttribute(KEY);
84065
+ return own ? [own] : [];
84066
+ }
84067
+ function nameOf(el, keys) {
84068
+ if (keys.length) return keys[0].split('/').pop().replace(/\\.(tsx|ts|jsx|js|mjs)$/i, '');
84069
+ return landmarkOf(el) || el.tagName.toLowerCase();
84070
+ }
84071
+ function metrics(el) {
84072
+ var buf = '';
84073
+ var links = 0, images = 0, inputs = 0;
84074
+ (function walk(n) {
84075
+ for (var c = n.firstChild; c; c = c.nextSibling) {
84076
+ if (c.nodeType === 3) { buf += ' ' + c.nodeValue; continue; }
84077
+ if (c.nodeType !== 1 || SKIP[c.tagName]) continue;
84078
+ var t = c.tagName;
84079
+ if (t === 'A' && c.hasAttribute('href')) links++;
84080
+ else if (t === 'IMG' || t === 'VIDEO') images++;
84081
+ else if (t === 'SELECT' || t === 'TEXTAREA' || (t === 'INPUT' && c.getAttribute('type') !== 'hidden')) inputs++;
84082
+ walk(c);
84083
+ }
84084
+ })(el);
84085
+ return { text: buf.replace(/\\s+/g, ' ').trim().length, links: links, images: images, inputs: inputs };
84086
+ }
84087
+ // A modal, drawer, consent bar or chat bubble: a fixed layer that is bottom-anchored or covers
84088
+ // at least half the viewport (a fixed TOP header is neither). It is client-only by nature and
84089
+ // click-blocker-parity's business, not a section whose server rendering the user waits for.
84090
+ function isLayer(el, r, cs) {
84091
+ if (el.tagName === 'DIALOG' || el.getAttribute('role') === 'dialog' || el.getAttribute('aria-modal') === 'true') return true;
84092
+ if (cs.position !== 'fixed') return false;
84093
+ var w = Math.max(0, Math.min(r.right, vw) - Math.max(r.left, 0));
84094
+ var h = Math.max(0, Math.min(r.bottom, vh) - Math.max(r.top, 0));
84095
+ return r.top > vh * 0.5 || (vw * vh > 0 && (w * h) / (vw * vh) >= 0.5);
84096
+ }
84097
+ // A section wrapper can be 0px tall while its content is positioned out of flow (an absolute or
84098
+ // fixed header over the hero: seen on a real storefront, where the keyed header section measured
84099
+ // 0x1440 and the header inside it 134px). With no box of its own, the section is where its
84100
+ // content is: its landmark's box, else the union of its visible descendants' boxes (a menu panel
84101
+ // that is hidden or transparent has a box and must not widen it), layers excluded.
84102
+ function boxOf(el, cs) {
84103
+ var own = el.getBoundingClientRect();
84104
+ if (cs.display !== 'contents' && own.width * own.height > 0) return own;
84105
+ var lm = el.querySelector(LANDMARK);
84106
+ if (lm) {
84107
+ var lr = lm.getBoundingClientRect();
84108
+ if (lr.width * lr.height > 0 && !isLayer(lm, lr, getComputedStyle(lm))) return lr;
84109
+ }
84110
+ var l = 1e9, t = 1e9, r = -1e9, b = -1e9;
84111
+ var nodes = el.querySelectorAll('*');
84112
+ var layers = [];
84113
+ for (var i = 0; i < nodes.length && i < 300; i++) {
84114
+ // Document order: a layer is seen before its children, which are part of it.
84115
+ if (layers.some(function (L) { return L.contains(nodes[i]); })) continue;
84116
+ var cr = nodes[i].getBoundingClientRect();
84117
+ if (cr.width * cr.height <= 0) continue;
84118
+ var ncs = getComputedStyle(nodes[i]);
84119
+ if (isLayer(nodes[i], cr, ncs)) { layers.push(nodes[i]); continue; }
84120
+ if (ncs.visibility === 'hidden' || ncs.opacity === '0') continue;
84121
+ l = Math.min(l, cr.left); t = Math.min(t, cr.top); r = Math.max(r, cr.right); b = Math.max(b, cr.bottom);
84122
+ }
84123
+ return r < l ? own : { left: l, top: t, right: r, bottom: b };
84124
+ }
84125
+
84126
+ var rawDoc = new DOMParser().parseFromString(arg.raw, 'text/html');
84127
+ var rawCands = collect(rawDoc);
84128
+ var rawById = {};
84129
+ rawCands.forEach(function (el) { (rawById[ownId(el)] = rawById[ownId(el)] || []).push(el); });
84130
+ var used = [];
84131
+ var seenOwn = {};
84132
+
84133
+ function serverCounterpart(el, keys) {
84134
+ var id = ownId(el);
84135
+ var n = seenOwn[id] || 0;
84136
+ seenOwn[id] = n + 1;
84137
+ var hit = rawById[id] && rawById[id][n];
84138
+ if (!hit) {
84139
+ hit = rawCands.filter(function (r) {
84140
+ return used.indexOf(r) < 0 && keysOf(r).some(function (k) { return keys.indexOf(k) >= 0; });
84141
+ })[0];
84142
+ }
84143
+ var lm = landmarkOf(el);
84144
+ if (!hit && lm) hit = rawCands.filter(function (r) { return used.indexOf(r) < 0 && landmarkOf(r) === lm; })[0];
84145
+ if (hit) used.push(hit);
84146
+ return hit ? metrics(hit) : null;
84147
+ }
84148
+
84149
+ var sections = [];
84150
+ collect(document).forEach(function (el) {
84151
+ var keys = keysOf(el);
84152
+ // Counted before any exclusion so the n-th-own-key pairing stays aligned with the server HTML.
84153
+ var server = serverCounterpart(el, keys);
84154
+ var cs = getComputedStyle(el);
84155
+ var share = 0;
84156
+ if (cs.display !== 'none' && cs.visibility !== 'hidden') {
84157
+ var r = boxOf(el, cs);
84158
+ if (isLayer(el, r, cs)) return;
84159
+ var w = Math.max(0, Math.min(r.right, vw) - Math.max(r.left, 0));
84160
+ var h = Math.max(0, Math.min(r.bottom, vh) - Math.max(r.top, 0));
84161
+ share = vw * vh > 0 ? Math.round((w * h) / (vw * vh) * 1000) / 1000 : 0;
84162
+ }
84163
+ sections.push({
84164
+ name: nameOf(el, keys),
84165
+ keys: keys,
84166
+ landmark: landmarkOf(el),
84167
+ share: share,
84168
+ final: metrics(el),
84169
+ server: server
84170
+ });
84171
+ });
84172
+ // In-viewport sections first: the cap must never drop the part the check is about.
84173
+ sections = sections
84174
+ .map(function (s, i) { return { s: s, i: i }; })
84175
+ .sort(function (a, b) { return (b.s.share > 0) - (a.s.share > 0) || a.i - b.i; })
84176
+ .map(function (x) { return x.s; })
84177
+ .slice(0, arg.maxSections);
84178
+ return { viewportWidth: vw, viewportHeight: vh, serverChars: arg.raw.length, sections: sections };
84179
+ })`;
84180
+ var MAX_RAW_CHARS = 8000000;
84181
+ function sameDocument(a, b) {
84182
+ try {
84183
+ const x = new URL(a);
84184
+ const y = new URL(b);
84185
+ return x.origin === y.origin && x.pathname === y.pathname && x.search === y.search;
84186
+ } catch {
84187
+ return false;
84188
+ }
84189
+ }
84190
+ async function readFirstViewportProbe(page, response) {
84191
+ try {
84192
+ if (!response || !sameDocument(response.url(), page.url()))
84193
+ return;
84194
+ const raw = await response.text().catch(() => null);
84195
+ if (!raw || raw.length > MAX_RAW_CHARS)
84196
+ return;
84197
+ return await page.evaluate(`${FIRST_VIEWPORT_PROBE_SOURCE}(${JSON.stringify({
84198
+ raw,
84199
+ maxSections: TOLERANCES.firstViewportSsr.maxSections.value
84200
+ })})`).catch(() => {
84201
+ return;
84202
+ }) ?? undefined;
84203
+ } catch {
84204
+ return;
84205
+ }
84206
+ }
84207
+
83489
84208
  // src/engine/vitals-warm.ts
83490
84209
  var VITALS_WARM_LOADS = 1;
83491
84210
  var VITALS_WARM_TIMEOUT_MS = 15000;
@@ -84070,6 +84789,8 @@ async function capturePage(page, opts) {
84070
84789
  tracePath: opts.tracePath,
84071
84790
  xRobotsTag,
84072
84791
  pairKey: opts.pairKey,
84792
+ ...clickProbe ? { clickProbe } : {},
84793
+ ...firstViewport ? { firstViewport } : {},
84073
84794
  ...response ? { variant: fingerprintVariant(html, response.headers(), cookieNames) } : {}
84074
84795
  });
84075
84796
  let cookieNames = [];
@@ -84079,6 +84800,8 @@ async function capturePage(page, opts) {
84079
84800
  let vitals = null;
84080
84801
  let vitalsStats;
84081
84802
  let vitalsFullPage = null;
84803
+ let clickProbe;
84804
+ let firstViewport;
84082
84805
  let html = "";
84083
84806
  const readVitals = async () => {
84084
84807
  dlog(opts.side, opts.viewport, ` capturePage: vitals evaluate (cap=${Math.min(5000, remaining())}ms)`);
@@ -84087,6 +84810,14 @@ async function capturePage(page, opts) {
84087
84810
  new Promise((resolve) => setTimeout(() => resolve(null), Math.min(5000, remaining())))
84088
84811
  ]) ?? null;
84089
84812
  };
84813
+ const readClickProbeCapped = async () => response ? await Promise.race([
84814
+ readClickProbe(page),
84815
+ new Promise((resolve) => setTimeout(() => resolve(undefined), Math.min(3000, remaining())))
84816
+ ]) : undefined;
84817
+ const readFirstViewportCapped = async () => response ? await Promise.race([
84818
+ readFirstViewportProbe(page, response),
84819
+ new Promise((resolve) => setTimeout(() => resolve(undefined), Math.min(4000, remaining())))
84820
+ ]) : undefined;
84090
84821
  let _resolveDisconnect;
84091
84822
  const disconnectPromise = new Promise((r) => {
84092
84823
  _resolveDisconnect = r;
@@ -84123,6 +84854,8 @@ async function capturePage(page, opts) {
84123
84854
  }
84124
84855
  await page.waitForTimeout(Math.min(opts.settleMs ?? 1200, remaining()));
84125
84856
  vitals = await readVitals();
84857
+ clickProbe = await readClickProbeCapped();
84858
+ firstViewport = await readFirstViewportCapped();
84126
84859
  } else {
84127
84860
  dlog(opts.side, opts.viewport, ` capturePage: waitForLoadState('load') (cap=${Math.min(12000, remaining())}ms)`);
84128
84861
  await page.waitForLoadState("load", { timeout: Math.min(12000, remaining()) }).catch(() => {
@@ -84137,6 +84870,8 @@ async function capturePage(page, opts) {
84137
84870
  dlog(opts.side, opts.viewport, ` capturePage: settle (cap=${Math.min(opts.settleMs ?? 2000, remaining())}ms)`);
84138
84871
  await page.waitForTimeout(Math.min(opts.settleMs ?? 2000, remaining()));
84139
84872
  vitals = await readVitals();
84873
+ clickProbe = await readClickProbeCapped();
84874
+ firstViewport = await readFirstViewportCapped();
84140
84875
  if (opts.scrollToLoad !== false && remaining() > 3000) {
84141
84876
  const scrollBudget = Math.min(45000, remaining());
84142
84877
  dlog(opts.side, opts.viewport, ` capturePage: scrollFullPage start (budget=${scrollBudget}ms, remaining=${remaining()}ms)`);
@@ -89074,7 +89809,7 @@ async function compareViewport(browser, args) {
89074
89809
  repeatPath: null
89075
89810
  })
89076
89811
  ]);
89077
- return judgePair({
89812
+ return judgePair3({
89078
89813
  spec,
89079
89814
  paths,
89080
89815
  prod: prod.side,
@@ -89135,7 +89870,7 @@ function artifactPaths(outDir, prefix, label) {
89135
89870
  candMasked: at("cand-masked")
89136
89871
  };
89137
89872
  }
89138
- function judgePair(args) {
89873
+ function judgePair3(args) {
89139
89874
  const { spec, paths, prod, cand } = args;
89140
89875
  const base = {
89141
89876
  label: spec.label,
@@ -89887,7 +90622,7 @@ async function visualRegressionKeyframes(ctx) {
89887
90622
  const prod = prodProbe ?? unprobed("prod");
89888
90623
  const cand = candProbe ?? unprobed("cand");
89889
90624
  const prefix = `heatmap-${hashSelector(pair.key)}`;
89890
- const r = judgePair({
90625
+ const r = judgePair3({
89891
90626
  spec: { label: pair.viewport, viewport: pair.viewport, size: null },
89892
90627
  paths: artifactPaths(diffDir, prefix, pair.viewport),
89893
90628
  prod: prod.side,
@@ -90227,6 +90962,8 @@ var analyticsBeaconParity2 = withCapturedPairs(analyticsBeaconParity);
90227
90962
  var consoleErrorsBaseline2 = withCapturedPairs(consoleErrorsBaseline);
90228
90963
  var redirectsParity2 = withCapturedPairs(redirectsParity);
90229
90964
  var thirdPartyScriptsParity2 = withCapturedPairs(thirdPartyScriptsParity);
90965
+ var clickBlockerParity2 = withCapturedPairs(clickBlockerParity);
90966
+ var firstViewportSsr2 = withCapturedPairs(firstViewportSsr);
90230
90967
  var imageLoadingHealth2 = withHtmlSnapshot(imageLoadingHealth);
90231
90968
  var lazySectionPresence2 = withHtmlSnapshot(lazySectionPresence);
90232
90969
  var metaSeoParity2 = withHtmlSnapshot(metaSeoParity);
@@ -90259,6 +90996,8 @@ var ALL_CHECKS = [
90259
90996
  cartInteractionsFlow,
90260
90997
  notFoundParity2,
90261
90998
  cookieCepModalCls2,
90999
+ clickBlockerParity2,
91000
+ firstViewportSsr2,
90262
91001
  pdpGalleryRelated2,
90263
91002
  footerLinksHealth2,
90264
91003
  loginFlow,
@@ -90301,6 +91040,8 @@ var ALL_CHECKS_BY_NAME = {
90301
91040
  "cart-interactions-flow": cartInteractionsFlow,
90302
91041
  "not-found-parity": notFoundParity2,
90303
91042
  "cookie-cep-modal-cls": cookieCepModalCls2,
91043
+ "click-blocker-parity": clickBlockerParity2,
91044
+ "first-viewport-ssr": firstViewportSsr2,
90304
91045
  "pdp-gallery-related": pdpGalleryRelated2,
90305
91046
  "footer-links-health": footerLinksHealth2,
90306
91047
  "login-flow": loginFlow,
@@ -90417,8 +91158,13 @@ var MODULES = {
90417
91158
  },
90418
91159
  visual: {
90419
91160
  name: "visual",
90420
- description: "Visual regression — heatmap pixel + box-tree diff of sampled pages, banner aspect ratio, cookie/CEP modal layout shift",
90421
- checks: ["visual-regression-keyframes", "banner-aspect-ratio", "cookie-cep-modal-cls"],
91161
+ description: "Visual regression — heatmap pixel + box-tree diff of sampled pages, banner aspect ratio, cookie/CEP modal layout shift, overlays that swallow clicks on cand only",
91162
+ checks: [
91163
+ "visual-regression-keyframes",
91164
+ "banner-aspect-ratio",
91165
+ "cookie-cep-modal-cls",
91166
+ "click-blocker-parity"
91167
+ ],
90422
91168
  flows: ["homepage", "plp", "pdp"],
90423
91169
  needsVisualPass: true
90424
91170
  },
@@ -90443,7 +91189,7 @@ var MODULES = {
90443
91189
  },
90444
91190
  html: {
90445
91191
  name: "html",
90446
- description: "HTML structure — structural diff, lazy sections, image loading health, missing picture dimensions, editorial content structure",
91192
+ description: "HTML structure — structural diff, lazy sections, first-viewport content in the server response, image loading health, missing picture dimensions, editorial content structure",
90447
91193
  checks: [
90448
91194
  "html-structural-diff",
90449
91195
  "lazy-section-presence",
@@ -90451,6 +91197,7 @@ var MODULES = {
90451
91197
  "picture-missing-dims",
90452
91198
  "font-parity",
90453
91199
  "ssr-no-js",
91200
+ "first-viewport-ssr",
90454
91201
  "section-order-parity",
90455
91202
  "content-structure"
90456
91203
  ],
@@ -90623,6 +91370,45 @@ var VariantFingerprint = z2.object({
90623
91370
  stack: ServingStack,
90624
91371
  signals: z2.array(z2.string())
90625
91372
  });
91373
+ var ClickProbePoint = z2.object({
91374
+ x: z2.number(),
91375
+ y: z2.number(),
91376
+ hit: z2.string().nullable(),
91377
+ pointerEvents: z2.string(),
91378
+ paints: z2.boolean(),
91379
+ overlay: z2.object({
91380
+ selector: z2.string(),
91381
+ kind: z2.enum(["fixed", "dialog", "top-layer", "absolute-cover"]),
91382
+ coverage: z2.number()
91383
+ }).nullable(),
91384
+ under: z2.string().nullable(),
91385
+ underInteractive: z2.string().nullable()
91386
+ });
91387
+ var ClickProbe = z2.object({
91388
+ viewportWidth: z2.number(),
91389
+ viewportHeight: z2.number(),
91390
+ points: z2.array(ClickProbePoint)
91391
+ });
91392
+ var SectionContent = z2.object({
91393
+ text: z2.number(),
91394
+ links: z2.number(),
91395
+ images: z2.number(),
91396
+ inputs: z2.number()
91397
+ });
91398
+ var FirstViewportSection = z2.object({
91399
+ name: z2.string(),
91400
+ keys: z2.array(z2.string()),
91401
+ landmark: z2.string().nullable(),
91402
+ share: z2.number(),
91403
+ final: SectionContent,
91404
+ server: SectionContent.nullable()
91405
+ });
91406
+ var FirstViewportProbe = z2.object({
91407
+ viewportWidth: z2.number(),
91408
+ viewportHeight: z2.number(),
91409
+ serverChars: z2.number(),
91410
+ sections: z2.array(FirstViewportSection)
91411
+ });
90626
91412
  var PageCapture = z2.object({
90627
91413
  url: z2.string(),
90628
91414
  finalUrl: z2.string(),
@@ -90647,7 +91433,9 @@ var PageCapture = z2.object({
90647
91433
  pairKey: z2.string().optional(),
90648
91434
  pass: z2.enum(["extra", "visual"]).optional(),
90649
91435
  variant: VariantFingerprint.optional(),
90650
- retried: z2.boolean().optional()
91436
+ retried: z2.boolean().optional(),
91437
+ clickProbe: ClickProbe.optional(),
91438
+ firstViewport: FirstViewportProbe.optional()
90651
91439
  });
90652
91440
  var StepCapture = z2.object({
90653
91441
  step: z2.number(),
@@ -122564,11 +123352,11 @@ function L2(pt, en, lang) {
122564
123352
  const initial = lang === "pt" ? pt : en;
122565
123353
  return `<span class="i18n" data-pt="${esc3(pt)}" data-en="${esc3(en)}">${esc3(initial)}</span>`;
122566
123354
  }
122567
- function T(text, lang) {
123355
+ function T2(text, lang) {
122568
123356
  return L2(text.pt, text.en, lang);
122569
123357
  }
122570
123358
  function tiles(items, lang) {
122571
- const cells = items.map((t) => `<div class="tile"><div class="tile-val ${TONE_CLASS[t.tone]}">${esc3(t.value)}</div><div class="tile-label">${T(t.label, lang)}</div>${t.sub ? `<div class="tile-sub">${T(t.sub, lang)}</div>` : ""}</div>`).join("");
123359
+ const cells = items.map((t) => `<div class="tile"><div class="tile-val ${TONE_CLASS[t.tone]}">${esc3(t.value)}</div><div class="tile-label">${T2(t.label, lang)}</div>${t.sub ? `<div class="tile-sub">${T2(t.sub, lang)}</div>` : ""}</div>`).join("");
122572
123360
  return `<div class="stat-grid">${cells}</div>`;
122573
123361
  }
122574
123362
  function page(eyebrow, title, body, note) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decocms/parity",
3
- "version": "0.35.30",
3
+ "version": "0.35.32",
4
4
  "description": "E2E parity validator for site migrations. Compares prod vs cand and reports UI, functional, SEO, visual, and Web Vitals deltas with a ranked HTML report.",
5
5
  "type": "module",
6
6
  "license": "MIT",