@decocms/parity 0.35.10 → 0.35.11
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.
- package/dist/cli.js +293 -50
- 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
|
-
|
|
77795
|
-
|
|
77796
|
-
|
|
77797
|
-
|
|
77798
|
-
|
|
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
|
|
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
|
-
...
|
|
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
|
|
77891
|
+
summary,
|
|
77829
77892
|
details: `${agg.sampleText}
|
|
77830
77893
|
|
|
77831
|
-
Observed on: ${agg.pages.join(", ")}${agg.
|
|
77894
|
+
Observed on: ${agg.pages.join(", ")}${agg.failedUrls.length > 0 ? `
|
|
77895
|
+
|
|
77896
|
+
Failed URLs: ${agg.failedUrls.join(", ")}` : ""}${note ? `
|
|
77832
77897
|
|
|
77833
|
-
${
|
|
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) =>
|
|
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)
|
|
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
|
|
77847
|
-
const
|
|
77848
|
-
if (
|
|
77849
|
-
return
|
|
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:
|
|
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) {
|
|
@@ -85826,6 +85981,18 @@ var COLOR_PROPS = /^(color|background-color|border-color|fill|stroke)$/;
|
|
|
85826
85981
|
var SPACING_PROPS = /^(margin|padding|gap|row-gap|column-gap)/;
|
|
85827
85982
|
var SIZE_PROPS = /^(rect\.(width|height)|width|height)$/;
|
|
85828
85983
|
var POSITION_PROPS = /^rect\.(offsetX|offsetY)$/;
|
|
85984
|
+
var SUBPIXEL_PX = 1;
|
|
85985
|
+
function isSubpixelGeometry(d) {
|
|
85986
|
+
return !!d?.prop.startsWith("rect.") && d.deltaPx != null && Math.abs(d.deltaPx) < SUBPIXEL_PX;
|
|
85987
|
+
}
|
|
85988
|
+
var WHITE = /^(white|#fff|#ffffff|rgba?\(255, 255, 255(, 1)?\))$/i;
|
|
85989
|
+
var TRANSPARENT = /^(transparent|rgba\(0, 0, 0, 0\))$/i;
|
|
85990
|
+
function isRootCanvasNoop(d) {
|
|
85991
|
+
if (d.key !== "body" && d.key !== "html" || d.prop !== "background-color")
|
|
85992
|
+
return false;
|
|
85993
|
+
const sides = [d.prod.trim(), d.cand.trim()];
|
|
85994
|
+
return sides.some((v) => WHITE.test(v)) && sides.some((v) => TRANSPARENT.test(v));
|
|
85995
|
+
}
|
|
85829
85996
|
var IMAGE_TAGS = new Set(["img", "picture", "svg", "video", "canvas"]);
|
|
85830
85997
|
function rankNodes(a, b) {
|
|
85831
85998
|
const aExplains = a.deltas.length > 0;
|
|
@@ -85841,6 +86008,8 @@ function attributeHotspots(args) {
|
|
|
85841
86008
|
const max = args.maxNodesPerHotspot ?? 3;
|
|
85842
86009
|
const deltasByKey = new Map;
|
|
85843
86010
|
for (const d of args.deltas) {
|
|
86011
|
+
if (isRootCanvasNoop(d))
|
|
86012
|
+
continue;
|
|
85844
86013
|
const list = deltasByKey.get(d.key);
|
|
85845
86014
|
if (list)
|
|
85846
86015
|
list.push(d);
|
|
@@ -85866,21 +86035,25 @@ function attributeHotspots(args) {
|
|
|
85866
86035
|
hotspot,
|
|
85867
86036
|
nodes: candidates,
|
|
85868
86037
|
truncated: args.truncated,
|
|
85869
|
-
summary: describe2(type, hotspot, candidates, args.imageHostDelta ?? [], because)
|
|
86038
|
+
summary: describe2(type, hotspot, candidates, args.imageHostDelta ?? [], because),
|
|
86039
|
+
...because ? { because } : {}
|
|
85870
86040
|
};
|
|
85871
86041
|
});
|
|
85872
86042
|
}
|
|
85873
86043
|
function classify2(nodes, imageHostDelta) {
|
|
85874
86044
|
const deltas = nodes.flatMap((n) => n.deltas);
|
|
86045
|
+
const real = (d) => !isSubpixelGeometry(d);
|
|
85875
86046
|
const byKind = [
|
|
85876
|
-
["offset", POSITION_PROPS],
|
|
85877
|
-
["typography", TYPOGRAPHY_PROPS],
|
|
85878
|
-
["color", COLOR_PROPS],
|
|
85879
|
-
["size", SIZE_PROPS],
|
|
85880
|
-
["spacing", SPACING_PROPS]
|
|
86047
|
+
["offset", (d) => POSITION_PROPS.test(d.prop) && real(d)],
|
|
86048
|
+
["typography", (d) => TYPOGRAPHY_PROPS.test(d.prop)],
|
|
86049
|
+
["color", (d) => COLOR_PROPS.test(d.prop)],
|
|
86050
|
+
["size", (d) => SIZE_PROPS.test(d.prop) && real(d)],
|
|
86051
|
+
["spacing", (d) => SPACING_PROPS.test(d.prop)],
|
|
86052
|
+
["offset", (d) => POSITION_PROPS.test(d.prop)],
|
|
86053
|
+
["size", (d) => SIZE_PROPS.test(d.prop)]
|
|
85881
86054
|
];
|
|
85882
|
-
for (const [type,
|
|
85883
|
-
const because = deltas.find(
|
|
86055
|
+
for (const [type, matches] of byKind) {
|
|
86056
|
+
const because = deltas.find(matches);
|
|
85884
86057
|
if (because)
|
|
85885
86058
|
return { type, because };
|
|
85886
86059
|
}
|
|
@@ -87971,7 +88144,8 @@ function explainHotspots(hotspots, prod, cand, paths, prodBoxTree, candBoxTree)
|
|
|
87971
88144
|
const c = candBoxTree;
|
|
87972
88145
|
const paired = p?.found && c?.found ? diffBoxTrees(p.nodes, c.nodes, {
|
|
87973
88146
|
truncated: p.truncated || c.truncated,
|
|
87974
|
-
tolerancePx: 0
|
|
88147
|
+
tolerancePx: 0,
|
|
88148
|
+
maxDeltas: Number.POSITIVE_INFINITY
|
|
87975
88149
|
}) : null;
|
|
87976
88150
|
return attributeHotspots({
|
|
87977
88151
|
hotspots,
|
|
@@ -88379,6 +88553,21 @@ function findingSeverity(f) {
|
|
|
88379
88553
|
return "medium";
|
|
88380
88554
|
return "low";
|
|
88381
88555
|
}
|
|
88556
|
+
var MIN_REGION_PIXELS = 9;
|
|
88557
|
+
function isImperceptible(f) {
|
|
88558
|
+
if (f.type === "horizontal-overflow")
|
|
88559
|
+
return false;
|
|
88560
|
+
if (f.hotspot.pixelCount < MIN_REGION_PIXELS)
|
|
88561
|
+
return true;
|
|
88562
|
+
return isSubpixelGeometry(f.because);
|
|
88563
|
+
}
|
|
88564
|
+
function everyRegionImperceptible(heatmapPath, prod, cand, diffDir, prefix, viewport) {
|
|
88565
|
+
const all = analyzeHeatmapRegions(heatmapPath, {
|
|
88566
|
+
minComponentPixels: 1,
|
|
88567
|
+
maxHotspots: Number.POSITIVE_INFINITY
|
|
88568
|
+
});
|
|
88569
|
+
return explainHotspots(all.hotspots, prod.side, cand.side, artifactPaths(diffDir, prefix, viewport), prod.boxTree, cand.boxTree).every(isImperceptible);
|
|
88570
|
+
}
|
|
88382
88571
|
var WHERE_RE = / ?at \d+,\d+ — \d+×\d+/;
|
|
88383
88572
|
function unionBox(a, b) {
|
|
88384
88573
|
const x = Math.min(a.x, b.x);
|
|
@@ -88489,7 +88678,8 @@ async function visualRegressionKeyframes(ctx) {
|
|
|
88489
88678
|
const candSections = pair.cand.html ? snapshotDom(pair.cand.html).decoSectionsRendered : [];
|
|
88490
88679
|
const sectionsOnlyInProd = prodSections.filter((s) => !candSections.includes(s));
|
|
88491
88680
|
const sectionsOnlyInCand = candSections.filter((s) => !prodSections.includes(s));
|
|
88492
|
-
const
|
|
88681
|
+
const noise = r.findings.filter(isImperceptible);
|
|
88682
|
+
const merged = mergeSameClaim(r.findings.filter((f) => !isImperceptible(f)));
|
|
88493
88683
|
const tracks = carouselTrackShift(merged);
|
|
88494
88684
|
const inTrack = new Set(tracks.flat());
|
|
88495
88685
|
const findings = [
|
|
@@ -88506,7 +88696,9 @@ async function visualRegressionKeyframes(ctx) {
|
|
|
88506
88696
|
hotspot: g.map((f) => f.hotspot).reduce(unionBox)
|
|
88507
88697
|
}))
|
|
88508
88698
|
];
|
|
88509
|
-
const
|
|
88699
|
+
const allNoise = r.verdict === "differs" && findings.length === 0 && noise.length > 0 && r.heatmapPath != null && everyRegionImperceptible(r.heatmapPath, prod, cand, diffDir, prefix, pair.viewport);
|
|
88700
|
+
const verdict = allNoise ? "pass" : VERDICT[r.verdict];
|
|
88701
|
+
const reason = allNoise ? `${r.diffPixels} differing px, all imperceptible: sub-pixel offsets or regions under ${MIN_REGION_PIXELS}px` : r.reason;
|
|
88510
88702
|
results.push({
|
|
88511
88703
|
pageKey: pair.key,
|
|
88512
88704
|
pagePath: pair.key.split("::")[0] ?? "/",
|
|
@@ -88530,7 +88722,7 @@ async function visualRegressionKeyframes(ctx) {
|
|
|
88530
88722
|
...r.diffPixels != null ? { diffPixels: r.diffPixels } : {},
|
|
88531
88723
|
...r.noiseFloorPixels != null ? { noiseFloorPixels: r.noiseFloorPixels } : {},
|
|
88532
88724
|
...r.maskedCoverage != null ? { maskedCoverage: r.maskedCoverage } : {},
|
|
88533
|
-
...
|
|
88725
|
+
...reason ? { reason } : {}
|
|
88534
88726
|
});
|
|
88535
88727
|
const evidence = [
|
|
88536
88728
|
{ kind: "screenshot", path: pair.prod.screenshotPath, label: "prod" },
|
|
@@ -90578,6 +90770,7 @@ var REPORT_CSS = `
|
|
|
90578
90770
|
.sb-table small { color: var(--text-muted); }
|
|
90579
90771
|
.sb-status { font-size: 11px; font-weight: 600; text-transform: uppercase; }
|
|
90580
90772
|
.sb-cap { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
|
|
90773
|
+
.sb-weighed { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
|
|
90581
90774
|
.sb-lost { display: flex; align-items: center; gap: 8px; min-width: 180px; }
|
|
90582
90775
|
.sb-bar { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-overlay); overflow: hidden; }
|
|
90583
90776
|
.sb-bar span { display: block; height: 100%; background: var(--state-bad); }
|
|
@@ -98737,7 +98930,13 @@ function explainCompositeScore(moduleVerdicts, verdict, checks) {
|
|
|
98737
98930
|
}).sort((a, b) => b.pointsLost - a.pointsLost || a.module.localeCompare(b.module));
|
|
98738
98931
|
const uncappedScore = Math.round(moduleVerdicts.reduce((s, mv) => s + mv.score * moduleWeight(mv), 0) / weightSum);
|
|
98739
98932
|
const failed = verdict.status === "fail";
|
|
98740
|
-
const
|
|
98933
|
+
const liveCritical = checks.flatMap((c) => c.issues).filter((i) => i.severity === "critical" && !i.inconclusive && !i.accepted).length;
|
|
98934
|
+
const unjudgedCritical = Math.max(0, verdict.critical - liveCritical);
|
|
98935
|
+
const failedBy = failed ? [
|
|
98936
|
+
...failedChecks(),
|
|
98937
|
+
...criticalNote(verdict.critical - unjudgedCritical),
|
|
98938
|
+
...unjudgedCritical > 0 ? [`${unjudgedCritical} critical, inconclusive or accepted`] : []
|
|
98939
|
+
] : [];
|
|
98741
98940
|
const capBy = capRuleV3 ? triggers() : failedBy;
|
|
98742
98941
|
if ((capBy.length > 0 ? Math.min(uncappedScore, FAIL_SCORE_CAP) : uncappedScore) !== verdict.score) {
|
|
98743
98942
|
return null;
|
|
@@ -99196,7 +99395,10 @@ function tabHelp(text) {
|
|
|
99196
99395
|
function renderDashboard2(run) {
|
|
99197
99396
|
const v = run.verdict;
|
|
99198
99397
|
const inconclusive = v.status === "inconclusive";
|
|
99199
|
-
const
|
|
99398
|
+
const { live } = splitFindings(run.issues);
|
|
99399
|
+
const critical = live.filter((i) => i.severity === "critical").length;
|
|
99400
|
+
const blocking = critical + live.filter((i) => i.severity === "high").length;
|
|
99401
|
+
const statusLabel = inconclusive ? "Inconclusive" : v.status === "pass" ? "Excellent" : v.status === "warn" ? "Warnings" : critical > 0 ? "Critical" : "Fail";
|
|
99200
99402
|
const ringColor = inconclusive ? "var(--text-dim, #888)" : v.status === "pass" ? "var(--state-good)" : v.status === "warn" ? "var(--state-warn)" : "var(--state-bad)";
|
|
99201
99403
|
const ringDeg = inconclusive ? "0deg" : `${Math.round(v.score / 100 * 360)}deg`;
|
|
99202
99404
|
const prev = run.previousRun;
|
|
@@ -99219,7 +99421,7 @@ function renderDashboard2(run) {
|
|
|
99219
99421
|
${renderVisualParity(run)}
|
|
99220
99422
|
${inconclusive ? "" : deltaChip}
|
|
99221
99423
|
${renderAcceptedFindings(run)}
|
|
99222
|
-
<div class="verdict-sub">${inconclusive ? "Nothing was measured — 0 checks ran, so this run says nothing about parity." : `${
|
|
99424
|
+
<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
99425
|
<div class="verdict-meta">
|
|
99224
99426
|
<span><strong>${v.checksPassed}</strong> checks pass</span>
|
|
99225
99427
|
<span><strong>${v.checksFailed}</strong> fail</span>
|
|
@@ -99271,8 +99473,12 @@ function renderScoreBreakdown(run) {
|
|
|
99271
99473
|
const totalLost = ex.modules.reduce((s, m) => s + m.pointsLost, 0);
|
|
99272
99474
|
const maxLost = Math.max(...ex.modules.map((m) => m.pointsLost), 0.0001);
|
|
99273
99475
|
const capNote = (by) => by.length > 0 ? `<div class="sb-cap">held at ${FAIL_SCORE_CAP} by ${escapeHtml(by.join(", "))}</div>` : "";
|
|
99476
|
+
const weighed = (mod) => {
|
|
99477
|
+
const line = moduleWeighedBy(run, mod);
|
|
99478
|
+
return line ? `<div class="sb-weighed">${escapeHtml(line)}</div>` : "";
|
|
99479
|
+
};
|
|
99274
99480
|
const rows = ex.modules.map((m) => `<tr>
|
|
99275
|
-
<td><strong>${escapeHtml(m.module)}</strong>${capNote(m.cappedBy)}</td>
|
|
99481
|
+
<td><strong>${escapeHtml(m.module)}</strong>${weighed(m.module)}${capNote(m.cappedBy)}</td>
|
|
99276
99482
|
<td><span class="sb-status" style="color:${STATUS_COLOR[m.status]}">${m.status}</span></td>
|
|
99277
99483
|
<td class="num" style="color:${STATUS_COLOR[m.status]}">${m.score}</td>
|
|
99278
99484
|
<td class="num">${Math.round(m.weightShare * 100)}%<small> · ${m.weight} page${m.weight === 1 ? "" : "s"}</small></td>
|
|
@@ -99297,7 +99503,22 @@ function splitFindings(issues) {
|
|
|
99297
99503
|
const accepted = issues.filter((i) => i.accepted).length;
|
|
99298
99504
|
const suffix = (notJudged > 0 ? ` · +${notJudged} not judged (inconclusive)` : "") + (accepted > 0 ? ` · ${accepted} accepted` : "");
|
|
99299
99505
|
const state = notJudged > 0 ? "info" : "pass";
|
|
99300
|
-
return { live, suffix, state };
|
|
99506
|
+
return { live, notJudged, suffix, state };
|
|
99507
|
+
}
|
|
99508
|
+
function liveBadge(issues) {
|
|
99509
|
+
const s = splitFindings(issues);
|
|
99510
|
+
return `${s.live.length}${s.notJudged > 0 ? ` · +${s.notJudged}` : ""}`;
|
|
99511
|
+
}
|
|
99512
|
+
function liveByCheck(run, module) {
|
|
99513
|
+
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}`);
|
|
99514
|
+
}
|
|
99515
|
+
function moduleWeighedBy(run, module) {
|
|
99516
|
+
const parts = liveByCheck(run, module);
|
|
99517
|
+
const vd = run.visualDiff;
|
|
99518
|
+
if (module === "visual" && vd && vd.pagesChecked > 0) {
|
|
99519
|
+
parts.unshift(`visual parity ${vd.pagesPassed}/${vd.pagesChecked} pages match`);
|
|
99520
|
+
}
|
|
99521
|
+
return parts.join(" · ");
|
|
99301
99522
|
}
|
|
99302
99523
|
function journeyTile(run, pj) {
|
|
99303
99524
|
const failed = (pj.data ?? {}).failedSteps ?? 0;
|
|
@@ -99347,12 +99568,13 @@ function buildTiles(run) {
|
|
|
99347
99568
|
}
|
|
99348
99569
|
const vitals = run.checks.find((c) => c.name === "web-vitals-mobile");
|
|
99349
99570
|
if (vitals) {
|
|
99571
|
+
const s = splitFindings(vitals.issues);
|
|
99350
99572
|
tiles.push({
|
|
99351
99573
|
icon: "\uD83D\uDCCA",
|
|
99352
99574
|
label: "Vitals",
|
|
99353
|
-
value: vitals.status === "pass" ? "✓" :
|
|
99354
|
-
meta: vitals.status === "pass" ? "no regressions" : `${
|
|
99355
|
-
state: vitals.status === "pass" ? "pass" : "fail",
|
|
99575
|
+
value: vitals.status === "pass" ? "✓" : `${s.live.length}`,
|
|
99576
|
+
meta: vitals.status === "pass" ? "no regressions" : `${s.live.length} regression(s)${s.suffix}`,
|
|
99577
|
+
state: vitals.status === "pass" ? "pass" : s.live.length > 0 ? "fail" : s.state,
|
|
99356
99578
|
href: "#detail/web-vitals-mobile"
|
|
99357
99579
|
});
|
|
99358
99580
|
}
|
|
@@ -99384,13 +99606,15 @@ function buildTiles(run) {
|
|
|
99384
99606
|
const visual = run.checks.find((c) => c.name === "visual-regression-keyframes");
|
|
99385
99607
|
if (visual) {
|
|
99386
99608
|
const vd = run.visualDiff;
|
|
99387
|
-
const value = vd ? `${vd.
|
|
99388
|
-
const
|
|
99609
|
+
const value = vd ? `${vd.pagesPassed}/${vd.pagesChecked}` : visual.issues.length.toString();
|
|
99610
|
+
const layout = liveByCheck(run, "visual").filter((p) => !p.startsWith(`${visual.name} `));
|
|
99611
|
+
const layoutNote = layout.length > 0 ? ` · not pixel diffs: ${layout.join(", ")}` : "";
|
|
99612
|
+
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
99613
|
tiles.push({
|
|
99390
99614
|
icon: "\uD83D\uDDBC",
|
|
99391
99615
|
label: "Visual",
|
|
99392
99616
|
value,
|
|
99393
|
-
meta,
|
|
99617
|
+
meta: pixelMeta + layoutNote,
|
|
99394
99618
|
state: visual.status === "pass" ? "pass" : visual.status === "skipped" ? "info" : "warn",
|
|
99395
99619
|
href: "#detail/visual-regression-keyframes"
|
|
99396
99620
|
});
|
|
@@ -100402,11 +100626,30 @@ function renderPromptPanel(run) {
|
|
|
100402
100626
|
</div>`;
|
|
100403
100627
|
}
|
|
100404
100628
|
function buildNav(run) {
|
|
100629
|
+
const vd = run.visualDiff;
|
|
100405
100630
|
const entries = [
|
|
100406
100631
|
{ tab: "summary", label: "Dashboard", icon: "\uD83C\uDFE0" },
|
|
100407
|
-
{
|
|
100408
|
-
|
|
100409
|
-
|
|
100632
|
+
{
|
|
100633
|
+
tab: "visualdiff",
|
|
100634
|
+
label: "Visual Diff",
|
|
100635
|
+
icon: "\uD83D\uDDBC",
|
|
100636
|
+
count: vd ? `${vd.pagesWithDiffs}${vd.pagesFailed > 0 ? ` · +${vd.pagesFailed}` : ""}` : undefined,
|
|
100637
|
+
countTitle: "pages with differences · +pages not compared"
|
|
100638
|
+
},
|
|
100639
|
+
{
|
|
100640
|
+
tab: "seo",
|
|
100641
|
+
label: "SEO",
|
|
100642
|
+
icon: "\uD83D\uDD0D",
|
|
100643
|
+
count: run.seo ? liveBadge(run.seo.issues) : undefined,
|
|
100644
|
+
countTitle: "live findings · +not judged (inconclusive)"
|
|
100645
|
+
},
|
|
100646
|
+
{
|
|
100647
|
+
tab: "issues",
|
|
100648
|
+
label: "Issues",
|
|
100649
|
+
icon: "⚠",
|
|
100650
|
+
count: liveBadge(run.issues),
|
|
100651
|
+
countTitle: "live findings · +not judged (inconclusive)"
|
|
100652
|
+
},
|
|
100410
100653
|
{ tab: "vitals", label: "Vitals", icon: "\uD83D\uDCCA" },
|
|
100411
100654
|
{ tab: "cache", label: "Cache", icon: "\uD83D\uDCBE" },
|
|
100412
100655
|
{ tab: "checks", label: "Checks", icon: "✓", count: run.checks.length },
|
|
@@ -100443,7 +100686,7 @@ function renderHtmlReport(run, runDir) {
|
|
|
100443
100686
|
${nav.map((n) => `<div class="nav-item" data-tab="${escapeHtml(n.tab)}">
|
|
100444
100687
|
<span class="icon">${n.icon}</span>
|
|
100445
100688
|
<span class="label">${escapeHtml(n.label)}</span>
|
|
100446
|
-
${n.count != null ? `<span class="count">${n.count}</span>` : ""}
|
|
100689
|
+
${n.count != null ? `<span class="count"${n.countTitle ? ` title="${escapeHtml(n.countTitle)}"` : ""}>${escapeHtml(String(n.count))}</span>` : ""}
|
|
100447
100690
|
</div>`).join("")}
|
|
100448
100691
|
</nav>
|
|
100449
100692
|
<div class="sidebar-footer">
|
|
@@ -113258,7 +113501,7 @@ function detectSource(repoDir) {
|
|
|
113258
113501
|
}
|
|
113259
113502
|
|
|
113260
113503
|
// src/migrate/theme.ts
|
|
113261
|
-
var
|
|
113504
|
+
var TRANSPARENT2 = new Set(["transparent", "rgba(0, 0, 0, 0)", "rgba(0,0,0,0)"]);
|
|
113262
113505
|
function parseRgb(color) {
|
|
113263
113506
|
const m = color.trim().match(/rgba?\(([^)]+)\)/i);
|
|
113264
113507
|
if (!m || !m[1])
|
|
@@ -113282,7 +113525,7 @@ function rank2(values) {
|
|
|
113282
113525
|
const counts = new Map;
|
|
113283
113526
|
for (const v of values) {
|
|
113284
113527
|
const key = v.trim();
|
|
113285
|
-
if (!key ||
|
|
113528
|
+
if (!key || TRANSPARENT2.has(key))
|
|
113286
113529
|
continue;
|
|
113287
113530
|
counts.set(key, (counts.get(key) ?? 0) + 1);
|
|
113288
113531
|
}
|
|
@@ -113346,7 +113589,7 @@ function aggregateTheme(raw) {
|
|
|
113346
113589
|
if (secondary)
|
|
113347
113590
|
tokens.secondary = secondary;
|
|
113348
113591
|
const bodyBg = raw.bodyBackground.trim();
|
|
113349
|
-
const background = bodyBg && !
|
|
113592
|
+
const background = bodyBg && !TRANSPARENT2.has(bodyBg) && isOpaque(bodyBg) ? bodyBg : [...rank2(raw.backgrounds).keys()].find((c) => isOpaque(c)) ?? null;
|
|
113350
113593
|
if (background)
|
|
113351
113594
|
tokens.background = background;
|
|
113352
113595
|
if (raw.bodyText)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decocms/parity",
|
|
3
|
-
"version": "0.35.
|
|
3
|
+
"version": "0.35.11",
|
|
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",
|