@decocms/parity 0.35.9 → 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/AGENTS.md +5 -3
- package/dist/cli.js +373 -90
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -50,9 +50,11 @@ Do **not** fake single-site with `parity run --prod X --cand X` — it runs ever
|
|
|
50
50
|
|
|
51
51
|
```ts
|
|
52
52
|
{
|
|
53
|
-
verdict: { status: "pass"|"warn"|"fail", score: 0..100, scoreVersion:
|
|
54
|
-
// score
|
|
55
|
-
//
|
|
53
|
+
verdict: { status: "pass"|"warn"|"fail", score: 0..100, scoreVersion: 3, pagesAnalyzed, critical, high, medium, low },
|
|
54
|
+
// score = 100·e^(-penaltyDensity/35), penaltyDensity = Σ severity weights ÷ pagesAnalyzed.
|
|
55
|
+
// v3: capped at 79 only by a live critical finding or a check that failed with no finding (it threw).
|
|
56
|
+
// A FAIL from high findings keeps status "fail" but the score stays the formula — "91 · FAIL" is valid;
|
|
57
|
+
// read status for the gate, score for progress. It's a progress meter: it RISES as issues get fixed.
|
|
56
58
|
previousRun?: { id, timestamp, score, scoreDelta }, // trend vs last comparable run (same hosts + scoreVersion)
|
|
57
59
|
topIssues: Issue[], // LLM-ranked, deduplicated; usually 5-10 items
|
|
58
60
|
issues: Issue[], // all raw issues from every check
|
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" },
|
|
@@ -90568,6 +90760,8 @@ var REPORT_CSS = `
|
|
|
90568
90760
|
.visual-parity { margin: 6px 0 2px; font-size: 15px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
|
|
90569
90761
|
.visual-parity span { font-size: 12px; color: var(--text-muted); }
|
|
90570
90762
|
.score-breakdown { margin-bottom: 16px; }
|
|
90763
|
+
.sb-fail { font-size: 13px; color: var(--text-muted); margin: -4px 0 8px; }
|
|
90764
|
+
.sb-fail strong { color: var(--state-bad); }
|
|
90571
90765
|
.sb-capped { font-size: 13px; color: var(--state-bad); background: var(--surface-overlay); border-left: 3px solid var(--state-bad); padding: 8px 12px; border-radius: 6px; margin-bottom: 12px; }
|
|
90572
90766
|
.sb-table { width: 100%; border-collapse: collapse; font-size: 13px; }
|
|
90573
90767
|
.sb-table th { text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); padding: 6px 8px; border-bottom: 1px solid var(--border-default); }
|
|
@@ -90576,6 +90770,7 @@ var REPORT_CSS = `
|
|
|
90576
90770
|
.sb-table small { color: var(--text-muted); }
|
|
90577
90771
|
.sb-status { font-size: 11px; font-weight: 600; text-transform: uppercase; }
|
|
90578
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; }
|
|
90579
90774
|
.sb-lost { display: flex; align-items: center; gap: 8px; min-width: 180px; }
|
|
90580
90775
|
.sb-bar { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-overlay); overflow: hidden; }
|
|
90581
90776
|
.sb-bar span { display: block; height: 100%; background: var(--state-bad); }
|
|
@@ -98551,7 +98746,14 @@ var SEVERITY_WEIGHTS = {
|
|
|
98551
98746
|
};
|
|
98552
98747
|
var DECAY_K = 35;
|
|
98553
98748
|
var FAIL_SCORE_CAP = 79;
|
|
98554
|
-
var SCORE_VERSION =
|
|
98749
|
+
var SCORE_VERSION = 3;
|
|
98750
|
+
function capTriggers(checks, issues) {
|
|
98751
|
+
const critical = issues.filter((i) => i.severity === "critical" && !i.inconclusive && !i.accepted).length;
|
|
98752
|
+
return [
|
|
98753
|
+
...checks.filter((c) => c.status === "fail" && c.issues.length === 0).map((c) => c.name),
|
|
98754
|
+
...critical > 0 ? [`${critical} critical issue${critical === 1 ? "" : "s"}`] : []
|
|
98755
|
+
];
|
|
98756
|
+
}
|
|
98555
98757
|
function computeScore(issues, opts) {
|
|
98556
98758
|
const pagesAnalyzed = Math.max(1, opts.pagesAnalyzed);
|
|
98557
98759
|
let totalPenalty = 0;
|
|
@@ -98590,7 +98792,7 @@ function computeVerdict(checks, issues, opts) {
|
|
|
98590
98792
|
const pagesAnalyzed = opts?.pagesAnalyzed ?? derivePagesAnalyzed(checks, issues);
|
|
98591
98793
|
let { score } = computeScore(issues, { pagesAnalyzed });
|
|
98592
98794
|
const status = measuredNothing(checks) ? "inconclusive" : counts.critical > 0 || checksFailed > 0 ? "fail" : counts.high > 0 || checksWarn > 0 ? "warn" : "pass";
|
|
98593
|
-
if (
|
|
98795
|
+
if (capTriggers(checks, issues).length > 0)
|
|
98594
98796
|
score = Math.min(score, FAIL_SCORE_CAP);
|
|
98595
98797
|
if (status === "inconclusive")
|
|
98596
98798
|
score = 0;
|
|
@@ -98640,7 +98842,7 @@ function computeModuleVerdicts(checks, issues) {
|
|
|
98640
98842
|
const uncappedScore = computeScore(modIssues, { pagesAnalyzed }).score;
|
|
98641
98843
|
let score = uncappedScore;
|
|
98642
98844
|
const status = counts.critical > 0 || checksFailed > 0 ? "fail" : counts.high > 0 || checksWarn > 0 ? "warn" : "pass";
|
|
98643
|
-
if (
|
|
98845
|
+
if (capTriggers(modChecks, modIssues).length > 0)
|
|
98644
98846
|
score = Math.min(score, FAIL_SCORE_CAP);
|
|
98645
98847
|
result.push({
|
|
98646
98848
|
module: mod,
|
|
@@ -98681,8 +98883,9 @@ function computeCompositeVerdict(moduleVerdicts, checks, issues) {
|
|
|
98681
98883
|
const nothingMeasured = weightSum === 0 || measuredNothing(checks);
|
|
98682
98884
|
let score = nothingMeasured ? 0 : Math.round(weightedScoreSum / weightSum);
|
|
98683
98885
|
const status = nothingMeasured ? "inconclusive" : counts.critical > 0 || checksFailed > 0 || moduleVerdicts.some((mv) => mv.status === "fail") ? "fail" : counts.high > 0 || checksWarn > 0 || moduleVerdicts.some((mv) => mv.status === "warn") ? "warn" : "pass";
|
|
98684
|
-
if (
|
|
98886
|
+
if (!nothingMeasured && capTriggers(checks, issues).length > 0) {
|
|
98685
98887
|
score = Math.min(score, FAIL_SCORE_CAP);
|
|
98888
|
+
}
|
|
98686
98889
|
return {
|
|
98687
98890
|
status,
|
|
98688
98891
|
score,
|
|
@@ -98705,9 +98908,16 @@ function explainCompositeScore(moduleVerdicts, verdict, checks) {
|
|
|
98705
98908
|
const weightSum = moduleVerdicts.reduce((s, mv) => s + moduleWeight(mv), 0);
|
|
98706
98909
|
const failedChecks = (mod) => checks.filter((c) => c.status === "fail" && (mod === undefined || moduleOfCheck(c.name) === mod)).map((c) => c.name);
|
|
98707
98910
|
const criticalNote = (n) => n > 0 ? [`${n} critical issue${n === 1 ? "" : "s"}`] : [];
|
|
98911
|
+
const capRuleV3 = (verdict.scoreVersion ?? 0) >= 3;
|
|
98912
|
+
const triggers = (mod) => {
|
|
98913
|
+
const inMod = (name) => mod === undefined || moduleOfCheck(name) === mod;
|
|
98914
|
+
const modChecks = checks.filter((c) => inMod(c.name));
|
|
98915
|
+
return capTriggers(modChecks, checks.flatMap((c) => c.issues).filter((i) => inMod(i.check)));
|
|
98916
|
+
};
|
|
98708
98917
|
const modules = moduleVerdicts.map((mv) => {
|
|
98709
98918
|
const weightShare = moduleWeight(mv) / weightSum;
|
|
98710
98919
|
const capBound = mv.status === "fail" && (mv.uncappedScore !== undefined ? mv.uncappedScore > mv.score : mv.score === FAIL_SCORE_CAP);
|
|
98920
|
+
const cappedBy = !capBound ? [] : capRuleV3 ? triggers(mv.module) : [...failedChecks(mv.module), ...criticalNote(mv.critical)];
|
|
98711
98921
|
return {
|
|
98712
98922
|
module: mv.module,
|
|
98713
98923
|
score: mv.score,
|
|
@@ -98715,20 +98925,30 @@ function explainCompositeScore(moduleVerdicts, verdict, checks) {
|
|
|
98715
98925
|
weight: moduleWeight(mv),
|
|
98716
98926
|
weightShare,
|
|
98717
98927
|
pointsLost: (100 - mv.score) * weightShare,
|
|
98718
|
-
cappedBy
|
|
98928
|
+
cappedBy
|
|
98719
98929
|
};
|
|
98720
98930
|
}).sort((a, b) => b.pointsLost - a.pointsLost || a.module.localeCompare(b.module));
|
|
98721
98931
|
const uncappedScore = Math.round(moduleVerdicts.reduce((s, mv) => s + mv.score * moduleWeight(mv), 0) / weightSum);
|
|
98722
98932
|
const failed = verdict.status === "fail";
|
|
98723
|
-
|
|
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
|
+
] : [];
|
|
98940
|
+
const capBy = capRuleV3 ? triggers() : failedBy;
|
|
98941
|
+
if ((capBy.length > 0 ? Math.min(uncappedScore, FAIL_SCORE_CAP) : uncappedScore) !== verdict.score) {
|
|
98724
98942
|
return null;
|
|
98725
98943
|
}
|
|
98944
|
+
const capped = capBy.length > 0 && uncappedScore > FAIL_SCORE_CAP;
|
|
98726
98945
|
return {
|
|
98727
98946
|
modules,
|
|
98728
98947
|
uncappedScore,
|
|
98729
98948
|
score: verdict.score,
|
|
98730
|
-
capped
|
|
98731
|
-
|
|
98949
|
+
capped,
|
|
98950
|
+
capBy: capped ? capBy : [],
|
|
98951
|
+
failedBy
|
|
98732
98952
|
};
|
|
98733
98953
|
}
|
|
98734
98954
|
|
|
@@ -99175,7 +99395,10 @@ function tabHelp(text) {
|
|
|
99175
99395
|
function renderDashboard2(run) {
|
|
99176
99396
|
const v = run.verdict;
|
|
99177
99397
|
const inconclusive = v.status === "inconclusive";
|
|
99178
|
-
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";
|
|
99179
99402
|
const ringColor = inconclusive ? "var(--text-dim, #888)" : v.status === "pass" ? "var(--state-good)" : v.status === "warn" ? "var(--state-warn)" : "var(--state-bad)";
|
|
99180
99403
|
const ringDeg = inconclusive ? "0deg" : `${Math.round(v.score / 100 * 360)}deg`;
|
|
99181
99404
|
const prev = run.previousRun;
|
|
@@ -99198,7 +99421,7 @@ function renderDashboard2(run) {
|
|
|
99198
99421
|
${renderVisualParity(run)}
|
|
99199
99422
|
${inconclusive ? "" : deltaChip}
|
|
99200
99423
|
${renderAcceptedFindings(run)}
|
|
99201
|
-
<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>
|
|
99202
99425
|
<div class="verdict-meta">
|
|
99203
99426
|
<span><strong>${v.checksPassed}</strong> checks pass</span>
|
|
99204
99427
|
<span><strong>${v.checksFailed}</strong> fail</span>
|
|
@@ -99249,18 +99472,24 @@ function renderScoreBreakdown(run) {
|
|
|
99249
99472
|
return "";
|
|
99250
99473
|
const totalLost = ex.modules.reduce((s, m) => s + m.pointsLost, 0);
|
|
99251
99474
|
const maxLost = Math.max(...ex.modules.map((m) => m.pointsLost), 0.0001);
|
|
99252
|
-
const capNote = (by) => by.length > 0 ? `<div class="sb-cap">held at ${FAIL_SCORE_CAP} by
|
|
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
|
+
};
|
|
99253
99480
|
const rows = ex.modules.map((m) => `<tr>
|
|
99254
|
-
<td><strong>${escapeHtml(m.module)}</strong>${capNote(m.cappedBy)}</td>
|
|
99481
|
+
<td><strong>${escapeHtml(m.module)}</strong>${weighed(m.module)}${capNote(m.cappedBy)}</td>
|
|
99255
99482
|
<td><span class="sb-status" style="color:${STATUS_COLOR[m.status]}">${m.status}</span></td>
|
|
99256
99483
|
<td class="num" style="color:${STATUS_COLOR[m.status]}">${m.score}</td>
|
|
99257
99484
|
<td class="num">${Math.round(m.weightShare * 100)}%<small> · ${m.weight} page${m.weight === 1 ? "" : "s"}</small></td>
|
|
99258
99485
|
<td><div class="sb-lost"><span class="sb-bar"><span style="width:${(m.pointsLost / maxLost * 100).toFixed(1)}%"></span></span><span class="num">−${m.pointsLost.toFixed(1)}</span></div></td>
|
|
99259
99486
|
</tr>`).join("");
|
|
99260
|
-
const headline = ex.capped ? `<div class="sb-capped">Capped at ${FAIL_SCORE_CAP}: the modules average ${ex.uncappedScore}, but
|
|
99487
|
+
const headline = ex.capped ? `<div class="sb-capped">Capped at ${FAIL_SCORE_CAP}: the modules average ${ex.uncappedScore}, but ${escapeHtml(ex.capBy.join(", "))} holds the score at ${FAIL_SCORE_CAP} or below.</div>` : "";
|
|
99488
|
+
const failLine = ex.failedBy.length > 0 ? `<div class="sb-fail"><strong>${run.verdict.score} · FAIL</strong> — status from ${escapeHtml(ex.failedBy.join(", "))}.${ex.capped || ex.uncappedScore <= FAIL_SCORE_CAP ? "" : ` Not capped at ${FAIL_SCORE_CAP}: no live critical finding and no check that failed without a finding.`}</div>` : "";
|
|
99261
99489
|
return `<div class="card score-breakdown">
|
|
99262
99490
|
<h2>Why ${ex.score}?</h2>
|
|
99263
|
-
|
|
99491
|
+
${failLine}
|
|
99492
|
+
<div class="hint">${ex.uncappedScore} = 100 − ${totalLost.toFixed(1)} points lost, each module weighted by the pages it analyzed.</div>
|
|
99264
99493
|
${headline}
|
|
99265
99494
|
<table class="sb-table">
|
|
99266
99495
|
<thead><tr><th>Module</th><th>Status</th><th class="num">Score</th><th class="num">Weight</th><th>Points lost</th></tr></thead>
|
|
@@ -99268,33 +99497,63 @@ function renderScoreBreakdown(run) {
|
|
|
99268
99497
|
</table>
|
|
99269
99498
|
</div>`;
|
|
99270
99499
|
}
|
|
99500
|
+
function splitFindings(issues) {
|
|
99501
|
+
const live = issues.filter((i) => !i.inconclusive && !i.accepted);
|
|
99502
|
+
const notJudged = issues.filter((i) => i.inconclusive && !i.accepted).length;
|
|
99503
|
+
const accepted = issues.filter((i) => i.accepted).length;
|
|
99504
|
+
const suffix = (notJudged > 0 ? ` · +${notJudged} not judged (inconclusive)` : "") + (accepted > 0 ? ` · ${accepted} accepted` : "");
|
|
99505
|
+
const state = notJudged > 0 ? "info" : "pass";
|
|
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(" · ");
|
|
99522
|
+
}
|
|
99523
|
+
function journeyTile(run, pj) {
|
|
99524
|
+
const failed = (pj.data ?? {}).failedSteps ?? 0;
|
|
99525
|
+
const caps = run.flowCaptures.filter((fc) => fc.flow === "purchase-journey" && fc.steps?.length);
|
|
99526
|
+
const tile = { icon: "\uD83D\uDED2", label: "Journey", href: "#detail/purchase-journey-flow" };
|
|
99527
|
+
if (caps.length === 0)
|
|
99528
|
+
return { ...tile, value: "—", meta: "no journey captured", state: "warn" };
|
|
99529
|
+
const total = Math.max(...caps.map((fc) => fc.steps.length));
|
|
99530
|
+
const side = (name) => {
|
|
99531
|
+
const mine = caps.filter((fc) => fc.side === name);
|
|
99532
|
+
const skipped = [
|
|
99533
|
+
...new Set(mine.flatMap((fc) => fc.steps.filter((s) => s.status === "skipped").map((s) => s.name)))
|
|
99534
|
+
];
|
|
99535
|
+
return {
|
|
99536
|
+
captured: mine.length > 0,
|
|
99537
|
+
ok: Math.min(...mine.map((fc) => fc.steps.filter((s) => s.status === "ok").length)),
|
|
99538
|
+
reached: mine.length > 0 && mine.every((fc) => fc.steps.some((s) => s.name === "go-checkout" && s.status === "ok")),
|
|
99539
|
+
skipped
|
|
99540
|
+
};
|
|
99541
|
+
};
|
|
99542
|
+
const prod = side("prod");
|
|
99543
|
+
const cand = side("cand");
|
|
99544
|
+
const reach = prod.reached && cand.reached ? "both sides reached checkout" : `${prod.reached ? "prod reached checkout" : "prod did not reach checkout"} · ${cand.reached ? "cand reached checkout" : "cand did not reach checkout"}`;
|
|
99545
|
+
const sameSkips = prod.skipped.join() === cand.skipped.join();
|
|
99546
|
+
const skips = prod.skipped.length + cand.skipped.length === 0 ? "" : sameSkips ? ` · ${prod.skipped.length} skipped on both (${prod.skipped.join(", ")})` : ` · skipped — prod: ${prod.skipped.join(", ") || "none"}; cand: ${cand.skipped.join(", ") || "none"}`;
|
|
99547
|
+
const value = !cand.captured || !prod.captured || prod.ok === cand.ok ? `${Math.min(...caps.map((fc) => fc.steps.filter((s) => s.status === "ok").length))}/${total}` : `prod ${prod.ok} · cand ${cand.ok}/${total}`;
|
|
99548
|
+
const meta = (failed > 0 ? `${failed} step(s) failed · ` : "") + reach + skips;
|
|
99549
|
+
const state = failed > 0 || prod.reached && !cand.reached ? "fail" : !cand.reached || !prod.reached || !sameSkips ? "warn" : "pass";
|
|
99550
|
+
return { ...tile, value, meta, state };
|
|
99551
|
+
}
|
|
99271
99552
|
function buildTiles(run) {
|
|
99272
99553
|
const tiles = [];
|
|
99273
99554
|
const pj = run.checks.find((c) => c.name === "purchase-journey-flow");
|
|
99274
|
-
if (pj)
|
|
99275
|
-
|
|
99276
|
-
const failed = data.failedSteps ?? 0;
|
|
99277
|
-
const pjCaptures = run.flowCaptures.filter((fc) => fc.flow === "purchase-journey");
|
|
99278
|
-
const maxSteps = pjCaptures.reduce((m, fc) => Math.max(m, fc.steps?.length ?? 0), 0);
|
|
99279
|
-
const skippedSteps = pjCaptures.reduce((n, fc) => n + (fc.steps?.filter((s) => s.status === "skipped").length ?? 0), 0);
|
|
99280
|
-
const okSteps = Math.max(0, maxSteps - failed - skippedSteps);
|
|
99281
|
-
const aborted = skippedSteps > 0;
|
|
99282
|
-
let meta;
|
|
99283
|
-
if (failed > 0)
|
|
99284
|
-
meta = `${failed} step(s) failed`;
|
|
99285
|
-
else if (aborted)
|
|
99286
|
-
meta = `${skippedSteps} step(s) skipped (recovery exhausted)`;
|
|
99287
|
-
else
|
|
99288
|
-
meta = "completed in both";
|
|
99289
|
-
tiles.push({
|
|
99290
|
-
icon: "\uD83D\uDED2",
|
|
99291
|
-
label: "Journey",
|
|
99292
|
-
value: maxSteps > 0 ? `${okSteps}/${maxSteps}` : "—",
|
|
99293
|
-
meta,
|
|
99294
|
-
state: failed > 0 ? "fail" : aborted ? "warn" : "pass",
|
|
99295
|
-
href: "#detail/purchase-journey-flow"
|
|
99296
|
-
});
|
|
99297
|
-
}
|
|
99555
|
+
if (pj)
|
|
99556
|
+
tiles.push(journeyTile(run, pj));
|
|
99298
99557
|
const cache = run.checks.find((c) => c.name === "cache-coverage");
|
|
99299
99558
|
if (cache) {
|
|
99300
99559
|
const data = cache.data ?? {};
|
|
@@ -99309,48 +99568,53 @@ function buildTiles(run) {
|
|
|
99309
99568
|
}
|
|
99310
99569
|
const vitals = run.checks.find((c) => c.name === "web-vitals-mobile");
|
|
99311
99570
|
if (vitals) {
|
|
99571
|
+
const s = splitFindings(vitals.issues);
|
|
99312
99572
|
tiles.push({
|
|
99313
99573
|
icon: "\uD83D\uDCCA",
|
|
99314
99574
|
label: "Vitals",
|
|
99315
|
-
value: vitals.status === "pass" ? "✓" :
|
|
99316
|
-
meta: vitals.status === "pass" ? "no regressions" : `${
|
|
99317
|
-
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,
|
|
99318
99578
|
href: "#detail/web-vitals-mobile"
|
|
99319
99579
|
});
|
|
99320
99580
|
}
|
|
99321
99581
|
const seo = run.checks.find((c) => c.name === "seo-deep-audit");
|
|
99322
99582
|
if (seo) {
|
|
99323
|
-
const
|
|
99583
|
+
const s = splitFindings(seo.issues);
|
|
99584
|
+
const critical = s.live.filter((i) => i.severity === "critical").length;
|
|
99324
99585
|
tiles.push({
|
|
99325
99586
|
icon: "\uD83D\uDD0D",
|
|
99326
99587
|
label: "SEO",
|
|
99327
|
-
value: critical > 0 ? `${critical} crit` : seo.
|
|
99328
|
-
meta: critical > 0 ? "noindex / robots regression" : `${
|
|
99329
|
-
state: critical > 0 ? "fail" :
|
|
99588
|
+
value: critical > 0 ? `${critical} crit` : seo.issues.length === 0 ? "✓" : `${s.live.length}`,
|
|
99589
|
+
meta: (critical > 0 ? "noindex / robots regression" : `${s.live.length} issue(s)`) + s.suffix,
|
|
99590
|
+
state: critical > 0 ? "fail" : s.live.length > 0 ? "warn" : s.state,
|
|
99330
99591
|
href: "#detail/seo-deep-audit"
|
|
99331
99592
|
});
|
|
99332
99593
|
}
|
|
99333
99594
|
const console_ = run.checks.find((c) => c.name === "console-errors-baseline");
|
|
99334
99595
|
if (console_) {
|
|
99596
|
+
const s = splitFindings(console_.issues);
|
|
99335
99597
|
tiles.push({
|
|
99336
99598
|
icon: "\uD83D\uDD27",
|
|
99337
99599
|
label: "Console",
|
|
99338
|
-
value:
|
|
99339
|
-
meta:
|
|
99340
|
-
state:
|
|
99600
|
+
value: `${s.live.length}`,
|
|
99601
|
+
meta: (s.live.length > 0 ? `${s.live.length} new error(s) in cand` : "no new errors") + s.suffix,
|
|
99602
|
+
state: s.live.length > 0 ? "fail" : s.state,
|
|
99341
99603
|
href: "#detail/console-errors-baseline"
|
|
99342
99604
|
});
|
|
99343
99605
|
}
|
|
99344
99606
|
const visual = run.checks.find((c) => c.name === "visual-regression-keyframes");
|
|
99345
99607
|
if (visual) {
|
|
99346
99608
|
const vd = run.visualDiff;
|
|
99347
|
-
const value = vd ? `${vd.
|
|
99348
|
-
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";
|
|
99349
99613
|
tiles.push({
|
|
99350
99614
|
icon: "\uD83D\uDDBC",
|
|
99351
99615
|
label: "Visual",
|
|
99352
99616
|
value,
|
|
99353
|
-
meta,
|
|
99617
|
+
meta: pixelMeta + layoutNote,
|
|
99354
99618
|
state: visual.status === "pass" ? "pass" : visual.status === "skipped" ? "info" : "warn",
|
|
99355
99619
|
href: "#detail/visual-regression-keyframes"
|
|
99356
99620
|
});
|
|
@@ -100362,11 +100626,30 @@ function renderPromptPanel(run) {
|
|
|
100362
100626
|
</div>`;
|
|
100363
100627
|
}
|
|
100364
100628
|
function buildNav(run) {
|
|
100629
|
+
const vd = run.visualDiff;
|
|
100365
100630
|
const entries = [
|
|
100366
100631
|
{ tab: "summary", label: "Dashboard", icon: "\uD83C\uDFE0" },
|
|
100367
|
-
{
|
|
100368
|
-
|
|
100369
|
-
|
|
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
|
+
},
|
|
100370
100653
|
{ tab: "vitals", label: "Vitals", icon: "\uD83D\uDCCA" },
|
|
100371
100654
|
{ tab: "cache", label: "Cache", icon: "\uD83D\uDCBE" },
|
|
100372
100655
|
{ tab: "checks", label: "Checks", icon: "✓", count: run.checks.length },
|
|
@@ -100403,7 +100686,7 @@ function renderHtmlReport(run, runDir) {
|
|
|
100403
100686
|
${nav.map((n) => `<div class="nav-item" data-tab="${escapeHtml(n.tab)}">
|
|
100404
100687
|
<span class="icon">${n.icon}</span>
|
|
100405
100688
|
<span class="label">${escapeHtml(n.label)}</span>
|
|
100406
|
-
${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>` : ""}
|
|
100407
100690
|
</div>`).join("")}
|
|
100408
100691
|
</nav>
|
|
100409
100692
|
<div class="sidebar-footer">
|
|
@@ -113218,7 +113501,7 @@ function detectSource(repoDir) {
|
|
|
113218
113501
|
}
|
|
113219
113502
|
|
|
113220
113503
|
// src/migrate/theme.ts
|
|
113221
|
-
var
|
|
113504
|
+
var TRANSPARENT2 = new Set(["transparent", "rgba(0, 0, 0, 0)", "rgba(0,0,0,0)"]);
|
|
113222
113505
|
function parseRgb(color) {
|
|
113223
113506
|
const m = color.trim().match(/rgba?\(([^)]+)\)/i);
|
|
113224
113507
|
if (!m || !m[1])
|
|
@@ -113242,7 +113525,7 @@ function rank2(values) {
|
|
|
113242
113525
|
const counts = new Map;
|
|
113243
113526
|
for (const v of values) {
|
|
113244
113527
|
const key = v.trim();
|
|
113245
|
-
if (!key ||
|
|
113528
|
+
if (!key || TRANSPARENT2.has(key))
|
|
113246
113529
|
continue;
|
|
113247
113530
|
counts.set(key, (counts.get(key) ?? 0) + 1);
|
|
113248
113531
|
}
|
|
@@ -113306,7 +113589,7 @@ function aggregateTheme(raw) {
|
|
|
113306
113589
|
if (secondary)
|
|
113307
113590
|
tokens.secondary = secondary;
|
|
113308
113591
|
const bodyBg = raw.bodyBackground.trim();
|
|
113309
|
-
const background = bodyBg && !
|
|
113592
|
+
const background = bodyBg && !TRANSPARENT2.has(bodyBg) && isOpaque(bodyBg) ? bodyBg : [...rank2(raw.backgrounds).keys()].find((c) => isOpaque(c)) ?? null;
|
|
113310
113593
|
if (background)
|
|
113311
113594
|
tokens.background = background;
|
|
113312
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",
|