@decocms/parity 0.33.39 → 0.33.41
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 +47 -9
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -64104,7 +64104,7 @@ function disposition(c) {
|
|
|
64104
64104
|
return "settled";
|
|
64105
64105
|
if (c.status === "as-is")
|
|
64106
64106
|
return "as-is";
|
|
64107
|
-
if (c.verified)
|
|
64107
|
+
if (c.verified && c.verified.verdict !== "inconclusive")
|
|
64108
64108
|
return "settled";
|
|
64109
64109
|
if (c.status === "upgrade")
|
|
64110
64110
|
return c.reference ? "validate" : "upgrade";
|
|
@@ -64637,7 +64637,7 @@ function diffBoxTrees(prod, cand, opts = {}) {
|
|
|
64637
64637
|
onlyInProd: onlyInProd.map(brief("prod")),
|
|
64638
64638
|
onlyInCand: onlyInCand.map(brief("cand")),
|
|
64639
64639
|
deltas: deltas.slice(0, maxDeltas),
|
|
64640
|
-
truncated: opts.truncated ?? false
|
|
64640
|
+
truncated: (opts.truncated ?? false) || deltas.length > maxDeltas
|
|
64641
64641
|
};
|
|
64642
64642
|
}
|
|
64643
64643
|
function isBoxTreeInconclusive(diff) {
|
|
@@ -69168,8 +69168,8 @@ function planSetReferenceCommand(dir, name, opts) {
|
|
|
69168
69168
|
return 0;
|
|
69169
69169
|
}
|
|
69170
69170
|
function planVerifyCommand(dir, name, verdict, opts) {
|
|
69171
|
-
if (verdict !== "pass" && verdict !== "fail") {
|
|
69172
|
-
console.error(chalk21.red(`Invalid verdict "${verdict}". Use pass or
|
|
69171
|
+
if (verdict !== "pass" && verdict !== "fail" && verdict !== "inconclusive") {
|
|
69172
|
+
console.error(chalk21.red(`Invalid verdict "${verdict}". Use pass, fail or inconclusive.`));
|
|
69173
69173
|
return 1;
|
|
69174
69174
|
}
|
|
69175
69175
|
const plan = loadPlan(dir);
|
|
@@ -69183,7 +69183,7 @@ function planVerifyCommand(dir, name, verdict, opts) {
|
|
|
69183
69183
|
return 1;
|
|
69184
69184
|
}
|
|
69185
69185
|
savePlan(dir, plan);
|
|
69186
|
-
const mark = verdict === "pass" ? chalk21.green("✓") : chalk21.red("✗");
|
|
69186
|
+
const mark = verdict === "pass" ? chalk21.green("✓") : verdict === "inconclusive" ? chalk21.yellow("?") : chalk21.red("✗");
|
|
69187
69187
|
console.log(`${mark} ${component.name} → ${verdict} (against ${component.verified?.against})`);
|
|
69188
69188
|
return 0;
|
|
69189
69189
|
}
|
|
@@ -74624,8 +74624,12 @@ function parseViewports2(raw) {
|
|
|
74624
74624
|
const entries = (raw.trim() === "all" ? ALL_VIEWPORTS : raw).split(",").map((s) => s.trim()).filter((s) => s.length > 0);
|
|
74625
74625
|
if (entries.length === 0)
|
|
74626
74626
|
return "--viewports is empty";
|
|
74627
|
+
const seen = new Set;
|
|
74627
74628
|
const specs = [];
|
|
74628
74629
|
for (const entry of entries) {
|
|
74630
|
+
if (seen.has(entry))
|
|
74631
|
+
return `viewport '${entry}' appears twice in --viewports`;
|
|
74632
|
+
seen.add(entry);
|
|
74629
74633
|
const named = parseViewport3(entry);
|
|
74630
74634
|
if (named) {
|
|
74631
74635
|
specs.push({ label: entry, viewport: named, size: null });
|
|
@@ -74652,9 +74656,10 @@ function aggregateVerdict(results) {
|
|
|
74652
74656
|
const differing = results.filter((r) => r.verdict === "differs");
|
|
74653
74657
|
if (differing.length > 0) {
|
|
74654
74658
|
const total = differing.reduce((sum, r) => sum + (r.diffPixels ?? 0), 0);
|
|
74659
|
+
const count = total > 0 ? ` (${total} pixels in total)` : "";
|
|
74655
74660
|
return {
|
|
74656
74661
|
verdict: "differs",
|
|
74657
|
-
reason: `${differing.length}/${results.length} viewports differ
|
|
74662
|
+
reason: `${differing.length}/${results.length} viewports differ${count}: ${differing.map((r) => r.label).join(", ")}`
|
|
74658
74663
|
};
|
|
74659
74664
|
}
|
|
74660
74665
|
const unread = results.filter((r) => r.verdict === "inconclusive");
|
|
@@ -74666,6 +74671,7 @@ function aggregateVerdict(results) {
|
|
|
74666
74671
|
}
|
|
74667
74672
|
return { verdict: "identical" };
|
|
74668
74673
|
}
|
|
74674
|
+
var MIN_COMPARABLE_PIXELS = 100;
|
|
74669
74675
|
var EXIT_IDENTICAL = 0;
|
|
74670
74676
|
var EXIT_DIFFERS = 1;
|
|
74671
74677
|
var EXIT_INCONCLUSIVE = 2;
|
|
@@ -74934,6 +74940,17 @@ function judgePair(args) {
|
|
|
74934
74940
|
reason: `different dimensions (prod ${fmtSize(diff.prodSize)}, cand ${fmtSize(diff.candSize)}) — the comparison would only look at the intersection`
|
|
74935
74941
|
};
|
|
74936
74942
|
}
|
|
74943
|
+
const comparedPixels = diff.width * diff.height;
|
|
74944
|
+
if (comparedPixels < MIN_COMPARABLE_PIXELS) {
|
|
74945
|
+
return {
|
|
74946
|
+
...base,
|
|
74947
|
+
size,
|
|
74948
|
+
noiseFloorPixels,
|
|
74949
|
+
maskedCoverage,
|
|
74950
|
+
verdict: "inconclusive",
|
|
74951
|
+
reason: `only ${comparedPixels} pixels were compared (${diff.width}×${diff.height}) — the selector resolves to something too small to be a verdict about the page`
|
|
74952
|
+
};
|
|
74953
|
+
}
|
|
74937
74954
|
const analysis = analyzeHeatmapRegions(paths.diff, { minComponentPixels: 1 });
|
|
74938
74955
|
return {
|
|
74939
74956
|
...base,
|
|
@@ -74955,7 +74972,10 @@ function explainHotspots(hotspots, prod, cand, paths, prodBoxTree, candBoxTree)
|
|
|
74955
74972
|
return [];
|
|
74956
74973
|
const p = prodBoxTree;
|
|
74957
74974
|
const c = candBoxTree;
|
|
74958
|
-
const paired = p?.found && c?.found ? diffBoxTrees(p.nodes, c.nodes, {
|
|
74975
|
+
const paired = p?.found && c?.found ? diffBoxTrees(p.nodes, c.nodes, {
|
|
74976
|
+
truncated: p.truncated || c.truncated,
|
|
74977
|
+
tolerancePx: 0
|
|
74978
|
+
}) : null;
|
|
74959
74979
|
return attributeHotspots({
|
|
74960
74980
|
hotspots,
|
|
74961
74981
|
nodes: p?.found ? p.nodes : [],
|
|
@@ -75033,9 +75053,14 @@ async function captureSide(browser, args) {
|
|
|
75033
75053
|
side.screenshot = args.outPath;
|
|
75034
75054
|
} else {
|
|
75035
75055
|
await page.screenshot({ path: args.outPath, fullPage: true, animations: "disabled" });
|
|
75056
|
+
const clipped = await wasClipped(page, args.outPath);
|
|
75057
|
+
if (clipped) {
|
|
75058
|
+
side.error = clipped;
|
|
75059
|
+
return { side, repeatScreenshot, repeatError: clipped, boxTree };
|
|
75060
|
+
}
|
|
75036
75061
|
side.screenshot = args.outPath;
|
|
75037
75062
|
}
|
|
75038
|
-
boxTree = await readBoxTree(page, args.selector ?? "body").catch(() => {
|
|
75063
|
+
boxTree = await readBoxTree(page, args.selector ?? "body", args.selector ? {} : { maxNodes: 4000, maxDepth: 25 }).catch(() => {
|
|
75039
75064
|
return;
|
|
75040
75065
|
});
|
|
75041
75066
|
side.imageHosts = await readImageHosts(page, args.selector);
|
|
@@ -75065,6 +75090,19 @@ async function captureSide(browser, args) {
|
|
|
75065
75090
|
}
|
|
75066
75091
|
return { side, repeatScreenshot, repeatError, boxTree };
|
|
75067
75092
|
}
|
|
75093
|
+
async function wasClipped(page, pngPath) {
|
|
75094
|
+
try {
|
|
75095
|
+
const expected = await page.evaluate(() => document.documentElement.scrollHeight * window.devicePixelRatio);
|
|
75096
|
+
const actual = readPngSize(pngPath)?.height;
|
|
75097
|
+
if (!actual || !expected)
|
|
75098
|
+
return null;
|
|
75099
|
+
if (actual >= expected - 4)
|
|
75100
|
+
return null;
|
|
75101
|
+
return `the full-page capture stopped at ${actual}px of ${Math.round(expected)}px — the page is taller than the screenshot surface, so its lower part was never compared`;
|
|
75102
|
+
} catch {
|
|
75103
|
+
return null;
|
|
75104
|
+
}
|
|
75105
|
+
}
|
|
75068
75106
|
async function isAlreadyOnScreen(page, selector) {
|
|
75069
75107
|
if (!selector)
|
|
75070
75108
|
return false;
|
|
@@ -76291,7 +76329,7 @@ program.command("plan").description("Inspect/update the migration-plan.json comp
|
|
|
76291
76329
|
}));
|
|
76292
76330
|
})).addCommand(new Command("merge").description("Bring a freshly captured plan into the canonical one, keeping every recorded decision (ported / as-is / upgrade / verified). Use this instead of copying the file — a copy reverts the decisions.").argument("<source>", "Directory holding the freshly captured migration-plan.json").option("--dir <path>", "Destination directory holding the canonical migration-plan.json", ".parity").action((source, opts) => {
|
|
76293
76331
|
process.exit(planMergeCommand(opts.dir, source));
|
|
76294
|
-
})).addCommand(new Command("verify").description("Record that a component was actually compared against its reference. A `done` row with no verification only means the code exists.").argument("<name>", "Component name (case- and separator-insensitive)").argument("<verdict>", "pass | fail").option("--note <text>", "What was seen").option("--at <iso>", "Timestamp (default: now)").option("--dir <path>", "Directory holding migration-plan.json (default: the target repo's .parity/)", ".parity").action((name, verdict, opts) => {
|
|
76332
|
+
})).addCommand(new Command("verify").description("Record that a component was actually compared against its reference. A `done` row with no verification only means the code exists.").argument("<name>", "Component name (case- and separator-insensitive)").argument("<verdict>", "pass | fail | inconclusive. `inconclusive` means the comparison could not be made (wrong element count, different sizes, an unstable reference) — the row stays open rather than settling, because nothing was measured.").option("--note <text>", "What was seen").option("--at <iso>", "Timestamp (default: now)").option("--dir <path>", "Directory holding migration-plan.json (default: the target repo's .parity/)", ".parity").action((name, verdict, opts) => {
|
|
76295
76333
|
process.exit(planVerifyCommand(opts.dir, name, verdict, { note: opts.note, at: opts.at }));
|
|
76296
76334
|
}));
|
|
76297
76335
|
program.command("cms").description("Read and write VTEX Content Platform entries — the CMS behind FastStore v4. Every write is a commit on a branch carrying the baseHash it was read at, so a concurrent edit fails the commit instead of silently winning. Needs PARITY_CMS_ACCOUNT + PARITY_CMS_STORE and a `vtex login` session (or PARITY_CMS_TOKEN).").addCommand(new Command("doctor").description("Compare the sections the repo declares against the ones published on the account. A section that exists in code but was never uploaded commits fine and renders nothing — this is the check that catches it.").option("--repo <path>", "Repo holding cms/faststore/pages/", ".").option("--json", "Emit structured JSON instead of human-readable text", false).action(async (opts) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decocms/parity",
|
|
3
|
-
"version": "0.33.
|
|
3
|
+
"version": "0.33.41",
|
|
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",
|