@decocms/parity 0.35.10 → 0.35.12

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 (2) hide show
  1. package/dist/cli.js +505 -129
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -76048,6 +76048,36 @@ var CAROUSEL_STABILIZER_INIT_SCRIPT = `
76048
76048
  }
76049
76049
  } catch (_) {}
76050
76050
 
76051
+ // 5b. Hand-rolled transform tracks — a list moved by an inline
76052
+ // translateX inside a clipping parent, no library, no scrollLeft, no
76053
+ // data-section name. Seen live on a shelf ("home-slider") whose track
76054
+ // rested at -62px on one load and -58 or -51.5 on the next, same host:
76055
+ // the offset is computed during layout, so two captures of identical
76056
+ // code disagree by a few px and every slide reads as moved. Slide 0
76057
+ // for this kind of slider is translate 0, the same pin layers 1-5 apply.
76058
+ //
76059
+ // Narrow on purpose: inline style only (where JS sliders write it, and
76060
+ // a cheap selector instead of a computed-style scan), a pure
76061
+ // horizontal translation, at least two children, content wider than
76062
+ // a parent that clips it. A drawer parked off-screen is one panel no
76063
+ // wider than its container, and must keep its transform.
76064
+ try {
76065
+ var moved = document.querySelectorAll('[style*="translate"]');
76066
+ for (var t = 0; t < moved.length; t++) {
76067
+ var track = moved[t];
76068
+ var parent = track.parentElement;
76069
+ if (!parent || track.children.length < 2) continue;
76070
+ var m = /^matrix\\(1, 0, 0, 1, (-?[\\d.]+), 0\\)$/.exec(getComputedStyle(track).transform);
76071
+ if (!m || Number(m[1]) === 0) continue;
76072
+ var ox = getComputedStyle(parent).overflowX;
76073
+ if (ox !== 'hidden' && ox !== 'clip') continue;
76074
+ if (track.scrollWidth <= parent.clientWidth) continue;
76075
+ track.style.transition = 'none';
76076
+ track.style.transform = 'none';
76077
+ counts.generic++;
76078
+ }
76079
+ } catch (_) {}
76080
+
76051
76081
  // 6. Web Animations API — everything above is library-specific or
76052
76082
  // setInterval-driven, and neither reaches an animation started with
76053
76083
  // element.animate() or a CSS animation whose currentTime the page
@@ -77783,20 +77813,33 @@ function registrableDomain(hostname) {
77783
77813
  }
77784
77814
 
77785
77815
  // src/checks/console-errors.ts
77816
+ var BENIGN = [/\bTransition was (?:skipped|aborted)\b/i];
77786
77817
  function consoleErrorsBaseline(ctx) {
77787
77818
  const start = Date.now();
77788
77819
  const { pairs } = pairCaptures(ctx.prodPages, ctx.candPages);
77820
+ const opts = { ignorePatterns: ctx.ignore.ignoreConsolePatterns, errorsOnly: true };
77821
+ const keysOf = (p) => diffConsole(p.console, [], opts).prodErrors.map((e) => e.key);
77822
+ const prodKeys = new Set(ctx.prodPages.flatMap(keysOf));
77823
+ const flowOf = new Map;
77824
+ for (const fc of ctx.candFlows)
77825
+ for (const p of fc.pages)
77826
+ flowOf.set(p, fc.flow);
77827
+ const candLoads = new Map;
77828
+ for (const p of ctx.candPages) {
77829
+ const load = flowOf.get(p) ?? `${p.url}@${p.viewport}`;
77830
+ for (const k of keysOf(p))
77831
+ candLoads.set(k, (candLoads.get(k) ?? new Set).add(load));
77832
+ }
77789
77833
  const byKey = new Map;
77790
77834
  let totalNew = 0;
77791
77835
  const staging = isCandOnStagingHost(ctx.prodPages, ctx.candPages, ctx.candIsProduction);
77792
77836
  for (const pair of pairs) {
77793
- const diff = diffConsole(pair.prod.console, pair.cand.console, {
77794
- ignorePatterns: ctx.ignore.ignoreConsolePatterns,
77795
- errorsOnly: true
77796
- });
77797
- totalNew += diff.newInCand.length;
77798
- for (const e of diff.newInCand) {
77799
- const stagingThirdParty = staging && e.cls === "request-failed" && isThirdPartyRequest(e.entry.text, pair.cand.finalUrl || pair.cand.url);
77837
+ const diff = diffConsole(pair.prod.console, pair.cand.console, opts);
77838
+ totalNew += diff.newInCand.filter((e) => !prodKeys.has(e.key)).length;
77839
+ for (const e of diff.candErrors) {
77840
+ const candUrl = pair.cand.finalUrl || pair.cand.url;
77841
+ const failed = staging ? failedRequestUrl(e.entry, pair.cand.console, candUrl) : undefined;
77842
+ const stagingThirdParty = failed === null || failed !== undefined && isThirdParty2(failed, candUrl);
77800
77843
  const existing = byKey.get(e.key);
77801
77844
  if (!existing) {
77802
77845
  byKey.set(e.key, {
@@ -77804,9 +77847,12 @@ function consoleErrorsBaseline(ctx) {
77804
77847
  sampleText: e.entry.text,
77805
77848
  pages: [pair.key],
77806
77849
  sampleEvidence: [{ kind: "screenshot", path: pair.cand.screenshotPath, label: "cand" }],
77807
- stagingThirdParty
77850
+ stagingThirdParty,
77851
+ failedUrls: failed ? [failed] : []
77808
77852
  });
77809
77853
  } else {
77854
+ if (failed && existing.failedUrls.length < 5)
77855
+ existing.failedUrls.push(failed);
77810
77856
  existing.stagingThirdParty &&= stagingThirdParty;
77811
77857
  if (!existing.pages.includes(pair.key))
77812
77858
  existing.pages.push(pair.key);
@@ -77817,36 +77863,64 @@ function consoleErrorsBaseline(ctx) {
77817
77863
  for (const [key, agg] of byKey) {
77818
77864
  const pageList = agg.pages.length <= 5 ? agg.pages.join(" · ") : `${agg.pages.slice(0, 5).join(" · ")} +${agg.pages.length - 5} more`;
77819
77865
  const pageSuffix = agg.pages.length === 1 ? `em ${agg.pages[0]}` : `em ${agg.pages.length} páginas (${pageList})`;
77820
- const severity = agg.stagingThirdParty ? "low" : agg.cls === "hydration" ? "critical" : "high";
77866
+ const loads = [...candLoads.get(key) ?? []];
77867
+ const verdict = prodKeys.has(key) ? "shared" : agg.stagingThirdParty ? "staging" : BENIGN.some((re) => re.test(agg.sampleText)) ? "benign" : agg.cls !== "hydration" && loads.length < 2 ? "unconfirmed" : "confirmed";
77868
+ const severity = verdict !== "confirmed" ? "low" : agg.cls === "hydration" ? "critical" : "high";
77869
+ const text = truncate(agg.sampleText, 160);
77870
+ const summary = {
77871
+ confirmed: `[${agg.cls}] novo erro de console ${pageSuffix}: ${text}`,
77872
+ staging: `[${agg.cls}] novo erro de console ${pageSuffix}: ${text}`,
77873
+ shared: `[${agg.cls}] erro pré-existente em prod (também em cand) ${pageSuffix} — vale limpar o log: ${text}`,
77874
+ benign: `[${agg.cls}] mensagem benigna do browser ${pageSuffix}: ${text}`,
77875
+ unconfirmed: `[${agg.cls}] erro visto em cand numa só flow (${loads.join(", ")}), não reproduzido ${pageSuffix}: ${text}`
77876
+ }[verdict];
77877
+ const note = {
77878
+ confirmed: "",
77879
+ staging: STAGING_NOTE,
77880
+ shared: "Prod logs this too: not a cand regression, but noise worth cleaning from the logs.",
77881
+ benign: "Known-benign browser message (View Transitions API aborting a transition when a navigation lands mid-animation).",
77882
+ unconfirmed: "Seen on cand in one flow only — the other flows did not show it and prod never did. Not reproduced; re-check by hand before treating it as a regression."
77883
+ }[verdict];
77821
77884
  issues.push({
77822
77885
  id: `console:${hash(key)}`,
77823
77886
  severity,
77824
- ...agg.stagingThirdParty ? { inconclusive: true } : {},
77887
+ ...verdict === "staging" || verdict === "unconfirmed" ? { inconclusive: true } : {},
77825
77888
  category: "console",
77826
77889
  page: agg.pages[0],
77827
77890
  check: "console-errors-baseline",
77828
- summary: `[${agg.cls}] novo erro de console ${pageSuffix}: ${truncate(agg.sampleText, 160)}`,
77891
+ summary,
77829
77892
  details: `${agg.sampleText}
77830
77893
 
77831
- Observed on: ${agg.pages.join(", ")}${agg.stagingThirdParty ? `
77894
+ Observed on: ${agg.pages.join(", ")}${agg.failedUrls.length > 0 ? `
77895
+
77896
+ Failed URLs: ${agg.failedUrls.join(", ")}` : ""}${note ? `
77832
77897
 
77833
- ${STAGING_NOTE}` : ""}`,
77898
+ ${note}` : ""}`,
77834
77899
  evidence: agg.sampleEvidence
77835
77900
  });
77836
77901
  }
77837
77902
  return {
77838
77903
  name: "console-errors-baseline",
77839
- status: issues.some((i) => !i.inconclusive) ? "fail" : issues.length > 0 ? "warn" : "pass",
77904
+ status: issues.some((i) => i.severity === "high" || i.severity === "critical") ? "fail" : issues.length > 0 ? "warn" : "pass",
77840
77905
  severity: "critical",
77841
77906
  durationMs: Date.now() - start,
77842
- summary: issues.length > 0 ? `${issues.length} erro(s) único(s) novo(s) em cand (${totalNew} ocorrência(s) somando todas as páginas)` : `${totalNew} novo(s) erro(s) de console em cand não presentes em prod`,
77907
+ summary: issues.length > 0 ? `${issues.length} erro(s) único(s) em cand (${totalNew} ocorrência(s) nova(s) somando todas as páginas)` : `${totalNew} novo(s) erro(s) de console em cand não presentes em prod`,
77843
77908
  issues
77844
77909
  };
77845
77910
  }
77846
- function isThirdPartyRequest(text, candPageUrl) {
77847
- const url = text.match(/^\[request-failed\] (\S+)/)?.[1];
77848
- if (!url)
77849
- return false;
77911
+ function failedRequestUrl(entry, pageConsole, candPageUrl) {
77912
+ const own = entry.text.match(/^\[request-failed\] (\S+)/)?.[1];
77913
+ if (own)
77914
+ return own;
77915
+ const code = entry.text.match(/^Failed to load resource: (net::[A-Z_]+)/)?.[1];
77916
+ if (!code)
77917
+ return;
77918
+ if (entry.location && /^https?:/.test(entry.location))
77919
+ return entry.location;
77920
+ const candidates = pageConsole.map((c) => c.text.match(/^\[request-failed\] (\S+) — (\S+)/)).filter((m) => m?.[2] === code).map((m) => m[1]);
77921
+ return candidates.find((u) => !isThirdParty2(u, candPageUrl)) ?? candidates[0] ?? null;
77922
+ }
77923
+ function isThirdParty2(url, candPageUrl) {
77850
77924
  try {
77851
77925
  return registrableDomain(new URL(url).hostname) !== registrableDomain(new URL(candPageUrl).hostname);
77852
77926
  } catch {
@@ -78448,14 +78522,36 @@ function average(nums) {
78448
78522
  }
78449
78523
 
78450
78524
  // src/checks/html-structural.ts
78525
+ init_esm10();
78526
+ var COUNT_TOLERANCE = 2;
78451
78527
  function htmlStructuralDiff(ctx) {
78452
78528
  const start = Date.now();
78453
78529
  const { pairs } = pairCaptures(ctx.prodPages, ctx.candPages);
78454
78530
  const issues = [];
78531
+ const staging = isCandOnStagingHost(ctx.prodPages, ctx.candPages, ctx.candIsProduction);
78532
+ const vendorDeltas = [];
78455
78533
  for (const pair of pairs) {
78456
78534
  const prodSnap = snapshotDom(pair.prod.html ?? "");
78457
78535
  const candSnap = snapshotDom(pair.cand.html ?? "");
78458
- const diff = diffDom(prodSnap, candSnap, { countTolerance: 2 });
78536
+ const diff = diffDom(prodSnap, candSnap, { countTolerance: COUNT_TOLERANCE });
78537
+ if (staging) {
78538
+ const site = new Set([pair.prod, pair.cand].map((p) => hostDomain(p.finalUrl || p.url)).filter(Boolean));
78539
+ const lines = [];
78540
+ for (const tag of ["scripts", "iframes"]) {
78541
+ const prod = embeds(pair.prod.html ?? "", tag, site);
78542
+ const cand = embeds(pair.cand.html ?? "", tag, site);
78543
+ delete diff.countsDelta[tag];
78544
+ const d = cand.firstParty - prod.firstParty;
78545
+ if (Math.abs(d) > COUNT_TOLERANCE) {
78546
+ diff.countsDelta[tag] = { prod: prod.firstParty, cand: cand.firstParty, delta: d };
78547
+ }
78548
+ const vendorLine = originDelta(prod.vendor, cand.vendor);
78549
+ if (vendorLine)
78550
+ lines.push(`${tag}: ${vendorLine}`);
78551
+ }
78552
+ if (lines.length > 0)
78553
+ vendorDeltas.push({ page: pair.key, lines });
78554
+ }
78459
78555
  const NOISY = new Set(["imgs"]);
78460
78556
  const structural = Object.entries(diff.countsDelta).filter(([k]) => !NOISY.has(k));
78461
78557
  const noisy = Object.entries(diff.countsDelta).filter(([k]) => NOISY.has(k));
@@ -78468,6 +78564,9 @@ function htmlStructuralDiff(ctx) {
78468
78564
  page: pair.key,
78469
78565
  check: "html-structural-diff",
78470
78566
  summary: `Contagem de elementos divergente em ${pair.key}: ${summary}`,
78567
+ ...staging ? {
78568
+ details: "cand em host de staging: scripts/iframes contados só first-party (inline, relativos ou do domínio do site); os de terceiros estão no issue html-structural:staging-vendors."
78569
+ } : {},
78471
78570
  evidence: [
78472
78571
  { kind: "screenshot", path: pair.prod.screenshotPath, label: "prod" },
78473
78572
  { kind: "screenshot", path: pair.cand.screenshotPath, label: "cand" }
@@ -78500,6 +78599,23 @@ function htmlStructuralDiff(ctx) {
78500
78599
  });
78501
78600
  }
78502
78601
  }
78602
+ if (vendorDeltas.length > 0) {
78603
+ issues.push({
78604
+ id: "html-structural:staging-vendors",
78605
+ severity: "low",
78606
+ inconclusive: true,
78607
+ category: "functional",
78608
+ page: vendorDeltas[0].page,
78609
+ check: "html-structural-diff",
78610
+ summary: `Scripts/iframes de terceiros divergentes em ${vendorDeltas.length} página(s) — não contados (cand em host de staging)`,
78611
+ details: `${vendorDeltas.map((v) => `${v.page}
78612
+ ${v.lines.join(`
78613
+ `)}`).join(`
78614
+ `)}
78615
+
78616
+ ${STAGING_NOTE}`
78617
+ });
78618
+ }
78503
78619
  const hasBlocking = issues.some((i) => i.severity === "high" && !i.inconclusive);
78504
78620
  return {
78505
78621
  name: "html-structural-diff",
@@ -78510,6 +78626,45 @@ function htmlStructuralDiff(ctx) {
78510
78626
  issues
78511
78627
  };
78512
78628
  }
78629
+ function hostDomain(url) {
78630
+ try {
78631
+ return registrableDomain(new URL(url).hostname);
78632
+ } catch {
78633
+ return null;
78634
+ }
78635
+ }
78636
+ function embeds(html, tag, site) {
78637
+ const $ = load(html);
78638
+ let firstParty = 0;
78639
+ const vendor = new Map;
78640
+ $(tag === "scripts" ? "script" : "iframe").each((_, el) => {
78641
+ const src = ($(el).attr("src") ?? "").trim();
78642
+ let origin;
78643
+ if (!src || src === "about:blank")
78644
+ origin = tag === "scripts" ? null : "(sem src)";
78645
+ else if (/^(data|blob|javascript):/i.test(src) || !/^(https?:)?\/\//i.test(src))
78646
+ origin = null;
78647
+ else {
78648
+ const d = hostDomain(src.startsWith("//") ? `https:${src}` : src);
78649
+ origin = d && !site.has(d) ? d : null;
78650
+ }
78651
+ if (origin == null)
78652
+ firstParty++;
78653
+ else
78654
+ vendor.set(origin, (vendor.get(origin) ?? 0) + 1);
78655
+ });
78656
+ return { firstParty, vendor };
78657
+ }
78658
+ function originDelta(prod, cand) {
78659
+ const parts = [];
78660
+ for (const origin of new Set([...prod.keys(), ...cand.keys()])) {
78661
+ const p = prod.get(origin) ?? 0;
78662
+ const c = cand.get(origin) ?? 0;
78663
+ if (p !== c)
78664
+ parts.push(`${origin} ×${p}→${c}`);
78665
+ }
78666
+ return parts.length > 0 ? parts.join(", ") : null;
78667
+ }
78513
78668
 
78514
78669
  // src/checks/http-status.ts
78515
78670
  function httpStatusParity(ctx) {
@@ -78756,6 +78911,57 @@ function extractSectionIds(entries) {
78756
78911
  return out;
78757
78912
  }
78758
78913
 
78914
+ // src/checks/lib/html-snapshot.ts
78915
+ function htmlUnread(page) {
78916
+ return page.htmlSnapshotFailed === true || !page.html;
78917
+ }
78918
+ function withHtmlSnapshot(check) {
78919
+ const guarded = async (ctx) => {
78920
+ const unread = new Map;
78921
+ for (const [side, pages] of [
78922
+ ["prod", ctx.prodPages],
78923
+ ["cand", ctx.candPages]
78924
+ ]) {
78925
+ const readKeys = new Set(pages.filter((p) => !htmlUnread(p)).map(captureKey));
78926
+ for (const p of pages) {
78927
+ const key = captureKey(p);
78928
+ if (readKeys.has(key))
78929
+ continue;
78930
+ const entry = unread.get(key) ?? { sides: [], page: p };
78931
+ if (!entry.sides.includes(side))
78932
+ entry.sides.push(side);
78933
+ unread.set(key, entry);
78934
+ }
78935
+ }
78936
+ if (unread.size === 0)
78937
+ return check(ctx);
78938
+ const keep = (pages) => pages.filter((p) => !unread.has(captureKey(p)));
78939
+ const result = await check({
78940
+ ...ctx,
78941
+ prodPages: keep(ctx.prodPages),
78942
+ candPages: keep(ctx.candPages)
78943
+ });
78944
+ const issues = [...unread].map(([key, { sides, page }]) => ({
78945
+ id: `${result.name}:snapshot-missing:${key}`,
78946
+ severity: "low",
78947
+ inconclusive: true,
78948
+ category: "functional",
78949
+ page: key,
78950
+ check: result.name,
78951
+ summary: `HTML não capturado em ${sides.join(" e ")} (${key}) — página não comparada por ${result.name}`,
78952
+ details: "The page answered but its HTML snapshot came back empty (capture budget spent or the read failed), so this check had nothing to judge on that side. Not a finding: re-run the page, or capture it with `parity html --url`.",
78953
+ evidence: page.screenshotPath ? [{ kind: "screenshot", path: page.screenshotPath }] : []
78954
+ }));
78955
+ return {
78956
+ ...result,
78957
+ status: result.status === "pass" ? "warn" : result.status,
78958
+ issues: [...result.issues, ...issues]
78959
+ };
78960
+ };
78961
+ Object.defineProperty(guarded, "name", { value: check.name });
78962
+ return guarded;
78963
+ }
78964
+
78759
78965
  // src/checks/login-flow.ts
78760
78966
  var STEP_LABELS = {
78761
78967
  "visit-home": "Visitar home",
@@ -79687,35 +79893,66 @@ function matchAny(text, patterns) {
79687
79893
 
79688
79894
  // src/checks/picture-missing-dims.ts
79689
79895
  init_esm10();
79896
+ var FIX = "Adicione width + height (ou aspect-ratio) ao <img> dentro do <Picture>. Use as dimensões intrínsecas da imagem ou as do design (a media query é tratada pelo <source>).";
79690
79897
  function pictureMissingDims(ctx) {
79691
79898
  const start = Date.now();
79692
79899
  const issues = [];
79693
- const offendersByPage = new Map;
79694
- for (const cand of ctx.candPages) {
79695
- const offenders = scanForPictureMissingDims(cand);
79696
- if (offenders.length > 0) {
79697
- offendersByPage.set(`${cand.viewport}:${cand.url}`, offenders);
79698
- }
79699
- }
79700
- for (const [key, offenders] of offendersByPage) {
79701
- issues.push({
79900
+ const single = ctx.prodPages.length === 0;
79901
+ const prodByKey = new Map(ctx.prodPages.map((p) => [captureKey(p), p]));
79902
+ const candByKey = new Map(ctx.candPages.map((c) => [captureKey(c), c]));
79903
+ for (const [pairKey, cand] of candByKey) {
79904
+ const offenders = scanOffenders(cand);
79905
+ if (offenders.length === 0)
79906
+ continue;
79907
+ const key = `${cand.viewport}:${cand.url}`;
79908
+ const base = {
79702
79909
  id: `picture-missing-dims:${key}`,
79703
- severity: "medium",
79704
79910
  category: "performance",
79705
79911
  page: key,
79706
79912
  check: "picture-missing-dims",
79707
- summary: `${offenders.length} <Picture><img/> sem width/height em ${key} — risco de CLS`,
79708
- details: [
79709
- "Picture/img fallbacks sem width+height fazem o browser não reservar espaço",
79710
- "antes do decode. Em network lento, isso vira layout-shift visível.",
79711
- "",
79712
- "Elementos afetados (até 10 mostrados):",
79713
- ...offenders.slice(0, 10).map((s, i) => ` ${i + 1}. ${s}`),
79714
- offenders.length > 10 ? ` … e mais ${offenders.length - 10}` : ""
79715
- ].filter(Boolean).join(`
79716
- `),
79717
- suggestedFix: "Adicione width + height (ou aspect-ratio) ao <img> dentro do <Picture>. Use as dimensões intrínsecas da imagem ou as do design (a media query é tratada pelo <source>)."
79718
- });
79913
+ suggestedFix: FIX
79914
+ };
79915
+ if (single) {
79916
+ issues.push({
79917
+ ...base,
79918
+ severity: "medium",
79919
+ summary: `${offenders.length} <Picture><img/> sem width/height em ${key} — risco de CLS`,
79920
+ details: list("Elementos afetados", offenders)
79921
+ });
79922
+ continue;
79923
+ }
79924
+ const prod = prodByKey.get(pairKey);
79925
+ if (!prod?.html || prod.htmlSnapshotFailed) {
79926
+ issues.push({
79927
+ ...base,
79928
+ severity: "low",
79929
+ inconclusive: true,
79930
+ summary: `${offenders.length} <Picture><img/> sem width/height em ${key} — sem HTML de prod pra comparar`,
79931
+ details: list("Elementos em cand", offenders)
79932
+ });
79933
+ continue;
79934
+ }
79935
+ const prodOffenders = scanOffenders(prod);
79936
+ const delta = offenders.length - prodOffenders.length;
79937
+ if (delta > 0) {
79938
+ const prodFiles = new Set(prodOffenders.map((o) => o.file));
79939
+ const fresh = offenders.filter((o) => !prodFiles.has(o.file));
79940
+ issues.push({
79941
+ ...base,
79942
+ severity: "medium",
79943
+ summary: `${delta} <Picture><img/> a mais sem width/height em ${key} que em prod (cand ${offenders.length} · prod ${prodOffenders.length}) — risco de CLS`,
79944
+ details: list("Elementos sem dimensões só em cand", fresh.length > 0 ? fresh : offenders)
79945
+ });
79946
+ } else {
79947
+ issues.push({
79948
+ ...base,
79949
+ severity: "low",
79950
+ summary: `${offenders.length} <Picture><img/> sem width/height em ${key} — pré-existente em prod (prod ${prodOffenders.length}), vale corrigir`,
79951
+ details: `${list("Elementos afetados", offenders)}
79952
+
79953
+ Prod ships the same gap: not a cand regression, but a CLS source worth fixing on both.`
79954
+ });
79955
+ }
79719
79956
  }
79720
79957
  const status = issues.length > 0 ? "warn" : "pass";
79721
79958
  return {
@@ -79723,12 +79960,23 @@ function pictureMissingDims(ctx) {
79723
79960
  status,
79724
79961
  severity: "medium",
79725
79962
  durationMs: Date.now() - start,
79726
- summary: issues.length === 0 ? `${ctx.candPages.length} página(s) sem <Picture><img/> sem dimensões` : `${issues.length} página(s) com <Picture><img/> sem width/height`,
79963
+ summary: issues.length === 0 ? `${candByKey.size} página(s) sem <Picture><img/> sem dimensões` : `${issues.length} página(s) com <Picture><img/> sem width/height`,
79727
79964
  issues,
79728
- data: { pagesScanned: ctx.candPages.length, pagesWithOffenders: issues.length }
79965
+ data: { pagesScanned: candByKey.size, pagesWithOffenders: issues.length }
79729
79966
  };
79730
79967
  }
79731
- function scanForPictureMissingDims(page) {
79968
+ function list(title, offenders) {
79969
+ return [
79970
+ "Picture/img fallbacks sem width+height fazem o browser não reservar espaço",
79971
+ "antes do decode. Em network lento, isso vira layout-shift visível.",
79972
+ "",
79973
+ `${title} (até 10 mostrados):`,
79974
+ ...offenders.slice(0, 10).map((o, i) => ` ${i + 1}. ${o.desc}`),
79975
+ offenders.length > 10 ? ` … e mais ${offenders.length - 10}` : ""
79976
+ ].filter(Boolean).join(`
79977
+ `);
79978
+ }
79979
+ function scanOffenders(page) {
79732
79980
  if (!page.html)
79733
79981
  return [];
79734
79982
  const $ = load(page.html);
@@ -79741,7 +79989,7 @@ function scanForPictureMissingDims(page) {
79741
79989
  const src = $img.attr("src") ?? $img.attr("data-src") ?? "(no src)";
79742
79990
  const cls = $img.attr("class");
79743
79991
  const desc = cls ? `<img class="${cls.slice(0, 40)}"… src="${src.slice(0, 80)}">` : `<img src="${src.slice(0, 80)}">`;
79744
- offenders.push(desc);
79992
+ offenders.push({ desc, file: src.split(/[?#]/)[0]?.split("/").pop() || src });
79745
79993
  });
79746
79994
  });
79747
79995
  return offenders;
@@ -82826,6 +83074,26 @@ function isFromHttpCache(resp) {
82826
83074
  return true;
82827
83075
  return false;
82828
83076
  }
83077
+ async function readHtml(page, capMs) {
83078
+ let timer;
83079
+ const html = await Promise.race([
83080
+ page.content().catch(() => ""),
83081
+ new Promise((resolve) => {
83082
+ timer = setTimeout(() => resolve(""), capMs);
83083
+ })
83084
+ ]);
83085
+ clearTimeout(timer);
83086
+ return html;
83087
+ }
83088
+ async function snapshotHtml(page, firstCapMs) {
83089
+ const html = await readHtml(page, firstCapMs);
83090
+ if (html)
83091
+ return html;
83092
+ await page.waitForLoadState("load", { timeout: 2000 }).catch(() => {
83093
+ return;
83094
+ });
83095
+ return readHtml(page, 5000);
83096
+ }
82829
83097
  async function capturePage(page, opts) {
82830
83098
  await warmBeforeCapture(page.context(), opts.url, opts.viewport);
82831
83099
  const start = Date.now();
@@ -82842,6 +83110,7 @@ async function capturePage(page, opts) {
82842
83110
  side: opts.side,
82843
83111
  durationMs: Date.now() - start,
82844
83112
  html,
83113
+ ...!html && (response?.status() ?? 0) > 0 ? { htmlSnapshotFailed: true } : {},
82845
83114
  vitals: vitals ?? { lcp: null, cls: null, fcp: null, ttfb: null, inp: null },
82846
83115
  vitalsStats,
82847
83116
  vitalsFullPage: vitalsFullPage ?? undefined,
@@ -82982,10 +83251,7 @@ async function capturePage(page, opts) {
82982
83251
  dlog(opts.side, opts.viewport, " capturePage: screenshot done");
82983
83252
  }
82984
83253
  dlog(opts.side, opts.viewport, ` capturePage: page.content() (cap=${Math.min(5000, remaining())}ms)`);
82985
- html = await Promise.race([
82986
- page.content().catch(() => ""),
82987
- new Promise((resolve) => setTimeout(() => resolve(""), Math.min(5000, remaining())))
82988
- ]);
83254
+ html = await snapshotHtml(page, Math.min(5000, remaining()));
82989
83255
  dlog(opts.side, opts.viewport, ` capturePage: flushCollectors (cap=${Math.min(3000, remaining())}ms)`);
82990
83256
  await flushCollectors(state, Math.min(3000, remaining()));
82991
83257
  const extraRuns = Math.max(0, (opts.runs ?? 1) - 1);
@@ -83014,15 +83280,18 @@ async function capturePage(page, opts) {
83014
83280
  };
83015
83281
  const SAFETY_MARGIN_MS = 1e4;
83016
83282
  const outerDeadlineMs = overallBudgetMs + SAFETY_MARGIN_MS;
83283
+ let outerTimer;
83017
83284
  const result = await Promise.race([
83018
83285
  inner(),
83019
- new Promise((resolve) => setTimeout(() => {
83020
- state.console.push({
83021
- type: "error",
83022
- text: `[capture-timeout] capturePage exceeded ${outerDeadlineMs}ms outer deadline — returning partial capture`
83023
- });
83024
- resolve(buildPartial());
83025
- }, outerDeadlineMs)),
83286
+ new Promise((resolve) => {
83287
+ outerTimer = setTimeout(() => {
83288
+ state.console.push({
83289
+ type: "error",
83290
+ text: `[capture-timeout] capturePage exceeded ${outerDeadlineMs}ms outer deadline — returning partial capture`
83291
+ });
83292
+ resolve(buildPartial());
83293
+ }, outerDeadlineMs);
83294
+ }),
83026
83295
  disconnectPromise.then(() => {
83027
83296
  state.console.push({
83028
83297
  type: "error",
@@ -83031,6 +83300,7 @@ async function capturePage(page, opts) {
83031
83300
  return buildPartial();
83032
83301
  })
83033
83302
  ]);
83303
+ clearTimeout(outerTimer);
83034
83304
  browser?.off("disconnected", handleBrowserDisconnect);
83035
83305
  page.off("crash", handlePageCrash);
83036
83306
  return result;
@@ -85826,6 +86096,18 @@ var COLOR_PROPS = /^(color|background-color|border-color|fill|stroke)$/;
85826
86096
  var SPACING_PROPS = /^(margin|padding|gap|row-gap|column-gap)/;
85827
86097
  var SIZE_PROPS = /^(rect\.(width|height)|width|height)$/;
85828
86098
  var POSITION_PROPS = /^rect\.(offsetX|offsetY)$/;
86099
+ var SUBPIXEL_PX = 1;
86100
+ function isSubpixelGeometry(d) {
86101
+ return !!d?.prop.startsWith("rect.") && d.deltaPx != null && Math.abs(d.deltaPx) < SUBPIXEL_PX;
86102
+ }
86103
+ var WHITE = /^(white|#fff|#ffffff|rgba?\(255, 255, 255(, 1)?\))$/i;
86104
+ var TRANSPARENT = /^(transparent|rgba\(0, 0, 0, 0\))$/i;
86105
+ function isRootCanvasNoop(d) {
86106
+ if (d.key !== "body" && d.key !== "html" || d.prop !== "background-color")
86107
+ return false;
86108
+ const sides = [d.prod.trim(), d.cand.trim()];
86109
+ return sides.some((v) => WHITE.test(v)) && sides.some((v) => TRANSPARENT.test(v));
86110
+ }
85829
86111
  var IMAGE_TAGS = new Set(["img", "picture", "svg", "video", "canvas"]);
85830
86112
  function rankNodes(a, b) {
85831
86113
  const aExplains = a.deltas.length > 0;
@@ -85841,6 +86123,8 @@ function attributeHotspots(args) {
85841
86123
  const max = args.maxNodesPerHotspot ?? 3;
85842
86124
  const deltasByKey = new Map;
85843
86125
  for (const d of args.deltas) {
86126
+ if (isRootCanvasNoop(d))
86127
+ continue;
85844
86128
  const list = deltasByKey.get(d.key);
85845
86129
  if (list)
85846
86130
  list.push(d);
@@ -85866,21 +86150,25 @@ function attributeHotspots(args) {
85866
86150
  hotspot,
85867
86151
  nodes: candidates,
85868
86152
  truncated: args.truncated,
85869
- summary: describe2(type, hotspot, candidates, args.imageHostDelta ?? [], because)
86153
+ summary: describe2(type, hotspot, candidates, args.imageHostDelta ?? [], because),
86154
+ ...because ? { because } : {}
85870
86155
  };
85871
86156
  });
85872
86157
  }
85873
86158
  function classify2(nodes, imageHostDelta) {
85874
86159
  const deltas = nodes.flatMap((n) => n.deltas);
86160
+ const real = (d) => !isSubpixelGeometry(d);
85875
86161
  const byKind = [
85876
- ["offset", POSITION_PROPS],
85877
- ["typography", TYPOGRAPHY_PROPS],
85878
- ["color", COLOR_PROPS],
85879
- ["size", SIZE_PROPS],
85880
- ["spacing", SPACING_PROPS]
86162
+ ["offset", (d) => POSITION_PROPS.test(d.prop) && real(d)],
86163
+ ["typography", (d) => TYPOGRAPHY_PROPS.test(d.prop)],
86164
+ ["color", (d) => COLOR_PROPS.test(d.prop)],
86165
+ ["size", (d) => SIZE_PROPS.test(d.prop) && real(d)],
86166
+ ["spacing", (d) => SPACING_PROPS.test(d.prop)],
86167
+ ["offset", (d) => POSITION_PROPS.test(d.prop)],
86168
+ ["size", (d) => SIZE_PROPS.test(d.prop)]
85881
86169
  ];
85882
- for (const [type, re] of byKind) {
85883
- const because = deltas.find((d) => re.test(d.prop));
86170
+ for (const [type, matches] of byKind) {
86171
+ const because = deltas.find(matches);
85884
86172
  if (because)
85885
86173
  return { type, because };
85886
86174
  }
@@ -87971,7 +88259,8 @@ function explainHotspots(hotspots, prod, cand, paths, prodBoxTree, candBoxTree)
87971
88259
  const c = candBoxTree;
87972
88260
  const paired = p?.found && c?.found ? diffBoxTrees(p.nodes, c.nodes, {
87973
88261
  truncated: p.truncated || c.truncated,
87974
- tolerancePx: 0
88262
+ tolerancePx: 0,
88263
+ maxDeltas: Number.POSITIVE_INFINITY
87975
88264
  }) : null;
87976
88265
  return attributeHotspots({
87977
88266
  hotspots,
@@ -88379,6 +88668,21 @@ function findingSeverity(f) {
88379
88668
  return "medium";
88380
88669
  return "low";
88381
88670
  }
88671
+ var MIN_REGION_PIXELS = 9;
88672
+ function isImperceptible(f) {
88673
+ if (f.type === "horizontal-overflow")
88674
+ return false;
88675
+ if (f.hotspot.pixelCount < MIN_REGION_PIXELS)
88676
+ return true;
88677
+ return isSubpixelGeometry(f.because);
88678
+ }
88679
+ function everyRegionImperceptible(heatmapPath, prod, cand, diffDir, prefix, viewport) {
88680
+ const all = analyzeHeatmapRegions(heatmapPath, {
88681
+ minComponentPixels: 1,
88682
+ maxHotspots: Number.POSITIVE_INFINITY
88683
+ });
88684
+ return explainHotspots(all.hotspots, prod.side, cand.side, artifactPaths(diffDir, prefix, viewport), prod.boxTree, cand.boxTree).every(isImperceptible);
88685
+ }
88382
88686
  var WHERE_RE = / ?at \d+,\d+ — \d+×\d+/;
88383
88687
  function unionBox(a, b) {
88384
88688
  const x = Math.min(a.x, b.x);
@@ -88489,7 +88793,8 @@ async function visualRegressionKeyframes(ctx) {
88489
88793
  const candSections = pair.cand.html ? snapshotDom(pair.cand.html).decoSectionsRendered : [];
88490
88794
  const sectionsOnlyInProd = prodSections.filter((s) => !candSections.includes(s));
88491
88795
  const sectionsOnlyInCand = candSections.filter((s) => !prodSections.includes(s));
88492
- const merged = mergeSameClaim(r.findings);
88796
+ const noise = r.findings.filter(isImperceptible);
88797
+ const merged = mergeSameClaim(r.findings.filter((f) => !isImperceptible(f)));
88493
88798
  const tracks = carouselTrackShift(merged);
88494
88799
  const inTrack = new Set(tracks.flat());
88495
88800
  const findings = [
@@ -88506,7 +88811,9 @@ async function visualRegressionKeyframes(ctx) {
88506
88811
  hotspot: g.map((f) => f.hotspot).reduce(unionBox)
88507
88812
  }))
88508
88813
  ];
88509
- const verdict = VERDICT[r.verdict];
88814
+ const allNoise = r.verdict === "differs" && findings.length === 0 && noise.length > 0 && r.heatmapPath != null && everyRegionImperceptible(r.heatmapPath, prod, cand, diffDir, prefix, pair.viewport);
88815
+ const verdict = allNoise ? "pass" : VERDICT[r.verdict];
88816
+ const reason = allNoise ? `${r.diffPixels} differing px, all imperceptible: sub-pixel offsets or regions under ${MIN_REGION_PIXELS}px` : r.reason;
88510
88817
  results.push({
88511
88818
  pageKey: pair.key,
88512
88819
  pagePath: pair.key.split("::")[0] ?? "/",
@@ -88530,7 +88837,7 @@ async function visualRegressionKeyframes(ctx) {
88530
88837
  ...r.diffPixels != null ? { diffPixels: r.diffPixels } : {},
88531
88838
  ...r.noiseFloorPixels != null ? { noiseFloorPixels: r.noiseFloorPixels } : {},
88532
88839
  ...r.maskedCoverage != null ? { maskedCoverage: r.maskedCoverage } : {},
88533
- ...r.reason ? { reason: r.reason } : {}
88840
+ ...reason ? { reason } : {}
88534
88841
  });
88535
88842
  const evidence = [
88536
88843
  { kind: "screenshot", path: pair.prod.screenshotPath, label: "prod" },
@@ -88748,89 +89055,106 @@ function fmt(n) {
88748
89055
  }
88749
89056
 
88750
89057
  // src/checks/index.ts
89058
+ var bannerAspectRatio2 = withHtmlSnapshot(bannerAspectRatio);
89059
+ var contentStructureParity2 = withHtmlSnapshot(contentStructureParity);
89060
+ var cookieCepModalCls2 = withHtmlSnapshot(cookieCepModalCls);
89061
+ var faviconParity2 = withHtmlSnapshot(faviconParity);
89062
+ var fontParity2 = withHtmlSnapshot(fontParity);
89063
+ var footerLinksHealth2 = withHtmlSnapshot(footerLinksHealth);
89064
+ var htmlStructuralDiff2 = withHtmlSnapshot(htmlStructuralDiff);
89065
+ var imageLoadingHealth2 = withHtmlSnapshot(imageLoadingHealth);
89066
+ var lazySectionPresence2 = withHtmlSnapshot(lazySectionPresence);
89067
+ var metaSeoParity2 = withHtmlSnapshot(metaSeoParity);
89068
+ var navLinksHealth2 = withHtmlSnapshot(navLinksHealth);
89069
+ var notFoundParity2 = withHtmlSnapshot(notFoundParity);
89070
+ var pdpBreadcrumbs2 = withHtmlSnapshot(pdpBreadcrumbs);
89071
+ var pdpGalleryRelated2 = withHtmlSnapshot(pdpGalleryRelated);
89072
+ var pictureMissingDims2 = withHtmlSnapshot(pictureMissingDims);
89073
+ var sectionOrderParity2 = withHtmlSnapshot(sectionOrderParity);
89074
+ var seoDeepAudit2 = withHtmlSnapshot(seoDeepAudit);
88751
89075
  var ALL_CHECKS = [
88752
89076
  httpStatusParity,
88753
89077
  consoleErrorsBaseline,
88754
- htmlStructuralDiff,
88755
- metaSeoParity,
89078
+ htmlStructuralDiff2,
89079
+ metaSeoParity2,
88756
89080
  visualRegressionKeyframes,
88757
89081
  purchaseJourneyFlow,
88758
89082
  networkSummaryDelta,
88759
89083
  webVitalsMobile,
88760
- imageLoadingHealth,
88761
- bannerAspectRatio,
89084
+ imageLoadingHealth2,
89085
+ bannerAspectRatio2,
88762
89086
  cartRevealModeDivergence,
88763
- lazySectionPresence,
88764
- seoDeepAudit,
89087
+ lazySectionPresence2,
89088
+ seoDeepAudit2,
88765
89089
  cacheCoverage,
88766
89090
  searchPresence,
88767
89091
  searchAutocomplete,
88768
89092
  searchResults,
88769
89093
  searchNoResults,
88770
89094
  cartInteractionsFlow,
88771
- notFoundParity,
88772
- cookieCepModalCls,
88773
- pdpGalleryRelated,
88774
- footerLinksHealth,
89095
+ notFoundParity2,
89096
+ cookieCepModalCls2,
89097
+ pdpGalleryRelated2,
89098
+ footerLinksHealth2,
88775
89099
  loginFlow,
88776
- pictureMissingDims,
89100
+ pictureMissingDims2,
88777
89101
  plpPagination,
88778
- pdpBreadcrumbs,
89102
+ pdpBreadcrumbs2,
88779
89103
  plpSorting,
88780
89104
  spaNavigationFlow,
88781
89105
  serverFnHoverFlood,
88782
- faviconParity,
88783
- fontParity,
88784
- contentStructureParity,
89106
+ faviconParity2,
89107
+ fontParity2,
89108
+ contentStructureParity2,
88785
89109
  ssrNoJs,
88786
- navLinksHealth,
89110
+ navLinksHealth2,
88787
89111
  redirectsParity,
88788
89112
  thirdPartyScriptsParity,
88789
89113
  analyticsBeaconParity,
88790
- sectionOrderParity,
89114
+ sectionOrderParity2,
88791
89115
  sweepFlows
88792
89116
  ];
88793
89117
  var ALL_CHECKS_BY_NAME = {
88794
89118
  "http-status-parity": httpStatusParity,
88795
89119
  "console-errors-baseline": consoleErrorsBaseline,
88796
- "html-structural-diff": htmlStructuralDiff,
88797
- "meta-seo-parity": metaSeoParity,
89120
+ "html-structural-diff": htmlStructuralDiff2,
89121
+ "meta-seo-parity": metaSeoParity2,
88798
89122
  "visual-regression-keyframes": visualRegressionKeyframes,
88799
89123
  "purchase-journey-flow": purchaseJourneyFlow,
88800
89124
  "network-summary-delta": networkSummaryDelta,
88801
89125
  "web-vitals-mobile": webVitalsMobile,
88802
- "image-loading-health": imageLoadingHealth,
88803
- "banner-aspect-ratio": bannerAspectRatio,
89126
+ "image-loading-health": imageLoadingHealth2,
89127
+ "banner-aspect-ratio": bannerAspectRatio2,
88804
89128
  "cart-reveal-mode-divergence": cartRevealModeDivergence,
88805
- "lazy-section-presence": lazySectionPresence,
88806
- "seo-deep-audit": seoDeepAudit,
89129
+ "lazy-section-presence": lazySectionPresence2,
89130
+ "seo-deep-audit": seoDeepAudit2,
88807
89131
  "cache-coverage": cacheCoverage,
88808
89132
  "search-presence": searchPresence,
88809
89133
  "search-autocomplete": searchAutocomplete,
88810
89134
  "search-results": searchResults,
88811
89135
  "search-no-results": searchNoResults,
88812
89136
  "cart-interactions-flow": cartInteractionsFlow,
88813
- "not-found-parity": notFoundParity,
88814
- "cookie-cep-modal-cls": cookieCepModalCls,
88815
- "pdp-gallery-related": pdpGalleryRelated,
88816
- "footer-links-health": footerLinksHealth,
89137
+ "not-found-parity": notFoundParity2,
89138
+ "cookie-cep-modal-cls": cookieCepModalCls2,
89139
+ "pdp-gallery-related": pdpGalleryRelated2,
89140
+ "footer-links-health": footerLinksHealth2,
88817
89141
  "login-flow": loginFlow,
88818
89142
  "sweep-flows": sweepFlows,
88819
- "picture-missing-dims": pictureMissingDims,
89143
+ "picture-missing-dims": pictureMissingDims2,
88820
89144
  "plp-pagination": plpPagination,
88821
- "pdp-breadcrumbs": pdpBreadcrumbs,
89145
+ "pdp-breadcrumbs": pdpBreadcrumbs2,
88822
89146
  "plp-sorting": plpSorting,
88823
89147
  "spa-navigation-flow": spaNavigationFlow,
88824
89148
  "serverfn-hover-flood": serverFnHoverFlood,
88825
- "favicon-parity": faviconParity,
88826
- "font-parity": fontParity,
88827
- "content-structure": contentStructureParity,
89149
+ "favicon-parity": faviconParity2,
89150
+ "font-parity": fontParity2,
89151
+ "content-structure": contentStructureParity2,
88828
89152
  "ssr-no-js": ssrNoJs,
88829
- "nav-links-health": navLinksHealth,
89153
+ "nav-links-health": navLinksHealth2,
88830
89154
  "redirects-parity": redirectsParity,
88831
89155
  "third-party-scripts-parity": thirdPartyScriptsParity,
88832
89156
  "analytics-beacon-parity": analyticsBeaconParity,
88833
- "section-order-parity": sectionOrderParity
89157
+ "section-order-parity": sectionOrderParity2
88834
89158
  };
88835
89159
  var FLOW_DEPENDENT_CHECKS = new Set([
88836
89160
  "purchase-journey-flow",
@@ -89131,6 +89455,7 @@ var PageCapture = z2.object({
89131
89455
  side: Side,
89132
89456
  durationMs: z2.number(),
89133
89457
  html: z2.string().optional(),
89458
+ htmlSnapshotFailed: z2.boolean().optional(),
89134
89459
  vitals: WebVitals,
89135
89460
  vitalsStats: WebVitalsStats.optional(),
89136
89461
  vitalsFullPage: WebVitals.optional(),
@@ -90578,6 +90903,7 @@ var REPORT_CSS = `
90578
90903
  .sb-table small { color: var(--text-muted); }
90579
90904
  .sb-status { font-size: 11px; font-weight: 600; text-transform: uppercase; }
90580
90905
  .sb-cap { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
90906
+ .sb-weighed { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
90581
90907
  .sb-lost { display: flex; align-items: center; gap: 8px; min-width: 180px; }
90582
90908
  .sb-bar { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-overlay); overflow: hidden; }
90583
90909
  .sb-bar span { display: block; height: 100%; background: var(--state-bad); }
@@ -92599,7 +92925,7 @@ function sameSet(a, b) {
92599
92925
  const sb = [...b].sort();
92600
92926
  return sa.every((v, i) => v === sb[i]);
92601
92927
  }
92602
- var list = (v) => v.length ? v.join(", ") : "none";
92928
+ var list2 = (v) => v.length ? v.join(", ") : "none";
92603
92929
  function descendantWithTransition(nodes, ancestorKey, props) {
92604
92930
  const wanted = new Set(props);
92605
92931
  for (const n of nodes) {
@@ -92620,20 +92946,20 @@ function diffTransitions(p, c, candNodes) {
92620
92946
  if (pOn && !cOn) {
92621
92947
  const inner = descendantWithTransition(candNodes, c.key, p.transition.properties);
92622
92948
  if (inner) {
92623
- out.push(finding(p, "moved-to-descendant", `prod transitions ${list(p.transition.properties)} over ${Math.max(...p.transition.durationsMs)}ms on this node; cand declares it on a DESCENDANT instead (${inner.key}: ${list(inner.transition.properties)} over ${Math.max(...inner.transition.durationsMs)}ms). The effect exists — the node carrying it differs, which is a structural difference, not a lost transition.`, at));
92949
+ out.push(finding(p, "moved-to-descendant", `prod transitions ${list2(p.transition.properties)} over ${Math.max(...p.transition.durationsMs)}ms on this node; cand declares it on a DESCENDANT instead (${inner.key}: ${list2(inner.transition.properties)} over ${Math.max(...inner.transition.durationsMs)}ms). The effect exists — the node carrying it differs, which is a structural difference, not a lost transition.`, at));
92624
92950
  return out;
92625
92951
  }
92626
- out.push(finding(p, "missing-transition", `prod transitions ${list(p.transition.properties)} over ${Math.max(...p.transition.durationsMs)}ms; cand's node ${c.key} has no transition, and no descendant of it declares one either (the change is instant)`, at));
92952
+ out.push(finding(p, "missing-transition", `prod transitions ${list2(p.transition.properties)} over ${Math.max(...p.transition.durationsMs)}ms; cand's node ${c.key} has no transition, and no descendant of it declares one either (the change is instant)`, at));
92627
92953
  return out;
92628
92954
  }
92629
92955
  if (!pOn && cOn) {
92630
- out.push(finding(p, "extra-transition", `cand transitions ${list(c.transition.properties)}; prod does not (the migration added motion)`, at));
92956
+ out.push(finding(p, "extra-transition", `cand transitions ${list2(c.transition.properties)}; prod does not (the migration added motion)`, at));
92631
92957
  return out;
92632
92958
  }
92633
92959
  if (!pOn && !cOn)
92634
92960
  return out;
92635
92961
  if (!sameSet(p.transition.properties, c.transition.properties)) {
92636
- out.push(finding(p, "property-set", `transitioned properties differ: prod [${list(p.transition.properties)}] vs cand [${list(c.transition.properties)}]`, at));
92962
+ out.push(finding(p, "property-set", `transitioned properties differ: prod [${list2(p.transition.properties)}] vs cand [${list2(c.transition.properties)}]`, at));
92637
92963
  }
92638
92964
  const pd = Math.max(...p.transition.durationsMs);
92639
92965
  const cd = Math.max(...c.transition.durationsMs);
@@ -92641,7 +92967,7 @@ function diffTransitions(p, c, candNodes) {
92641
92967
  out.push(finding(p, "duration", `transition duration ${pd}ms → ${cd}ms`, at));
92642
92968
  }
92643
92969
  if (!sameSet(p.transition.easings, c.transition.easings)) {
92644
- out.push(finding(p, "easing", `transition easing [${list(p.transition.easings)}] → [${list(c.transition.easings)}]`, at));
92970
+ out.push(finding(p, "easing", `transition easing [${list2(p.transition.easings)}] → [${list2(c.transition.easings)}]`, at));
92645
92971
  }
92646
92972
  const pdel = Math.max(0, ...p.transition.delaysMs);
92647
92973
  const cdel = Math.max(0, ...c.transition.delaysMs);
@@ -92659,11 +92985,11 @@ function diffAnimations(p, c) {
92659
92985
  const pNames = p.animation.names.filter((n) => n && n !== "none");
92660
92986
  const cNames = c.animation.names.filter((n) => n && n !== "none");
92661
92987
  if (pNames.length > 0 && cNames.length === 0) {
92662
- out.push(finding(p, "missing-animation", `prod animates [${list(pNames)}]; cand has no animation`, at));
92988
+ out.push(finding(p, "missing-animation", `prod animates [${list2(pNames)}]; cand has no animation`, at));
92663
92989
  return out;
92664
92990
  }
92665
92991
  if (pNames.length === 0 && cNames.length > 0) {
92666
- out.push(finding(p, "extra-animation", `cand animates [${list(cNames)}]; prod does not`, at));
92992
+ out.push(finding(p, "extra-animation", `cand animates [${list2(cNames)}]; prod does not`, at));
92667
92993
  return out;
92668
92994
  }
92669
92995
  if (pNames.length === 0)
@@ -98737,7 +99063,13 @@ function explainCompositeScore(moduleVerdicts, verdict, checks) {
98737
99063
  }).sort((a, b) => b.pointsLost - a.pointsLost || a.module.localeCompare(b.module));
98738
99064
  const uncappedScore = Math.round(moduleVerdicts.reduce((s, mv) => s + mv.score * moduleWeight(mv), 0) / weightSum);
98739
99065
  const failed = verdict.status === "fail";
98740
- const failedBy = failed ? [...failedChecks(), ...criticalNote(verdict.critical)] : [];
99066
+ const liveCritical = checks.flatMap((c) => c.issues).filter((i) => i.severity === "critical" && !i.inconclusive && !i.accepted).length;
99067
+ const unjudgedCritical = Math.max(0, verdict.critical - liveCritical);
99068
+ const failedBy = failed ? [
99069
+ ...failedChecks(),
99070
+ ...criticalNote(verdict.critical - unjudgedCritical),
99071
+ ...unjudgedCritical > 0 ? [`${unjudgedCritical} critical, inconclusive or accepted`] : []
99072
+ ] : [];
98741
99073
  const capBy = capRuleV3 ? triggers() : failedBy;
98742
99074
  if ((capBy.length > 0 ? Math.min(uncappedScore, FAIL_SCORE_CAP) : uncappedScore) !== verdict.score) {
98743
99075
  return null;
@@ -99196,7 +99528,10 @@ function tabHelp(text) {
99196
99528
  function renderDashboard2(run) {
99197
99529
  const v = run.verdict;
99198
99530
  const inconclusive = v.status === "inconclusive";
99199
- const statusLabel = inconclusive ? "Inconclusive" : v.status === "pass" ? "Excellent" : v.status === "warn" ? "Warnings" : v.critical > 0 ? "Critical" : "Fail";
99531
+ const { live } = splitFindings(run.issues);
99532
+ const critical = live.filter((i) => i.severity === "critical").length;
99533
+ const blocking = critical + live.filter((i) => i.severity === "high").length;
99534
+ const statusLabel = inconclusive ? "Inconclusive" : v.status === "pass" ? "Excellent" : v.status === "warn" ? "Warnings" : critical > 0 ? "Critical" : "Fail";
99200
99535
  const ringColor = inconclusive ? "var(--text-dim, #888)" : v.status === "pass" ? "var(--state-good)" : v.status === "warn" ? "var(--state-warn)" : "var(--state-bad)";
99201
99536
  const ringDeg = inconclusive ? "0deg" : `${Math.round(v.score / 100 * 360)}deg`;
99202
99537
  const prev = run.previousRun;
@@ -99219,7 +99554,7 @@ function renderDashboard2(run) {
99219
99554
  ${renderVisualParity(run)}
99220
99555
  ${inconclusive ? "" : deltaChip}
99221
99556
  ${renderAcceptedFindings(run)}
99222
- <div class="verdict-sub">${inconclusive ? "Nothing was measured — 0 checks ran, so this run says nothing about parity." : `${v.critical + v.high} blocking issue${v.critical + v.high !== 1 ? "s" : ""} ${v.critical > 0 ? `(${v.critical} critical)` : ""}`}</div>
99557
+ <div class="verdict-sub">${inconclusive ? "Nothing was measured — 0 checks ran, so this run says nothing about parity." : `${blocking} blocking issue${blocking !== 1 ? "s" : ""} ${critical > 0 ? `(${critical} critical)` : ""}`}</div>
99223
99558
  <div class="verdict-meta">
99224
99559
  <span><strong>${v.checksPassed}</strong> checks pass</span>
99225
99560
  <span><strong>${v.checksFailed}</strong> fail</span>
@@ -99271,8 +99606,12 @@ function renderScoreBreakdown(run) {
99271
99606
  const totalLost = ex.modules.reduce((s, m) => s + m.pointsLost, 0);
99272
99607
  const maxLost = Math.max(...ex.modules.map((m) => m.pointsLost), 0.0001);
99273
99608
  const capNote = (by) => by.length > 0 ? `<div class="sb-cap">held at ${FAIL_SCORE_CAP} by ${escapeHtml(by.join(", "))}</div>` : "";
99609
+ const weighed = (mod) => {
99610
+ const line = moduleWeighedBy(run, mod);
99611
+ return line ? `<div class="sb-weighed">${escapeHtml(line)}</div>` : "";
99612
+ };
99274
99613
  const rows = ex.modules.map((m) => `<tr>
99275
- <td><strong>${escapeHtml(m.module)}</strong>${capNote(m.cappedBy)}</td>
99614
+ <td><strong>${escapeHtml(m.module)}</strong>${weighed(m.module)}${capNote(m.cappedBy)}</td>
99276
99615
  <td><span class="sb-status" style="color:${STATUS_COLOR[m.status]}">${m.status}</span></td>
99277
99616
  <td class="num" style="color:${STATUS_COLOR[m.status]}">${m.score}</td>
99278
99617
  <td class="num">${Math.round(m.weightShare * 100)}%<small> · ${m.weight} page${m.weight === 1 ? "" : "s"}</small></td>
@@ -99297,7 +99636,22 @@ function splitFindings(issues) {
99297
99636
  const accepted = issues.filter((i) => i.accepted).length;
99298
99637
  const suffix = (notJudged > 0 ? ` · +${notJudged} not judged (inconclusive)` : "") + (accepted > 0 ? ` · ${accepted} accepted` : "");
99299
99638
  const state = notJudged > 0 ? "info" : "pass";
99300
- return { live, suffix, state };
99639
+ return { live, notJudged, suffix, state };
99640
+ }
99641
+ function liveBadge(issues) {
99642
+ const s = splitFindings(issues);
99643
+ return `${s.live.length}${s.notJudged > 0 ? ` · +${s.notJudged}` : ""}`;
99644
+ }
99645
+ function liveByCheck(run, module) {
99646
+ return run.checks.filter((c) => moduleOfCheck(c.name) === module).map((c) => [c.name, splitFindings(c.issues).live.length]).filter(([, n]) => n > 0).map(([name, n]) => `${name} ${n}`);
99647
+ }
99648
+ function moduleWeighedBy(run, module) {
99649
+ const parts = liveByCheck(run, module);
99650
+ const vd = run.visualDiff;
99651
+ if (module === "visual" && vd && vd.pagesChecked > 0) {
99652
+ parts.unshift(`visual parity ${vd.pagesPassed}/${vd.pagesChecked} pages match`);
99653
+ }
99654
+ return parts.join(" · ");
99301
99655
  }
99302
99656
  function journeyTile(run, pj) {
99303
99657
  const failed = (pj.data ?? {}).failedSteps ?? 0;
@@ -99347,12 +99701,13 @@ function buildTiles(run) {
99347
99701
  }
99348
99702
  const vitals = run.checks.find((c) => c.name === "web-vitals-mobile");
99349
99703
  if (vitals) {
99704
+ const s = splitFindings(vitals.issues);
99350
99705
  tiles.push({
99351
99706
  icon: "\uD83D\uDCCA",
99352
99707
  label: "Vitals",
99353
- value: vitals.status === "pass" ? "✓" : vitals.issues.length.toString(),
99354
- meta: vitals.status === "pass" ? "no regressions" : `${vitals.issues.length} regression(s)`,
99355
- state: vitals.status === "pass" ? "pass" : "fail",
99708
+ value: vitals.status === "pass" ? "✓" : `${s.live.length}`,
99709
+ meta: vitals.status === "pass" ? "no regressions" : `${s.live.length} regression(s)${s.suffix}`,
99710
+ state: vitals.status === "pass" ? "pass" : s.live.length > 0 ? "fail" : s.state,
99356
99711
  href: "#detail/web-vitals-mobile"
99357
99712
  });
99358
99713
  }
@@ -99384,13 +99739,15 @@ function buildTiles(run) {
99384
99739
  const visual = run.checks.find((c) => c.name === "visual-regression-keyframes");
99385
99740
  if (visual) {
99386
99741
  const vd = run.visualDiff;
99387
- const value = vd ? `${vd.pagesWithDiffs}/${vd.pagesChecked}` : visual.issues.length.toString();
99388
- const meta = visual.status === "skipped" ? "not run" : vd && vd.pagesChecked > 0 ? vd.pagesWithDiffs > 0 ? `${vd.pagesWithDiffs} page(s) with diff` : vd.pagesFailed > 0 ? `${vd.pagesFailed} page(s) not compared` : "all pages identical" : visual.status === "pass" ? "no visual regression" : "nothing compared";
99742
+ const value = vd ? `${vd.pagesPassed}/${vd.pagesChecked}` : visual.issues.length.toString();
99743
+ const layout = liveByCheck(run, "visual").filter((p) => !p.startsWith(`${visual.name} `));
99744
+ const layoutNote = layout.length > 0 ? ` · not pixel diffs: ${layout.join(", ")}` : "";
99745
+ const pixelMeta = visual.status === "skipped" ? "not run" : vd && vd.pagesChecked > 0 ? vd.pagesWithDiffs > 0 ? `${vd.pagesWithDiffs} page(s) with diff` : vd.pagesFailed > 0 ? `${vd.pagesFailed} page(s) not compared` : "all pages identical" : visual.status === "pass" ? "no visual regression" : "nothing compared";
99389
99746
  tiles.push({
99390
99747
  icon: "\uD83D\uDDBC",
99391
99748
  label: "Visual",
99392
99749
  value,
99393
- meta,
99750
+ meta: pixelMeta + layoutNote,
99394
99751
  state: visual.status === "pass" ? "pass" : visual.status === "skipped" ? "info" : "warn",
99395
99752
  href: "#detail/visual-regression-keyframes"
99396
99753
  });
@@ -100402,11 +100759,30 @@ function renderPromptPanel(run) {
100402
100759
  </div>`;
100403
100760
  }
100404
100761
  function buildNav(run) {
100762
+ const vd = run.visualDiff;
100405
100763
  const entries = [
100406
100764
  { tab: "summary", label: "Dashboard", icon: "\uD83C\uDFE0" },
100407
- { tab: "visualdiff", label: "Visual Diff", icon: "\uD83D\uDDBC", count: run.visualDiff?.pagesWithDiffs },
100408
- { tab: "seo", label: "SEO", icon: "\uD83D\uDD0D", count: run.seo?.issues.length },
100409
- { tab: "issues", label: "Issues", icon: "⚠", count: run.issues.length },
100765
+ {
100766
+ tab: "visualdiff",
100767
+ label: "Visual Diff",
100768
+ icon: "\uD83D\uDDBC",
100769
+ count: vd ? `${vd.pagesWithDiffs}${vd.pagesFailed > 0 ? ` · +${vd.pagesFailed}` : ""}` : undefined,
100770
+ countTitle: "pages with differences · +pages not compared"
100771
+ },
100772
+ {
100773
+ tab: "seo",
100774
+ label: "SEO",
100775
+ icon: "\uD83D\uDD0D",
100776
+ count: run.seo ? liveBadge(run.seo.issues) : undefined,
100777
+ countTitle: "live findings · +not judged (inconclusive)"
100778
+ },
100779
+ {
100780
+ tab: "issues",
100781
+ label: "Issues",
100782
+ icon: "⚠",
100783
+ count: liveBadge(run.issues),
100784
+ countTitle: "live findings · +not judged (inconclusive)"
100785
+ },
100410
100786
  { tab: "vitals", label: "Vitals", icon: "\uD83D\uDCCA" },
100411
100787
  { tab: "cache", label: "Cache", icon: "\uD83D\uDCBE" },
100412
100788
  { tab: "checks", label: "Checks", icon: "✓", count: run.checks.length },
@@ -100443,7 +100819,7 @@ function renderHtmlReport(run, runDir) {
100443
100819
  ${nav.map((n) => `<div class="nav-item" data-tab="${escapeHtml(n.tab)}">
100444
100820
  <span class="icon">${n.icon}</span>
100445
100821
  <span class="label">${escapeHtml(n.label)}</span>
100446
- ${n.count != null ? `<span class="count">${n.count}</span>` : ""}
100822
+ ${n.count != null ? `<span class="count"${n.countTitle ? ` title="${escapeHtml(n.countTitle)}"` : ""}>${escapeHtml(String(n.count))}</span>` : ""}
100447
100823
  </div>`).join("")}
100448
100824
  </nav>
100449
100825
  <div class="sidebar-footer">
@@ -113258,7 +113634,7 @@ function detectSource(repoDir) {
113258
113634
  }
113259
113635
 
113260
113636
  // src/migrate/theme.ts
113261
- var TRANSPARENT = new Set(["transparent", "rgba(0, 0, 0, 0)", "rgba(0,0,0,0)"]);
113637
+ var TRANSPARENT2 = new Set(["transparent", "rgba(0, 0, 0, 0)", "rgba(0,0,0,0)"]);
113262
113638
  function parseRgb(color) {
113263
113639
  const m = color.trim().match(/rgba?\(([^)]+)\)/i);
113264
113640
  if (!m || !m[1])
@@ -113282,7 +113658,7 @@ function rank2(values) {
113282
113658
  const counts = new Map;
113283
113659
  for (const v of values) {
113284
113660
  const key = v.trim();
113285
- if (!key || TRANSPARENT.has(key))
113661
+ if (!key || TRANSPARENT2.has(key))
113286
113662
  continue;
113287
113663
  counts.set(key, (counts.get(key) ?? 0) + 1);
113288
113664
  }
@@ -113346,7 +113722,7 @@ function aggregateTheme(raw) {
113346
113722
  if (secondary)
113347
113723
  tokens.secondary = secondary;
113348
113724
  const bodyBg = raw.bodyBackground.trim();
113349
- const background = bodyBg && !TRANSPARENT.has(bodyBg) && isOpaque(bodyBg) ? bodyBg : [...rank2(raw.backgrounds).keys()].find((c) => isOpaque(c)) ?? null;
113725
+ const background = bodyBg && !TRANSPARENT2.has(bodyBg) && isOpaque(bodyBg) ? bodyBg : [...rank2(raw.backgrounds).keys()].find((c) => isOpaque(c)) ?? null;
113350
113726
  if (background)
113351
113727
  tokens.background = background;
113352
113728
  if (raw.bodyText)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decocms/parity",
3
- "version": "0.35.10",
3
+ "version": "0.35.12",
4
4
  "description": "E2E parity validator for site migrations. Compares prod vs cand and reports UI, functional, SEO, visual, and Web Vitals deltas with an LLM-ranked HTML report.",
5
5
  "type": "module",
6
6
  "license": "MIT",