@decocms/parity 0.35.9 → 0.35.10
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 +83 -43
- 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
|
@@ -90568,6 +90568,8 @@ var REPORT_CSS = `
|
|
|
90568
90568
|
.visual-parity { margin: 6px 0 2px; font-size: 15px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
|
|
90569
90569
|
.visual-parity span { font-size: 12px; color: var(--text-muted); }
|
|
90570
90570
|
.score-breakdown { margin-bottom: 16px; }
|
|
90571
|
+
.sb-fail { font-size: 13px; color: var(--text-muted); margin: -4px 0 8px; }
|
|
90572
|
+
.sb-fail strong { color: var(--state-bad); }
|
|
90571
90573
|
.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
90574
|
.sb-table { width: 100%; border-collapse: collapse; font-size: 13px; }
|
|
90573
90575
|
.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); }
|
|
@@ -98551,7 +98553,14 @@ var SEVERITY_WEIGHTS = {
|
|
|
98551
98553
|
};
|
|
98552
98554
|
var DECAY_K = 35;
|
|
98553
98555
|
var FAIL_SCORE_CAP = 79;
|
|
98554
|
-
var SCORE_VERSION =
|
|
98556
|
+
var SCORE_VERSION = 3;
|
|
98557
|
+
function capTriggers(checks, issues) {
|
|
98558
|
+
const critical = issues.filter((i) => i.severity === "critical" && !i.inconclusive && !i.accepted).length;
|
|
98559
|
+
return [
|
|
98560
|
+
...checks.filter((c) => c.status === "fail" && c.issues.length === 0).map((c) => c.name),
|
|
98561
|
+
...critical > 0 ? [`${critical} critical issue${critical === 1 ? "" : "s"}`] : []
|
|
98562
|
+
];
|
|
98563
|
+
}
|
|
98555
98564
|
function computeScore(issues, opts) {
|
|
98556
98565
|
const pagesAnalyzed = Math.max(1, opts.pagesAnalyzed);
|
|
98557
98566
|
let totalPenalty = 0;
|
|
@@ -98590,7 +98599,7 @@ function computeVerdict(checks, issues, opts) {
|
|
|
98590
98599
|
const pagesAnalyzed = opts?.pagesAnalyzed ?? derivePagesAnalyzed(checks, issues);
|
|
98591
98600
|
let { score } = computeScore(issues, { pagesAnalyzed });
|
|
98592
98601
|
const status = measuredNothing(checks) ? "inconclusive" : counts.critical > 0 || checksFailed > 0 ? "fail" : counts.high > 0 || checksWarn > 0 ? "warn" : "pass";
|
|
98593
|
-
if (
|
|
98602
|
+
if (capTriggers(checks, issues).length > 0)
|
|
98594
98603
|
score = Math.min(score, FAIL_SCORE_CAP);
|
|
98595
98604
|
if (status === "inconclusive")
|
|
98596
98605
|
score = 0;
|
|
@@ -98640,7 +98649,7 @@ function computeModuleVerdicts(checks, issues) {
|
|
|
98640
98649
|
const uncappedScore = computeScore(modIssues, { pagesAnalyzed }).score;
|
|
98641
98650
|
let score = uncappedScore;
|
|
98642
98651
|
const status = counts.critical > 0 || checksFailed > 0 ? "fail" : counts.high > 0 || checksWarn > 0 ? "warn" : "pass";
|
|
98643
|
-
if (
|
|
98652
|
+
if (capTriggers(modChecks, modIssues).length > 0)
|
|
98644
98653
|
score = Math.min(score, FAIL_SCORE_CAP);
|
|
98645
98654
|
result.push({
|
|
98646
98655
|
module: mod,
|
|
@@ -98681,8 +98690,9 @@ function computeCompositeVerdict(moduleVerdicts, checks, issues) {
|
|
|
98681
98690
|
const nothingMeasured = weightSum === 0 || measuredNothing(checks);
|
|
98682
98691
|
let score = nothingMeasured ? 0 : Math.round(weightedScoreSum / weightSum);
|
|
98683
98692
|
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 (
|
|
98693
|
+
if (!nothingMeasured && capTriggers(checks, issues).length > 0) {
|
|
98685
98694
|
score = Math.min(score, FAIL_SCORE_CAP);
|
|
98695
|
+
}
|
|
98686
98696
|
return {
|
|
98687
98697
|
status,
|
|
98688
98698
|
score,
|
|
@@ -98705,9 +98715,16 @@ function explainCompositeScore(moduleVerdicts, verdict, checks) {
|
|
|
98705
98715
|
const weightSum = moduleVerdicts.reduce((s, mv) => s + moduleWeight(mv), 0);
|
|
98706
98716
|
const failedChecks = (mod) => checks.filter((c) => c.status === "fail" && (mod === undefined || moduleOfCheck(c.name) === mod)).map((c) => c.name);
|
|
98707
98717
|
const criticalNote = (n) => n > 0 ? [`${n} critical issue${n === 1 ? "" : "s"}`] : [];
|
|
98718
|
+
const capRuleV3 = (verdict.scoreVersion ?? 0) >= 3;
|
|
98719
|
+
const triggers = (mod) => {
|
|
98720
|
+
const inMod = (name) => mod === undefined || moduleOfCheck(name) === mod;
|
|
98721
|
+
const modChecks = checks.filter((c) => inMod(c.name));
|
|
98722
|
+
return capTriggers(modChecks, checks.flatMap((c) => c.issues).filter((i) => inMod(i.check)));
|
|
98723
|
+
};
|
|
98708
98724
|
const modules = moduleVerdicts.map((mv) => {
|
|
98709
98725
|
const weightShare = moduleWeight(mv) / weightSum;
|
|
98710
98726
|
const capBound = mv.status === "fail" && (mv.uncappedScore !== undefined ? mv.uncappedScore > mv.score : mv.score === FAIL_SCORE_CAP);
|
|
98727
|
+
const cappedBy = !capBound ? [] : capRuleV3 ? triggers(mv.module) : [...failedChecks(mv.module), ...criticalNote(mv.critical)];
|
|
98711
98728
|
return {
|
|
98712
98729
|
module: mv.module,
|
|
98713
98730
|
score: mv.score,
|
|
@@ -98715,20 +98732,24 @@ function explainCompositeScore(moduleVerdicts, verdict, checks) {
|
|
|
98715
98732
|
weight: moduleWeight(mv),
|
|
98716
98733
|
weightShare,
|
|
98717
98734
|
pointsLost: (100 - mv.score) * weightShare,
|
|
98718
|
-
cappedBy
|
|
98735
|
+
cappedBy
|
|
98719
98736
|
};
|
|
98720
98737
|
}).sort((a, b) => b.pointsLost - a.pointsLost || a.module.localeCompare(b.module));
|
|
98721
98738
|
const uncappedScore = Math.round(moduleVerdicts.reduce((s, mv) => s + mv.score * moduleWeight(mv), 0) / weightSum);
|
|
98722
98739
|
const failed = verdict.status === "fail";
|
|
98723
|
-
|
|
98740
|
+
const failedBy = failed ? [...failedChecks(), ...criticalNote(verdict.critical)] : [];
|
|
98741
|
+
const capBy = capRuleV3 ? triggers() : failedBy;
|
|
98742
|
+
if ((capBy.length > 0 ? Math.min(uncappedScore, FAIL_SCORE_CAP) : uncappedScore) !== verdict.score) {
|
|
98724
98743
|
return null;
|
|
98725
98744
|
}
|
|
98745
|
+
const capped = capBy.length > 0 && uncappedScore > FAIL_SCORE_CAP;
|
|
98726
98746
|
return {
|
|
98727
98747
|
modules,
|
|
98728
98748
|
uncappedScore,
|
|
98729
98749
|
score: verdict.score,
|
|
98730
|
-
capped
|
|
98731
|
-
|
|
98750
|
+
capped,
|
|
98751
|
+
capBy: capped ? capBy : [],
|
|
98752
|
+
failedBy
|
|
98732
98753
|
};
|
|
98733
98754
|
}
|
|
98734
98755
|
|
|
@@ -99175,7 +99196,7 @@ function tabHelp(text) {
|
|
|
99175
99196
|
function renderDashboard2(run) {
|
|
99176
99197
|
const v = run.verdict;
|
|
99177
99198
|
const inconclusive = v.status === "inconclusive";
|
|
99178
|
-
const statusLabel = inconclusive ? "Inconclusive" : v.status === "pass" ? "Excellent" : v.status === "warn" ? "Warnings" : "Critical";
|
|
99199
|
+
const statusLabel = inconclusive ? "Inconclusive" : v.status === "pass" ? "Excellent" : v.status === "warn" ? "Warnings" : v.critical > 0 ? "Critical" : "Fail";
|
|
99179
99200
|
const ringColor = inconclusive ? "var(--text-dim, #888)" : v.status === "pass" ? "var(--state-good)" : v.status === "warn" ? "var(--state-warn)" : "var(--state-bad)";
|
|
99180
99201
|
const ringDeg = inconclusive ? "0deg" : `${Math.round(v.score / 100 * 360)}deg`;
|
|
99181
99202
|
const prev = run.previousRun;
|
|
@@ -99249,7 +99270,7 @@ function renderScoreBreakdown(run) {
|
|
|
99249
99270
|
return "";
|
|
99250
99271
|
const totalLost = ex.modules.reduce((s, m) => s + m.pointsLost, 0);
|
|
99251
99272
|
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
|
|
99273
|
+
const capNote = (by) => by.length > 0 ? `<div class="sb-cap">held at ${FAIL_SCORE_CAP} by ${escapeHtml(by.join(", "))}</div>` : "";
|
|
99253
99274
|
const rows = ex.modules.map((m) => `<tr>
|
|
99254
99275
|
<td><strong>${escapeHtml(m.module)}</strong>${capNote(m.cappedBy)}</td>
|
|
99255
99276
|
<td><span class="sb-status" style="color:${STATUS_COLOR[m.status]}">${m.status}</span></td>
|
|
@@ -99257,10 +99278,12 @@ function renderScoreBreakdown(run) {
|
|
|
99257
99278
|
<td class="num">${Math.round(m.weightShare * 100)}%<small> · ${m.weight} page${m.weight === 1 ? "" : "s"}</small></td>
|
|
99258
99279
|
<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
99280
|
</tr>`).join("");
|
|
99260
|
-
const headline = ex.capped ? `<div class="sb-capped">Capped at ${FAIL_SCORE_CAP}: the modules average ${ex.uncappedScore}, but
|
|
99281
|
+
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>` : "";
|
|
99282
|
+
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
99283
|
return `<div class="card score-breakdown">
|
|
99262
99284
|
<h2>Why ${ex.score}?</h2>
|
|
99263
|
-
|
|
99285
|
+
${failLine}
|
|
99286
|
+
<div class="hint">${ex.uncappedScore} = 100 − ${totalLost.toFixed(1)} points lost, each module weighted by the pages it analyzed.</div>
|
|
99264
99287
|
${headline}
|
|
99265
99288
|
<table class="sb-table">
|
|
99266
99289
|
<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 +99291,48 @@ function renderScoreBreakdown(run) {
|
|
|
99268
99291
|
</table>
|
|
99269
99292
|
</div>`;
|
|
99270
99293
|
}
|
|
99294
|
+
function splitFindings(issues) {
|
|
99295
|
+
const live = issues.filter((i) => !i.inconclusive && !i.accepted);
|
|
99296
|
+
const notJudged = issues.filter((i) => i.inconclusive && !i.accepted).length;
|
|
99297
|
+
const accepted = issues.filter((i) => i.accepted).length;
|
|
99298
|
+
const suffix = (notJudged > 0 ? ` · +${notJudged} not judged (inconclusive)` : "") + (accepted > 0 ? ` · ${accepted} accepted` : "");
|
|
99299
|
+
const state = notJudged > 0 ? "info" : "pass";
|
|
99300
|
+
return { live, suffix, state };
|
|
99301
|
+
}
|
|
99302
|
+
function journeyTile(run, pj) {
|
|
99303
|
+
const failed = (pj.data ?? {}).failedSteps ?? 0;
|
|
99304
|
+
const caps = run.flowCaptures.filter((fc) => fc.flow === "purchase-journey" && fc.steps?.length);
|
|
99305
|
+
const tile = { icon: "\uD83D\uDED2", label: "Journey", href: "#detail/purchase-journey-flow" };
|
|
99306
|
+
if (caps.length === 0)
|
|
99307
|
+
return { ...tile, value: "—", meta: "no journey captured", state: "warn" };
|
|
99308
|
+
const total = Math.max(...caps.map((fc) => fc.steps.length));
|
|
99309
|
+
const side = (name) => {
|
|
99310
|
+
const mine = caps.filter((fc) => fc.side === name);
|
|
99311
|
+
const skipped = [
|
|
99312
|
+
...new Set(mine.flatMap((fc) => fc.steps.filter((s) => s.status === "skipped").map((s) => s.name)))
|
|
99313
|
+
];
|
|
99314
|
+
return {
|
|
99315
|
+
captured: mine.length > 0,
|
|
99316
|
+
ok: Math.min(...mine.map((fc) => fc.steps.filter((s) => s.status === "ok").length)),
|
|
99317
|
+
reached: mine.length > 0 && mine.every((fc) => fc.steps.some((s) => s.name === "go-checkout" && s.status === "ok")),
|
|
99318
|
+
skipped
|
|
99319
|
+
};
|
|
99320
|
+
};
|
|
99321
|
+
const prod = side("prod");
|
|
99322
|
+
const cand = side("cand");
|
|
99323
|
+
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"}`;
|
|
99324
|
+
const sameSkips = prod.skipped.join() === cand.skipped.join();
|
|
99325
|
+
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"}`;
|
|
99326
|
+
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}`;
|
|
99327
|
+
const meta = (failed > 0 ? `${failed} step(s) failed · ` : "") + reach + skips;
|
|
99328
|
+
const state = failed > 0 || prod.reached && !cand.reached ? "fail" : !cand.reached || !prod.reached || !sameSkips ? "warn" : "pass";
|
|
99329
|
+
return { ...tile, value, meta, state };
|
|
99330
|
+
}
|
|
99271
99331
|
function buildTiles(run) {
|
|
99272
99332
|
const tiles = [];
|
|
99273
99333
|
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
|
-
}
|
|
99334
|
+
if (pj)
|
|
99335
|
+
tiles.push(journeyTile(run, pj));
|
|
99298
99336
|
const cache = run.checks.find((c) => c.name === "cache-coverage");
|
|
99299
99337
|
if (cache) {
|
|
99300
99338
|
const data = cache.data ?? {};
|
|
@@ -99320,24 +99358,26 @@ function buildTiles(run) {
|
|
|
99320
99358
|
}
|
|
99321
99359
|
const seo = run.checks.find((c) => c.name === "seo-deep-audit");
|
|
99322
99360
|
if (seo) {
|
|
99323
|
-
const
|
|
99361
|
+
const s = splitFindings(seo.issues);
|
|
99362
|
+
const critical = s.live.filter((i) => i.severity === "critical").length;
|
|
99324
99363
|
tiles.push({
|
|
99325
99364
|
icon: "\uD83D\uDD0D",
|
|
99326
99365
|
label: "SEO",
|
|
99327
|
-
value: critical > 0 ? `${critical} crit` : seo.
|
|
99328
|
-
meta: critical > 0 ? "noindex / robots regression" : `${
|
|
99329
|
-
state: critical > 0 ? "fail" :
|
|
99366
|
+
value: critical > 0 ? `${critical} crit` : seo.issues.length === 0 ? "✓" : `${s.live.length}`,
|
|
99367
|
+
meta: (critical > 0 ? "noindex / robots regression" : `${s.live.length} issue(s)`) + s.suffix,
|
|
99368
|
+
state: critical > 0 ? "fail" : s.live.length > 0 ? "warn" : s.state,
|
|
99330
99369
|
href: "#detail/seo-deep-audit"
|
|
99331
99370
|
});
|
|
99332
99371
|
}
|
|
99333
99372
|
const console_ = run.checks.find((c) => c.name === "console-errors-baseline");
|
|
99334
99373
|
if (console_) {
|
|
99374
|
+
const s = splitFindings(console_.issues);
|
|
99335
99375
|
tiles.push({
|
|
99336
99376
|
icon: "\uD83D\uDD27",
|
|
99337
99377
|
label: "Console",
|
|
99338
|
-
value:
|
|
99339
|
-
meta:
|
|
99340
|
-
state:
|
|
99378
|
+
value: `${s.live.length}`,
|
|
99379
|
+
meta: (s.live.length > 0 ? `${s.live.length} new error(s) in cand` : "no new errors") + s.suffix,
|
|
99380
|
+
state: s.live.length > 0 ? "fail" : s.state,
|
|
99341
99381
|
href: "#detail/console-errors-baseline"
|
|
99342
99382
|
});
|
|
99343
99383
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decocms/parity",
|
|
3
|
-
"version": "0.35.
|
|
3
|
+
"version": "0.35.10",
|
|
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",
|