@decocms/parity 0.35.14 → 0.35.15
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/README.md +2 -1
- package/dist/cli.js +392 -77
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -81,8 +81,9 @@ Without any provider, the CLI still runs and outputs raw check results.
|
|
|
81
81
|
|
|
82
82
|
```
|
|
83
83
|
./parity-output/runs/<runId>/
|
|
84
|
-
├── report.html # links to screenshots/ by relative path — keep the two together
|
|
85
84
|
├── report.json # structured output for agents / CI / tooling
|
|
85
|
+
├── report.html # only with --html/--open, or rendered later by `parity report <runId>`;
|
|
86
|
+
│ # links to screenshots/ by relative path — keep the two together
|
|
86
87
|
├── screenshots/ # per-page, per-viewport, per-side; includes pixelmatch heatmaps
|
|
87
88
|
├── har/ # Playwright HARs, one per viewport/side — only with PARITY_HAR=1
|
|
88
89
|
└── traces/ # Playwright traces (drag into trace.playwright.dev) — only with PARITY_TRACE=1
|
package/dist/cli.js
CHANGED
|
@@ -76348,6 +76348,10 @@ async function disableHttpCache(page) {
|
|
|
76348
76348
|
function sizeOf(preset) {
|
|
76349
76349
|
return preset.viewport ? { width: preset.viewport.width, height: preset.viewport.height } : undefined;
|
|
76350
76350
|
}
|
|
76351
|
+
var headersByContext = new WeakMap;
|
|
76352
|
+
function contextPinHeaders(ctx) {
|
|
76353
|
+
return headersByContext.get(ctx);
|
|
76354
|
+
}
|
|
76351
76355
|
async function newContext(browser, opts) {
|
|
76352
76356
|
const baseContext = VIEWPORT_PRESETS[opts.viewport];
|
|
76353
76357
|
const ctx = await browser.newContext({
|
|
@@ -76359,8 +76363,13 @@ async function newContext(browser, opts) {
|
|
|
76359
76363
|
recordVideo: opts.recordVideo ? { dir: opts.recordVideo.dir, size: opts.viewportSize ?? sizeOf(baseContext) } : undefined,
|
|
76360
76364
|
bypassCSP: true,
|
|
76361
76365
|
ignoreHTTPSErrors: true,
|
|
76362
|
-
extraHTTPHeaders: opts.noCache ? {
|
|
76366
|
+
extraHTTPHeaders: opts.noCache || opts.headers ? {
|
|
76367
|
+
...opts.headers,
|
|
76368
|
+
...opts.noCache ? { "Cache-Control": "no-cache", Pragma: "no-cache" } : {}
|
|
76369
|
+
} : undefined
|
|
76363
76370
|
});
|
|
76371
|
+
if (opts.headers && Object.keys(opts.headers).length > 0)
|
|
76372
|
+
headersByContext.set(ctx, opts.headers);
|
|
76364
76373
|
if (opts.noCache || opts.diskCacheDisabled) {
|
|
76365
76374
|
const rawNewPage = ctx.newPage.bind(ctx);
|
|
76366
76375
|
ctx.newPage = async () => {
|
|
@@ -76493,7 +76502,7 @@ function parseCookieFlags(values, pageUrl) {
|
|
|
76493
76502
|
return values.map((v) => {
|
|
76494
76503
|
const eq = v.indexOf("=");
|
|
76495
76504
|
if (eq <= 0)
|
|
76496
|
-
throw new Error(
|
|
76505
|
+
throw new Error("cookie pin expects name=value");
|
|
76497
76506
|
return { name: v.slice(0, eq).trim(), value: v.slice(eq + 1), domain, path: "/" };
|
|
76498
76507
|
});
|
|
76499
76508
|
}
|
|
@@ -79249,6 +79258,112 @@ function pickHome4(pages) {
|
|
|
79249
79258
|
});
|
|
79250
79259
|
}
|
|
79251
79260
|
|
|
79261
|
+
// src/engine/variant.ts
|
|
79262
|
+
var FRESH_MARKERS = [
|
|
79263
|
+
["__FRSH_STATE", /__FRSH_STATE/],
|
|
79264
|
+
["/_frsh/js", /\/_frsh\/js\//],
|
|
79265
|
+
["island-*.js", /\bisland-[a-z0-9_.-]+\.js\b/i]
|
|
79266
|
+
];
|
|
79267
|
+
var TANSTACK_MARKERS = [["$_TSR", /\$_TSR/]];
|
|
79268
|
+
var ASSETS_BUNDLE = /<script[^>]+src="[^"]*\/assets\/[^"]+\.js"/i;
|
|
79269
|
+
var STACK_HEADERS = ["x-powered-by", "x-deco-platform"];
|
|
79270
|
+
function isAbCookie(name) {
|
|
79271
|
+
return /bucket/i.test(name) || isExperimentName(name);
|
|
79272
|
+
}
|
|
79273
|
+
function fingerprintVariant(html, headers, cookieNames) {
|
|
79274
|
+
const signals = [];
|
|
79275
|
+
let fresh = false;
|
|
79276
|
+
let tanstack = false;
|
|
79277
|
+
for (const h of STACK_HEADERS) {
|
|
79278
|
+
const v = headers[h];
|
|
79279
|
+
if (!v)
|
|
79280
|
+
continue;
|
|
79281
|
+
signals.push(`${h}=${v.slice(0, 60)}`);
|
|
79282
|
+
if (/fresh/i.test(v))
|
|
79283
|
+
fresh = true;
|
|
79284
|
+
if (/tanstack/i.test(v))
|
|
79285
|
+
tanstack = true;
|
|
79286
|
+
}
|
|
79287
|
+
for (const [label, re] of FRESH_MARKERS)
|
|
79288
|
+
if (re.test(html)) {
|
|
79289
|
+
signals.push(`fresh:${label}`);
|
|
79290
|
+
fresh = true;
|
|
79291
|
+
}
|
|
79292
|
+
for (const [label, re] of TANSTACK_MARKERS)
|
|
79293
|
+
if (re.test(html)) {
|
|
79294
|
+
signals.push(`tanstack:${label}`);
|
|
79295
|
+
tanstack = true;
|
|
79296
|
+
}
|
|
79297
|
+
if (ASSETS_BUNDLE.test(html))
|
|
79298
|
+
signals.push("bundle:/assets/*.js");
|
|
79299
|
+
for (const n of [...new Set(cookieNames)].filter(isAbCookie).sort())
|
|
79300
|
+
signals.push(`cookie:${n}`);
|
|
79301
|
+
const stack = fresh === tanstack ? "unknown" : fresh ? "fresh" : "tanstack";
|
|
79302
|
+
return { stack, signals };
|
|
79303
|
+
}
|
|
79304
|
+
var LABEL = {
|
|
79305
|
+
fresh: "Fresh",
|
|
79306
|
+
tanstack: "TanStack"
|
|
79307
|
+
};
|
|
79308
|
+
function stackCounts(pages, keyOf) {
|
|
79309
|
+
const seen = new Map;
|
|
79310
|
+
for (const p of pages) {
|
|
79311
|
+
const s = p.variant?.stack;
|
|
79312
|
+
if (!s || s === "unknown")
|
|
79313
|
+
continue;
|
|
79314
|
+
seen.set(s, (seen.get(s) ?? new Set).add(keyOf(p)));
|
|
79315
|
+
}
|
|
79316
|
+
return new Map([...seen].map(([s, keys]) => [s, keys.size]));
|
|
79317
|
+
}
|
|
79318
|
+
function describeMix(counts) {
|
|
79319
|
+
if (counts.size < 2)
|
|
79320
|
+
return null;
|
|
79321
|
+
return [...counts].map(([s, n], i) => `${n}${i === 0 ? n === 1 ? " page" : " pages" : ""} ${LABEL[s]}`).join(", ");
|
|
79322
|
+
}
|
|
79323
|
+
|
|
79324
|
+
// src/checks/lib/variant-guard.ts
|
|
79325
|
+
function variantMismatches(prodPages, candPages) {
|
|
79326
|
+
const prodMix = describeMix(stackCounts(prodPages, captureKey));
|
|
79327
|
+
const candMix = describeMix(stackCounts(candPages, captureKey));
|
|
79328
|
+
if (!prodMix && !candMix)
|
|
79329
|
+
return null;
|
|
79330
|
+
const mixed = [prodMix && `prod served mixed variants: ${prodMix}`, candMix && `cand served mixed variants: ${candMix}`].filter(Boolean).join("; ");
|
|
79331
|
+
const keys = new Map;
|
|
79332
|
+
for (const { key, prod, cand } of pairCaptures(prodPages, candPages).pairs) {
|
|
79333
|
+
const p = prod.variant?.stack;
|
|
79334
|
+
const c = cand.variant?.stack;
|
|
79335
|
+
if (p && c && p !== "unknown" && c !== "unknown" && p !== c)
|
|
79336
|
+
keys.set(key, `prod=${p}, cand=${c}`);
|
|
79337
|
+
}
|
|
79338
|
+
return { mixed, keys };
|
|
79339
|
+
}
|
|
79340
|
+
function withSameVariant(check) {
|
|
79341
|
+
const guarded = async (ctx) => {
|
|
79342
|
+
const mismatch = variantMismatches(ctx.prodPages, ctx.candPages);
|
|
79343
|
+
if (!mismatch || mismatch.keys.size === 0)
|
|
79344
|
+
return check(ctx);
|
|
79345
|
+
const keep = (pages) => pages.filter((p) => !mismatch.keys.has(captureKey(p)));
|
|
79346
|
+
const result = await check({ ...ctx, prodPages: keep(ctx.prodPages), candPages: keep(ctx.candPages) });
|
|
79347
|
+
const issues = [...mismatch.keys].map(([key, stacks]) => ({
|
|
79348
|
+
id: `${result.name}:variant-mismatch:${key}`,
|
|
79349
|
+
severity: "low",
|
|
79350
|
+
inconclusive: true,
|
|
79351
|
+
category: "functional",
|
|
79352
|
+
page: key,
|
|
79353
|
+
check: result.name,
|
|
79354
|
+
summary: `${key}: prod and cand served by different builds (${stacks}) — not compared by ${result.name}`,
|
|
79355
|
+
details: `${mismatch.mixed} — pin with --prod-cookie/--prod-header. Script counts, request volume and vitals of a pair served by two different stacks measure the A/B bucket, not the migration.`
|
|
79356
|
+
}));
|
|
79357
|
+
return {
|
|
79358
|
+
...result,
|
|
79359
|
+
status: result.status === "pass" ? "warn" : result.status,
|
|
79360
|
+
issues: [...result.issues, ...issues]
|
|
79361
|
+
};
|
|
79362
|
+
};
|
|
79363
|
+
Object.defineProperty(guarded, "name", { value: check.name });
|
|
79364
|
+
return guarded;
|
|
79365
|
+
}
|
|
79366
|
+
|
|
79252
79367
|
// src/diff/network.ts
|
|
79253
79368
|
function summarizeNetwork(entries) {
|
|
79254
79369
|
const summary = {
|
|
@@ -82565,12 +82680,17 @@ async function warmBeforeCapture(ctx, url, viewport) {
|
|
|
82565
82680
|
return;
|
|
82566
82681
|
const start = Date.now();
|
|
82567
82682
|
const cookies = await ctx.cookies(url).catch(() => []);
|
|
82683
|
+
const headers = contextPinHeaders(ctx);
|
|
82568
82684
|
for (let i = 0;i < cfg.loads; i++) {
|
|
82569
82685
|
cfg.stats.loads++;
|
|
82570
82686
|
const deadline = Date.now() + VITALS_WARM_TIMEOUT_MS;
|
|
82571
82687
|
let warm;
|
|
82572
82688
|
try {
|
|
82573
|
-
warm = await browser.newContext({
|
|
82689
|
+
warm = await browser.newContext({
|
|
82690
|
+
...VIEWPORT_PRESETS[viewport],
|
|
82691
|
+
ignoreHTTPSErrors: true,
|
|
82692
|
+
extraHTTPHeaders: headers
|
|
82693
|
+
});
|
|
82574
82694
|
if (cookies.length > 0)
|
|
82575
82695
|
await warm.addCookies(cookies);
|
|
82576
82696
|
const page = await warm.newPage();
|
|
@@ -83117,8 +83237,10 @@ async function capturePage(page, opts) {
|
|
|
83117
83237
|
harPath: opts.harPath,
|
|
83118
83238
|
tracePath: opts.tracePath,
|
|
83119
83239
|
xRobotsTag,
|
|
83120
|
-
pairKey: opts.pairKey
|
|
83240
|
+
pairKey: opts.pairKey,
|
|
83241
|
+
...response ? { variant: fingerprintVariant(html, response.headers(), cookieNames) } : {}
|
|
83121
83242
|
});
|
|
83243
|
+
let cookieNames = [];
|
|
83122
83244
|
let response = null;
|
|
83123
83245
|
let finalUrl = opts.url;
|
|
83124
83246
|
let xRobotsTag = null;
|
|
@@ -83249,6 +83371,7 @@ async function capturePage(page, opts) {
|
|
|
83249
83371
|
}
|
|
83250
83372
|
dlog(opts.side, opts.viewport, ` capturePage: page.content() (cap=${Math.min(5000, remaining())}ms)`);
|
|
83251
83373
|
html = await snapshotHtml(page, Math.min(5000, remaining()));
|
|
83374
|
+
cookieNames = await Promise.resolve().then(() => page.context().cookies(page.url())).then((cs) => cs.map((c) => c.name)).catch(() => []);
|
|
83252
83375
|
dlog(opts.side, opts.viewport, ` capturePage: flushCollectors (cap=${Math.min(3000, remaining())}ms)`);
|
|
83253
83376
|
await flushCollectors(state, Math.min(3000, remaining()));
|
|
83254
83377
|
const extraRuns = Math.max(0, (opts.runs ?? 1) - 1);
|
|
@@ -84099,6 +84222,59 @@ function screenshotPath(ctx, label) {
|
|
|
84099
84222
|
const safe = label.replace(/[^a-z0-9_-]+/gi, "-").toLowerCase();
|
|
84100
84223
|
return `${ctx.outDir}/${safe}-${ctx.viewport}-${ctx.side}.png`;
|
|
84101
84224
|
}
|
|
84225
|
+
var DEDICATED_FLOWS = new Set(["homepage", "plp", "pdp"]);
|
|
84226
|
+
var dedicatedCaptures = new WeakMap;
|
|
84227
|
+
function rememberDedicatedCaptures(flow, ctx, pages) {
|
|
84228
|
+
if (!DEDICATED_FLOWS.has(flow))
|
|
84229
|
+
return;
|
|
84230
|
+
let byKey = dedicatedCaptures.get(ctx);
|
|
84231
|
+
if (!byKey) {
|
|
84232
|
+
byKey = new Map;
|
|
84233
|
+
dedicatedCaptures.set(ctx, byKey);
|
|
84234
|
+
}
|
|
84235
|
+
for (const p of pages) {
|
|
84236
|
+
if (p.pairKey || p.status < 200 || p.status >= 400 || !p.html)
|
|
84237
|
+
continue;
|
|
84238
|
+
byKey.set(captureKey(p), p);
|
|
84239
|
+
}
|
|
84240
|
+
}
|
|
84241
|
+
async function captureOrVisit(page, ctx, url, label) {
|
|
84242
|
+
const shot = screenshotPath(ctx, label);
|
|
84243
|
+
const prior = dedicatedCaptures.get(ctx.ctx)?.get(captureKey({ url, viewport: ctx.viewport }));
|
|
84244
|
+
if (!prior) {
|
|
84245
|
+
const cap = await capturePage(page, {
|
|
84246
|
+
url,
|
|
84247
|
+
side: ctx.side,
|
|
84248
|
+
viewport: ctx.viewport,
|
|
84249
|
+
screenshotPath: shot
|
|
84250
|
+
});
|
|
84251
|
+
return {
|
|
84252
|
+
cap,
|
|
84253
|
+
reused: false,
|
|
84254
|
+
status: cap.status,
|
|
84255
|
+
finalUrl: cap.finalUrl,
|
|
84256
|
+
durationMs: cap.durationMs,
|
|
84257
|
+
screenshotPath: cap.screenshotPath
|
|
84258
|
+
};
|
|
84259
|
+
}
|
|
84260
|
+
const start = Date.now();
|
|
84261
|
+
const response = await page.goto(url, { waitUntil: "domcontentloaded", timeout: 30000 }).catch(() => null);
|
|
84262
|
+
await page.waitForLoadState("load", { timeout: 12000 }).catch(() => {
|
|
84263
|
+
return;
|
|
84264
|
+
});
|
|
84265
|
+
await page.waitForLoadState("networkidle", { timeout: 6000 }).catch(() => {
|
|
84266
|
+
return;
|
|
84267
|
+
});
|
|
84268
|
+
await screenshotStable(page, { path: shot });
|
|
84269
|
+
return {
|
|
84270
|
+
cap: prior,
|
|
84271
|
+
reused: true,
|
|
84272
|
+
status: response?.status() ?? 0,
|
|
84273
|
+
finalUrl: page.url(),
|
|
84274
|
+
durationMs: Date.now() - start,
|
|
84275
|
+
screenshotPath: shot
|
|
84276
|
+
};
|
|
84277
|
+
}
|
|
84102
84278
|
function makeSkipStep(step, name, ctx, note) {
|
|
84103
84279
|
return {
|
|
84104
84280
|
step,
|
|
@@ -89058,7 +89234,9 @@ var cookieCepModalCls2 = withHtmlSnapshot(cookieCepModalCls);
|
|
|
89058
89234
|
var faviconParity2 = withHtmlSnapshot(faviconParity);
|
|
89059
89235
|
var fontParity2 = withHtmlSnapshot(fontParity);
|
|
89060
89236
|
var footerLinksHealth2 = withHtmlSnapshot(footerLinksHealth);
|
|
89061
|
-
var htmlStructuralDiff2 = withHtmlSnapshot(htmlStructuralDiff);
|
|
89237
|
+
var htmlStructuralDiff2 = withSameVariant(withHtmlSnapshot(htmlStructuralDiff));
|
|
89238
|
+
var networkSummaryDelta2 = withSameVariant(networkSummaryDelta);
|
|
89239
|
+
var webVitalsMobile2 = withSameVariant(webVitalsMobile);
|
|
89062
89240
|
var imageLoadingHealth2 = withHtmlSnapshot(imageLoadingHealth);
|
|
89063
89241
|
var lazySectionPresence2 = withHtmlSnapshot(lazySectionPresence);
|
|
89064
89242
|
var metaSeoParity2 = withHtmlSnapshot(metaSeoParity);
|
|
@@ -89076,8 +89254,8 @@ var ALL_CHECKS = [
|
|
|
89076
89254
|
metaSeoParity2,
|
|
89077
89255
|
visualRegressionKeyframes,
|
|
89078
89256
|
purchaseJourneyFlow,
|
|
89079
|
-
|
|
89080
|
-
|
|
89257
|
+
networkSummaryDelta2,
|
|
89258
|
+
webVitalsMobile2,
|
|
89081
89259
|
imageLoadingHealth2,
|
|
89082
89260
|
bannerAspectRatio2,
|
|
89083
89261
|
cartRevealModeDivergence,
|
|
@@ -89118,8 +89296,8 @@ var ALL_CHECKS_BY_NAME = {
|
|
|
89118
89296
|
"meta-seo-parity": metaSeoParity2,
|
|
89119
89297
|
"visual-regression-keyframes": visualRegressionKeyframes,
|
|
89120
89298
|
"purchase-journey-flow": purchaseJourneyFlow,
|
|
89121
|
-
"network-summary-delta":
|
|
89122
|
-
"web-vitals-mobile":
|
|
89299
|
+
"network-summary-delta": networkSummaryDelta2,
|
|
89300
|
+
"web-vitals-mobile": webVitalsMobile2,
|
|
89123
89301
|
"image-loading-health": imageLoadingHealth2,
|
|
89124
89302
|
"banner-aspect-ratio": bannerAspectRatio2,
|
|
89125
89303
|
"cart-reveal-mode-divergence": cartRevealModeDivergence,
|
|
@@ -89444,6 +89622,11 @@ var NetworkEntry = z2.object({
|
|
|
89444
89622
|
serverTiming: z2.string().nullable(),
|
|
89445
89623
|
decoSection: z2.string().nullable()
|
|
89446
89624
|
});
|
|
89625
|
+
var ServingStack = z2.enum(["fresh", "tanstack", "unknown"]);
|
|
89626
|
+
var VariantFingerprint = z2.object({
|
|
89627
|
+
stack: ServingStack,
|
|
89628
|
+
signals: z2.array(z2.string())
|
|
89629
|
+
});
|
|
89447
89630
|
var PageCapture = z2.object({
|
|
89448
89631
|
url: z2.string(),
|
|
89449
89632
|
finalUrl: z2.string(),
|
|
@@ -89465,7 +89648,8 @@ var PageCapture = z2.object({
|
|
|
89465
89648
|
harPath: z2.string().optional(),
|
|
89466
89649
|
tracePath: z2.string().optional(),
|
|
89467
89650
|
xRobotsTag: z2.string().nullable().optional(),
|
|
89468
|
-
pairKey: z2.string().optional()
|
|
89651
|
+
pairKey: z2.string().optional(),
|
|
89652
|
+
variant: VariantFingerprint.optional()
|
|
89469
89653
|
});
|
|
89470
89654
|
var StepCapture = z2.object({
|
|
89471
89655
|
step: z2.number(),
|
|
@@ -89805,6 +89989,10 @@ var Run = z2.object({
|
|
|
89805
89989
|
partial: z2.boolean().optional(),
|
|
89806
89990
|
partialReason: z2.string().optional(),
|
|
89807
89991
|
caveats: z2.array(RunCaveat).optional(),
|
|
89992
|
+
pinned: z2.object({
|
|
89993
|
+
prod: z2.object({ cookies: z2.array(z2.string()), headers: z2.array(z2.string()) }),
|
|
89994
|
+
cand: z2.object({ cookies: z2.array(z2.string()), headers: z2.array(z2.string()) })
|
|
89995
|
+
}).optional(),
|
|
89808
89996
|
pagePairs: z2.array(PagePairMeasurement).optional(),
|
|
89809
89997
|
timings: z2.object({
|
|
89810
89998
|
totalMs: z2.number(),
|
|
@@ -89839,6 +90027,10 @@ var Baseline = z2.object({
|
|
|
89839
90027
|
var ParityRc = z2.object({
|
|
89840
90028
|
cep: z2.string().default("01310-100"),
|
|
89841
90029
|
profile: z2.enum(["commerce", "content"]).optional(),
|
|
90030
|
+
pin: z2.object({
|
|
90031
|
+
prod: z2.object({ cookies: z2.array(z2.string()).optional(), headers: z2.array(z2.string()).optional() }).optional(),
|
|
90032
|
+
cand: z2.object({ cookies: z2.array(z2.string()).optional(), headers: z2.array(z2.string()).optional() }).optional()
|
|
90033
|
+
}).optional(),
|
|
89842
90034
|
plpUrlHint: z2.string().optional(),
|
|
89843
90035
|
selectors: z2.object({
|
|
89844
90036
|
categoryLink: z2.string().optional(),
|
|
@@ -92415,7 +92607,9 @@ function createRunDir(outputDir, runId) {
|
|
|
92415
92607
|
return paths;
|
|
92416
92608
|
}
|
|
92417
92609
|
function getRunPaths(outputDir, runId) {
|
|
92418
|
-
|
|
92610
|
+
return runPathsFor(join7(outputDir, "runs", runId));
|
|
92611
|
+
}
|
|
92612
|
+
function runPathsFor(runDir) {
|
|
92419
92613
|
return {
|
|
92420
92614
|
runDir,
|
|
92421
92615
|
reportJson: join7(runDir, "report.json"),
|
|
@@ -92449,9 +92643,12 @@ function writeRunReportHtml(runDir, html) {
|
|
|
92449
92643
|
return path;
|
|
92450
92644
|
}
|
|
92451
92645
|
function loadRun(outputDir, runId) {
|
|
92452
|
-
|
|
92646
|
+
return loadRunDir(join7(outputDir, "runs", runId), runId);
|
|
92647
|
+
}
|
|
92648
|
+
function loadRunDir(runDir, label = runDir) {
|
|
92649
|
+
const reportJson = join7(runDir, "report.json");
|
|
92453
92650
|
if (!existsSync7(reportJson)) {
|
|
92454
|
-
throw new Error(`Run not found: ${
|
|
92651
|
+
throw new Error(`Run not found: ${label}`);
|
|
92455
92652
|
}
|
|
92456
92653
|
const raw = JSON.parse(readFileSync9(reportJson, "utf8"));
|
|
92457
92654
|
return Run.parse(raw);
|
|
@@ -94789,13 +94986,9 @@ async function flowPurchaseJourney(ctx) {
|
|
|
94789
94986
|
};
|
|
94790
94987
|
try {
|
|
94791
94988
|
reportStart(1, "visit-home");
|
|
94792
|
-
const homeCap = await
|
|
94793
|
-
|
|
94794
|
-
|
|
94795
|
-
viewport: ctx.viewport,
|
|
94796
|
-
screenshotPath: screenshotPath(ctx, "pj-1-home")
|
|
94797
|
-
});
|
|
94798
|
-
pages.push(homeCap);
|
|
94989
|
+
const homeCap = await captureOrVisit(page, ctx, ctx.baseUrl, "pj-1-home");
|
|
94990
|
+
if (!homeCap.reused)
|
|
94991
|
+
pages.push(homeCap.cap);
|
|
94799
94992
|
const step1Status = homeCap.status >= 200 && homeCap.status < 400 ? "ok" : "failed";
|
|
94800
94993
|
steps.push({
|
|
94801
94994
|
step: 1,
|
|
@@ -94820,13 +95013,9 @@ async function flowPurchaseJourney(ctx) {
|
|
|
94820
95013
|
return { pages, steps };
|
|
94821
95014
|
}
|
|
94822
95015
|
const t2 = Date.now();
|
|
94823
|
-
const plpCap = await
|
|
94824
|
-
|
|
94825
|
-
|
|
94826
|
-
viewport: ctx.viewport,
|
|
94827
|
-
screenshotPath: screenshotPath(ctx, "pj-2-plp")
|
|
94828
|
-
});
|
|
94829
|
-
pages.push(plpCap);
|
|
95016
|
+
const plpCap = await captureOrVisit(page, ctx, plpHit.url, "pj-2-plp");
|
|
95017
|
+
if (!plpCap.reused)
|
|
95018
|
+
pages.push(plpCap.cap);
|
|
94830
95019
|
const step2Status = plpCap.status >= 200 && plpCap.status < 400 ? "ok" : "failed";
|
|
94831
95020
|
steps.push({
|
|
94832
95021
|
step: 2,
|
|
@@ -94845,6 +95034,10 @@ async function flowPurchaseJourney(ctx) {
|
|
|
94845
95034
|
steps[steps.length - 1].beforeUrl = ctx.baseUrl;
|
|
94846
95035
|
reportStart(3, "enter-pdp");
|
|
94847
95036
|
let pdpHit = await findProductUrl(page, ctx);
|
|
95037
|
+
if (!pdpHit && plpCap.reused) {
|
|
95038
|
+
await scrollPageInChunks(page);
|
|
95039
|
+
pdpHit = await findProductUrl(page, ctx);
|
|
95040
|
+
}
|
|
94848
95041
|
let pdpRecoveredByLlm = false;
|
|
94849
95042
|
if (!pdpHit && budget.remaining > 0) {
|
|
94850
95043
|
const html = await page.content().catch(() => "");
|
|
@@ -94877,13 +95070,9 @@ async function flowPurchaseJourney(ctx) {
|
|
|
94877
95070
|
return { pages, steps };
|
|
94878
95071
|
}
|
|
94879
95072
|
const t3 = Date.now();
|
|
94880
|
-
const pdpCap = await
|
|
94881
|
-
|
|
94882
|
-
|
|
94883
|
-
viewport: ctx.viewport,
|
|
94884
|
-
screenshotPath: screenshotPath(ctx, "pj-3-pdp")
|
|
94885
|
-
});
|
|
94886
|
-
pages.push(pdpCap);
|
|
95073
|
+
const pdpCap = await captureOrVisit(page, ctx, pdpHit.url, "pj-3-pdp");
|
|
95074
|
+
if (!pdpCap.reused)
|
|
95075
|
+
pages.push(pdpCap.cap);
|
|
94887
95076
|
const step3Status = pdpCap.status >= 200 && pdpCap.status < 400 ? "ok" : "failed";
|
|
94888
95077
|
steps.push({
|
|
94889
95078
|
step: 3,
|
|
@@ -95228,7 +95417,7 @@ async function flowPurchaseJourney(ctx) {
|
|
|
95228
95417
|
recoveredByLlm: miniRecovered || undefined
|
|
95229
95418
|
});
|
|
95230
95419
|
reportEnd(7, "open-minicart", step7Status, Date.now() - t7, step7QuirkNote ?? step7RevealFailureNote);
|
|
95231
|
-
await captureInpSnapshot(page, pdpCap);
|
|
95420
|
+
await captureInpSnapshot(page, pdpCap.cap);
|
|
95232
95421
|
if (isProdCartEmptyQuirk) {
|
|
95233
95422
|
const quirkNote = "cart-empty-prod-quirk: skipped (depende do cart que prod não persistiu)";
|
|
95234
95423
|
reportStart(8, "shipping-calc-cart");
|
|
@@ -99336,10 +99525,13 @@ function buildWaterfallRows(entries) {
|
|
|
99336
99525
|
rows.sort((a, b) => a.start - b.start);
|
|
99337
99526
|
return rows;
|
|
99338
99527
|
}
|
|
99528
|
+
var WATERFALL_MAX_BARS = 120;
|
|
99339
99529
|
function renderWaterfall(entries) {
|
|
99340
|
-
const
|
|
99341
|
-
if (
|
|
99530
|
+
const all = buildWaterfallRows(entries);
|
|
99531
|
+
if (all.length === 0)
|
|
99342
99532
|
return "";
|
|
99533
|
+
const rows = all.slice(0, WATERFALL_MAX_BARS);
|
|
99534
|
+
const cutNote = all.length > rows.length ? `<div class="hint">First ${rows.length} of ${all.length} timed requests by start time · +${all.length - rows.length} more in report.json</div>` : "";
|
|
99343
99535
|
const ends = rows.map((r) => r.end).sort((a, b) => a - b);
|
|
99344
99536
|
const p95 = ends[Math.floor(ends.length * 0.95)] ?? ends[ends.length - 1] ?? 1;
|
|
99345
99537
|
const max = Math.max(p95, 100);
|
|
@@ -99377,7 +99569,7 @@ function renderWaterfall(entries) {
|
|
|
99377
99569
|
<line x1="${x.toFixed(1)}" y1="14" x2="${x.toFixed(1)}" y2="${HEIGHT - 4}" class="wf-tick"/>
|
|
99378
99570
|
<text x="${x.toFixed(1)}" y="10" class="wf-tick-label" text-anchor="middle">${t}ms</text>`;
|
|
99379
99571
|
}).join("");
|
|
99380
|
-
return
|
|
99572
|
+
return `${cutNote}
|
|
99381
99573
|
<div class="wf-wrap">
|
|
99382
99574
|
<svg viewBox="0 0 ${WIDTH} ${HEIGHT}" preserveAspectRatio="xMinYMin meet" class="wf-svg">
|
|
99383
99575
|
${tickEls}
|
|
@@ -100105,8 +100297,9 @@ function renderNetworkPanel(run) {
|
|
|
100105
100297
|
return `<div class="empty">No network requests captured.</div>`;
|
|
100106
100298
|
}
|
|
100107
100299
|
const report = buildCacheReport(candEntries, baseUrl);
|
|
100108
|
-
return `${renderWaterfallsSection(perPage)}${renderNetworkTable(report)}`;
|
|
100300
|
+
return `${renderWaterfallsSection(perPage)}${renderNetworkTable(report, run.id)}`;
|
|
100109
100301
|
}
|
|
100302
|
+
var NETWORK_TABLE_MAX_ROWS = 500;
|
|
100110
100303
|
function renderWaterfallsSection(perPage) {
|
|
100111
100304
|
if (perPage.length === 0)
|
|
100112
100305
|
return "";
|
|
@@ -100132,8 +100325,10 @@ function renderWaterfallsSection(perPage) {
|
|
|
100132
100325
|
${blocks.join("")}
|
|
100133
100326
|
</div>`;
|
|
100134
100327
|
}
|
|
100135
|
-
function renderNetworkTable(report) {
|
|
100136
|
-
const
|
|
100328
|
+
function renderNetworkTable(report, runId) {
|
|
100329
|
+
const shown = [...report.all].sort((a, b) => Number(a.decision === "hit") - Number(b.decision === "hit") || (b.entry.bytes ?? 0) - (a.entry.bytes ?? 0)).slice(0, NETWORK_TABLE_MAX_ROWS);
|
|
100330
|
+
const hidden = report.all.length - shown.length;
|
|
100331
|
+
const rows = shown.map((r, idx) => {
|
|
100137
100332
|
const url = r.entry.url;
|
|
100138
100333
|
const sizeKb = r.entry.bytes != null ? (r.entry.bytes / 1024).toFixed(1) : "—";
|
|
100139
100334
|
const cacheCls = r.decision === "hit" ? "cache-hit" : r.decision === "miss" || r.decision === "unknown" ? "cache-miss" : "cache-bypass";
|
|
@@ -100150,6 +100345,7 @@ function renderNetworkTable(report) {
|
|
|
100150
100345
|
<div class="card">
|
|
100151
100346
|
<h2>Network · ${report.total} requests · ${(report.totalBytes / 1024).toFixed(0)} KB</h2>
|
|
100152
100347
|
<div class="hint">Hits, misses and categories per request captured in cand. Click a column header to sort.</div>
|
|
100348
|
+
${hidden > 0 ? `<div class="hint net-capped">Showing ${shown.length} of ${report.all.length} requests (non-hits first, heaviest first) · +${hidden} more in report.json: <code>parity report ${escapeHtml(runId)} --section network --json</code></div>` : ""}
|
|
100153
100349
|
<div class="net-toolbar">
|
|
100154
100350
|
<input id="net-search" type="search" placeholder="filter by URL…" class="net-input"/>
|
|
100155
100351
|
<select id="net-filter-cat" class="net-input">
|
|
@@ -107991,6 +108187,7 @@ async function runFlow(flow, ctx) {
|
|
|
107991
108187
|
}
|
|
107992
108188
|
}
|
|
107993
108189
|
function finalize(flow, ctx, pages, steps, start) {
|
|
108190
|
+
rememberDedicatedCaptures(flow, ctx.ctx, pages);
|
|
107994
108191
|
return {
|
|
107995
108192
|
flow,
|
|
107996
108193
|
side: ctx.side,
|
|
@@ -108031,13 +108228,14 @@ async function validateSelectors(page, selectors) {
|
|
|
108031
108228
|
}
|
|
108032
108229
|
|
|
108033
108230
|
// src/engine/selector-discovery-pass.ts
|
|
108034
|
-
async function fetchHomeHtml(url, viewport = "desktop") {
|
|
108231
|
+
async function fetchHomeHtml(url, viewport = "desktop", extraHeaders = {}) {
|
|
108035
108232
|
try {
|
|
108036
108233
|
const res = await fetch(url, {
|
|
108037
108234
|
headers: {
|
|
108038
108235
|
"User-Agent": userAgentFor(viewport),
|
|
108039
108236
|
Accept: "text/html,application/xhtml+xml",
|
|
108040
|
-
"Accept-Language": "pt-BR,pt;q=0.9,en;q=0.8"
|
|
108237
|
+
"Accept-Language": "pt-BR,pt;q=0.9,en;q=0.8",
|
|
108238
|
+
...extraHeaders
|
|
108041
108239
|
},
|
|
108042
108240
|
redirect: "follow"
|
|
108043
108241
|
});
|
|
@@ -116049,6 +116247,28 @@ function detectRunCaveats(input) {
|
|
|
116049
116247
|
detail: `Os dois lados não estão no mesmo conteúdo (${mismatched.slice(0, 3).join(", ")}${mismatched.length > 3 ? "…" : ""}). O módulo visual vai apontar diferenças que são de produto, não de migração — leia estrutura e hierarquia, não conteúdo.`
|
|
116050
116248
|
});
|
|
116051
116249
|
}
|
|
116250
|
+
for (const side of ["prod", "cand"]) {
|
|
116251
|
+
const mix = describeMix(stackCounts(side === "prod" ? input.prodPages : input.candPages, captureKey));
|
|
116252
|
+
if (!mix)
|
|
116253
|
+
continue;
|
|
116254
|
+
out.push({
|
|
116255
|
+
id: `${side}-mixed-variants`,
|
|
116256
|
+
level: "warn",
|
|
116257
|
+
summary: `${side} served mixed variants: ${mix} — pin with --${side}-cookie/--${side}-header`,
|
|
116258
|
+
detail: `${side} answered with more than one build in this run (an A/B split between stacks), so its pages are not one reference. Script counts, network volume and vitals of pairs served by different stacks were marked inconclusive. Ask the site owner for the bucket/fallback cookie or header that forces one build, and pass it with --${side}-cookie name=value or --${side}-header "Name: value".`
|
|
116259
|
+
});
|
|
116260
|
+
}
|
|
116261
|
+
if (!input.prodPinned && !out.some((c) => c.id === "prod-mixed-variants")) {
|
|
116262
|
+
const abCookies = new Set(input.prodPages.flatMap((p) => (p.variant?.signals ?? []).filter((s) => s.startsWith("cookie:")).map((s) => s.slice(7))));
|
|
116263
|
+
if (abCookies.size > 0) {
|
|
116264
|
+
out.push({
|
|
116265
|
+
id: "prod-ab-unpinned",
|
|
116266
|
+
level: "info",
|
|
116267
|
+
summary: `prod sets A/B cookie(s) ${[...abCookies].join(", ")} and no variant was pinned`,
|
|
116268
|
+
detail: "Every page here came from one build, but which one was the bucket each fresh context drew. If prod is splitting traffic between builds, pin the reference with --prod-cookie/--prod-header."
|
|
116269
|
+
});
|
|
116270
|
+
}
|
|
116271
|
+
}
|
|
116052
116272
|
if (!input.llmEnabled) {
|
|
116053
116273
|
out.push({
|
|
116054
116274
|
id: "llm-disabled",
|
|
@@ -116099,6 +116319,42 @@ function pathOf6(raw) {
|
|
|
116099
116319
|
}
|
|
116100
116320
|
}
|
|
116101
116321
|
|
|
116322
|
+
// src/engine/side-pin.ts
|
|
116323
|
+
function parseHeaderFlags(values) {
|
|
116324
|
+
const out = {};
|
|
116325
|
+
for (const v of values ?? []) {
|
|
116326
|
+
const colon = v.indexOf(":");
|
|
116327
|
+
const name = colon > 0 ? v.slice(0, colon).trim() : "";
|
|
116328
|
+
if (!name)
|
|
116329
|
+
throw new Error('header pin expects "Name: value"');
|
|
116330
|
+
out[name] = v.slice(colon + 1).trim();
|
|
116331
|
+
}
|
|
116332
|
+
return out;
|
|
116333
|
+
}
|
|
116334
|
+
function resolveSidePin(url, fromRc, cookieFlags, headerFlags) {
|
|
116335
|
+
const cookies = parseCookieFlags([...fromRc?.cookies ?? [], ...cookieFlags ?? []], url);
|
|
116336
|
+
return {
|
|
116337
|
+
cookies: [...new Map(cookies.map((c) => [c.name, c])).values()],
|
|
116338
|
+
headers: parseHeaderFlags([...fromRc?.headers ?? [], ...headerFlags ?? []])
|
|
116339
|
+
};
|
|
116340
|
+
}
|
|
116341
|
+
function isEmptyPin(pin) {
|
|
116342
|
+
return pin.cookies.length === 0 && Object.keys(pin.headers).length === 0;
|
|
116343
|
+
}
|
|
116344
|
+
function pinFetchHeaders(pin) {
|
|
116345
|
+
const cookie = pin.cookies.map((c) => `${c.name}=${c.value}`).join("; ");
|
|
116346
|
+
return { ...pin.headers, ...cookie ? { Cookie: cookie } : {} };
|
|
116347
|
+
}
|
|
116348
|
+
function pinNames(pin) {
|
|
116349
|
+
return { cookies: pin.cookies.map((c) => c.name), headers: Object.keys(pin.headers) };
|
|
116350
|
+
}
|
|
116351
|
+
function describePin(pin) {
|
|
116352
|
+
return [
|
|
116353
|
+
...pin.cookies.map((c) => `cookie ${c.name}=***`),
|
|
116354
|
+
...Object.keys(pin.headers).map((h) => `header ${h}: ***`)
|
|
116355
|
+
].join(", ");
|
|
116356
|
+
}
|
|
116357
|
+
|
|
116102
116358
|
// src/util/timing.ts
|
|
116103
116359
|
async function withTiming(fn) {
|
|
116104
116360
|
const start = performance.now();
|
|
@@ -116349,6 +116605,22 @@ async function runCommand(rawOpts) {
|
|
|
116349
116605
|
if (rawOpts.preset) {
|
|
116350
116606
|
console.log(chalk34.dim(` preset: ${rawOpts.preset}`));
|
|
116351
116607
|
}
|
|
116608
|
+
let pins;
|
|
116609
|
+
try {
|
|
116610
|
+
const pinRc = loadParityRc().pin;
|
|
116611
|
+
pins = {
|
|
116612
|
+
prod: resolveSidePin(opts.prod, pinRc?.prod, opts.prodCookie, opts.prodHeader),
|
|
116613
|
+
cand: resolveSidePin(opts.cand, pinRc?.cand, opts.candCookie, opts.candHeader)
|
|
116614
|
+
};
|
|
116615
|
+
} catch (err) {
|
|
116616
|
+
console.error(chalk34.red(` ${err.message}`));
|
|
116617
|
+
return 2;
|
|
116618
|
+
}
|
|
116619
|
+
for (const side of ["prod", "cand"]) {
|
|
116620
|
+
if (!isEmptyPin(pins[side]))
|
|
116621
|
+
console.log(chalk34.dim(` ${side} pinned: ${describePin(pins[side])}`));
|
|
116622
|
+
}
|
|
116623
|
+
const pinContext = (side) => ({ cookies: pins[side].cookies, headers: pins[side].headers });
|
|
116352
116624
|
if (opts.pt)
|
|
116353
116625
|
setLlmLanguage("pt");
|
|
116354
116626
|
if (opts.interactive === false)
|
|
@@ -116375,7 +116647,7 @@ async function runCommand(rawOpts) {
|
|
|
116375
116647
|
profile = opts.profile;
|
|
116376
116648
|
} else {
|
|
116377
116649
|
const pv = opts.viewports.split(",")[0]?.trim() || "mobile";
|
|
116378
|
-
earlyProdHtml = await fetchHomeHtml(opts.prod, pv);
|
|
116650
|
+
earlyProdHtml = await fetchHomeHtml(opts.prod, pv, pinFetchHeaders(pins.prod));
|
|
116379
116651
|
profile = earlyProdHtml ? detectSiteProfile({ url: opts.prod, html: earlyProdHtml }) : "commerce";
|
|
116380
116652
|
}
|
|
116381
116653
|
const isContentProfile = profile === "content";
|
|
@@ -116448,7 +116720,7 @@ async function runCommand(rawOpts) {
|
|
|
116448
116720
|
console.log(chalk34.dim(" interactive: enabled — TTY + no LLM. Missing selectors will pause to prompt (disable with --no-interactive). Issue #72."));
|
|
116449
116721
|
}
|
|
116450
116722
|
const primaryViewport = viewports[0] ?? "mobile";
|
|
116451
|
-
const preflight = await preflightCheck(opts.prod, opts.cand, primaryViewport);
|
|
116723
|
+
const preflight = await preflightCheck(opts.prod, opts.cand, primaryViewport, pins);
|
|
116452
116724
|
if (!preflight.ok) {
|
|
116453
116725
|
console.error(chalk34.red(`
|
|
116454
116726
|
✖ pre-flight falhou:`));
|
|
@@ -116461,7 +116733,7 @@ async function runCommand(rawOpts) {
|
|
|
116461
116733
|
const learned = loadLearned();
|
|
116462
116734
|
const learnedBefore = JSON.stringify(learned);
|
|
116463
116735
|
let platform = "custom";
|
|
116464
|
-
const prodHomeHtml = earlyProdHtml ?? await fetchHomeHtml(opts.prod, primaryViewport);
|
|
116736
|
+
const prodHomeHtml = earlyProdHtml ?? await fetchHomeHtml(opts.prod, primaryViewport, pinFetchHeaders(pins.prod));
|
|
116465
116737
|
if (prodHomeHtml) {
|
|
116466
116738
|
platform = detectPlatform({ url: opts.prod, html: prodHomeHtml });
|
|
116467
116739
|
if (platform !== "custom") {
|
|
@@ -116573,11 +116845,10 @@ async function runCommand(rawOpts) {
|
|
|
116573
116845
|
partialReason: `${reason} during ${currentPhase}`,
|
|
116574
116846
|
timings: partialTimings
|
|
116575
116847
|
});
|
|
116576
|
-
|
|
116577
|
-
|
|
116578
|
-
|
|
116579
|
-
|
|
116580
|
-
`);
|
|
116848
|
+
const where = writeRunReport(paths, partial, Boolean(opts.html || opts.open));
|
|
116849
|
+
process.stderr.write(` report parcial:
|
|
116850
|
+
${where.map((l) => ` ${l}
|
|
116851
|
+
`).join("")}`);
|
|
116581
116852
|
process.stderr.write(`
|
|
116582
116853
|
${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
116583
116854
|
`);
|
|
@@ -116611,6 +116882,7 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
116611
116882
|
const warmupSpinner = ora8("Warmup: bustando cache em prod + cand…").start();
|
|
116612
116883
|
const result = await warmupTargets({
|
|
116613
116884
|
urls: [opts.prod, opts.cand],
|
|
116885
|
+
headersFor: [pinFetchHeaders(pins.prod), pinFetchHeaders(pins.cand)],
|
|
116614
116886
|
viewports,
|
|
116615
116887
|
bypassCache: opts.bypassCache !== false
|
|
116616
116888
|
});
|
|
@@ -116635,7 +116907,8 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
116635
116907
|
harPath,
|
|
116636
116908
|
tracesDir: traceEnabled ? paths.tracesDir : undefined,
|
|
116637
116909
|
cohortCookieValue: "control",
|
|
116638
|
-
noCache: opts.bypassCache
|
|
116910
|
+
noCache: opts.bypassCache,
|
|
116911
|
+
...pinContext(side)
|
|
116639
116912
|
});
|
|
116640
116913
|
setVitalsWarm(ctx, vitalsWarm);
|
|
116641
116914
|
await installVitalsCollector(ctx);
|
|
@@ -116808,7 +117081,8 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
116808
117081
|
viewport: task.viewport,
|
|
116809
117082
|
cohortCookieValue: "control",
|
|
116810
117083
|
noCache: opts.bypassCache,
|
|
116811
|
-
keepMotion: true
|
|
117084
|
+
keepMotion: true,
|
|
117085
|
+
...pinContext(task.side)
|
|
116812
117086
|
});
|
|
116813
117087
|
setVitalsWarm(c, vitalsWarm);
|
|
116814
117088
|
return c;
|
|
@@ -116917,7 +117191,8 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
116917
117191
|
cohortCookieValue: "control",
|
|
116918
117192
|
noCache: opts.bypassCache,
|
|
116919
117193
|
deviceScaleFactor: 1,
|
|
116920
|
-
hideScrollbars: true
|
|
117194
|
+
hideScrollbars: true,
|
|
117195
|
+
...pinContext(task.side)
|
|
116921
117196
|
});
|
|
116922
117197
|
setVitalsWarm(ctx, vitalsWarm);
|
|
116923
117198
|
await installVitalsCollector(ctx);
|
|
@@ -117098,14 +117373,14 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
117098
117373
|
candPages: checkCtx.candPages,
|
|
117099
117374
|
verdict,
|
|
117100
117375
|
llmEnabled: llmStillAvailable,
|
|
117101
|
-
candIsProduction: opts.candIsProduction
|
|
117376
|
+
candIsProduction: opts.candIsProduction,
|
|
117377
|
+
prodPinned: !isEmptyPin(pins.prod)
|
|
117102
117378
|
})),
|
|
117379
|
+
pinned: isEmptyPin(pins.prod) && isEmptyPin(pins.cand) ? undefined : { prod: pinNames(pins.prod), cand: pinNames(pins.cand) },
|
|
117103
117380
|
pagePairs
|
|
117104
117381
|
};
|
|
117105
117382
|
const reportStart = performance.now();
|
|
117106
|
-
|
|
117107
|
-
const html = renderHtmlReport(run, paths.runDir);
|
|
117108
|
-
writeRunReportHtml(paths.runDir, html);
|
|
117383
|
+
const reportWhere = writeRunReport(paths, run, Boolean(opts.html || opts.open));
|
|
117109
117384
|
const reportDurationMs = performance.now() - reportStart;
|
|
117110
117385
|
runTimings.phases.push({ phase: "report", durationMs: reportDurationMs });
|
|
117111
117386
|
runTimings.totalMs += reportDurationMs;
|
|
@@ -117119,7 +117394,7 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
117119
117394
|
totalIssues: allIssues.length,
|
|
117120
117395
|
verdict: { status: verdict.status, score: verdict.score, scoreVersion: SCORE_VERSION }
|
|
117121
117396
|
});
|
|
117122
|
-
printSummary8(run,
|
|
117397
|
+
printSummary8(run, reportWhere, { promotedCount, deprecatedCount, platform });
|
|
117123
117398
|
console.log(`
|
|
117124
117399
|
${formatTimingsSummary(runTimings, buildFlowBreakdown(allFlowCaptures))}`);
|
|
117125
117400
|
if (pagePairs) {
|
|
@@ -117321,7 +117596,7 @@ async function runWithConcurrency2(items, workers, fn) {
|
|
|
117321
117596
|
}
|
|
117322
117597
|
}));
|
|
117323
117598
|
}
|
|
117324
|
-
async function preflightCheck(prodUrl, candUrl, viewport) {
|
|
117599
|
+
async function preflightCheck(prodUrl, candUrl, viewport, pins) {
|
|
117325
117600
|
const spinner = ora8("Pre-flight: verificando URLs…").start();
|
|
117326
117601
|
const errors = [];
|
|
117327
117602
|
const ua = userAgentFor(viewport);
|
|
@@ -117329,8 +117604,11 @@ async function preflightCheck(prodUrl, candUrl, viewport) {
|
|
|
117329
117604
|
async function probeWithBrowser(label, url) {
|
|
117330
117605
|
const ctx = await browser.newContext({
|
|
117331
117606
|
userAgent: ua,
|
|
117332
|
-
ignoreHTTPSErrors: true
|
|
117607
|
+
ignoreHTTPSErrors: true,
|
|
117608
|
+
extraHTTPHeaders: pins[label].headers
|
|
117333
117609
|
});
|
|
117610
|
+
if (pins[label].cookies.length > 0)
|
|
117611
|
+
await ctx.addCookies(pins[label].cookies);
|
|
117334
117612
|
const page = await ctx.newPage();
|
|
117335
117613
|
try {
|
|
117336
117614
|
const res = await page.goto(url, { waitUntil: "commit", timeout: 30000 });
|
|
@@ -117356,7 +117634,7 @@ async function preflightCheck(prodUrl, candUrl, viewport) {
|
|
|
117356
117634
|
method: "GET",
|
|
117357
117635
|
redirect: "follow",
|
|
117358
117636
|
signal: controller.signal,
|
|
117359
|
-
headers: { "User-Agent": ua }
|
|
117637
|
+
headers: { "User-Agent": ua, ...pinFetchHeaders(pins[label]) }
|
|
117360
117638
|
});
|
|
117361
117639
|
if (res.status >= 500)
|
|
117362
117640
|
errors.push(`${label}: HTTP ${res.status} ${res.statusText} (${url})`);
|
|
@@ -117402,9 +117680,10 @@ function addCacheBuster(url) {
|
|
|
117402
117680
|
}
|
|
117403
117681
|
}
|
|
117404
117682
|
async function warmupTargets(opts) {
|
|
117405
|
-
const
|
|
117683
|
+
const noCache = opts.bypassCache ? { "Cache-Control": "no-cache", Pragma: "no-cache" } : {};
|
|
117406
117684
|
const jobs = [];
|
|
117407
|
-
for (const url of opts.urls) {
|
|
117685
|
+
for (const [i, url] of opts.urls.entries()) {
|
|
117686
|
+
const headers = { ...opts.headersFor?.[i], ...noCache };
|
|
117408
117687
|
for (const viewport of opts.viewports) {
|
|
117409
117688
|
const ua = userAgentFor(viewport);
|
|
117410
117689
|
const target = addCacheBuster(url);
|
|
@@ -117444,7 +117723,7 @@ function hostOf4(url) {
|
|
|
117444
117723
|
return url;
|
|
117445
117724
|
}
|
|
117446
117725
|
}
|
|
117447
|
-
function printSummary8(run,
|
|
117726
|
+
function printSummary8(run, reportWhere, meta) {
|
|
117448
117727
|
const { verdict } = run;
|
|
117449
117728
|
const inconclusive = verdict.status === "inconclusive";
|
|
117450
117729
|
const emoji = inconclusive ? chalk34.dim("○") : verdict.status === "pass" ? chalk34.green("✔") : verdict.status === "warn" ? chalk34.yellow("⚠") : chalk34.red("✖");
|
|
@@ -117505,9 +117784,18 @@ function printSummary8(run, htmlPath, meta) {
|
|
|
117505
117784
|
console.log(chalk34.dim(` \uD83D\uDCDA learned-selectors [${meta.platform}]: ${chalk34.green(`+${meta.promotedCount}`)} promoted · ${chalk34.yellow(meta.deprecatedCount)} deprecated`));
|
|
117506
117785
|
}
|
|
117507
117786
|
console.log("");
|
|
117508
|
-
|
|
117787
|
+
for (const line of reportWhere)
|
|
117788
|
+
console.log(chalk34.dim(` ${line}`));
|
|
117509
117789
|
console.log("");
|
|
117510
117790
|
}
|
|
117791
|
+
function writeRunReport(paths, run, html) {
|
|
117792
|
+
writeRunReportJson(paths.runDir, run);
|
|
117793
|
+
if (html) {
|
|
117794
|
+
writeRunReportHtml(paths.runDir, renderHtmlReport(run, paths.runDir));
|
|
117795
|
+
return [`→ ${paths.reportHtml}`];
|
|
117796
|
+
}
|
|
117797
|
+
return [`→ ${paths.reportJson}`, `HTML report: parity report ${paths.runDir}`];
|
|
117798
|
+
}
|
|
117511
117799
|
|
|
117512
117800
|
// src/commands/pr.ts
|
|
117513
117801
|
var SEVERITY_EMOJI = {
|
|
@@ -119320,7 +119608,7 @@ async function qaFileCommand(opts) {
|
|
|
119320
119608
|
|
|
119321
119609
|
// src/commands/report.ts
|
|
119322
119610
|
import { existsSync as existsSync36, readFileSync as readFileSync43, writeFileSync as writeFileSync35 } from "node:fs";
|
|
119323
|
-
import { join as join50 } from "node:path";
|
|
119611
|
+
import { join as join50, resolve as resolve21 } from "node:path";
|
|
119324
119612
|
import chalk39 from "chalk";
|
|
119325
119613
|
import open3 from "open";
|
|
119326
119614
|
|
|
@@ -119970,12 +120258,24 @@ var REMOVED_SECTIONS = {
|
|
|
119970
120258
|
sidebyside: "use `parity cockpit --prod <url> --cand <url>` for the live prod × cand view.",
|
|
119971
120259
|
prompt: "use `parity prompt <runId>` for the LLM-ready Markdown."
|
|
119972
120260
|
};
|
|
120261
|
+
function resolveRunPaths(output, runIdOrDir) {
|
|
120262
|
+
if (existsSync36(join50(runIdOrDir, "report.json")))
|
|
120263
|
+
return runPathsFor(resolve21(runIdOrDir));
|
|
120264
|
+
return getRunPaths(output, runIdOrDir);
|
|
120265
|
+
}
|
|
120266
|
+
function ensureReportHtml(paths) {
|
|
120267
|
+
if (existsSync36(paths.reportHtml))
|
|
120268
|
+
return { path: paths.reportHtml, rendered: false };
|
|
120269
|
+
const run = loadRunDir(paths.runDir);
|
|
120270
|
+
writeRunReportHtml(paths.runDir, renderHtmlReport(run, paths.runDir));
|
|
120271
|
+
return { path: paths.reportHtml, rendered: true };
|
|
120272
|
+
}
|
|
119973
120273
|
async function reportCommand(runId, opts) {
|
|
119974
|
-
const paths =
|
|
120274
|
+
const paths = resolveRunPaths(opts.output, runId);
|
|
119975
120275
|
if (opts.deck) {
|
|
119976
120276
|
let run;
|
|
119977
120277
|
try {
|
|
119978
|
-
run =
|
|
120278
|
+
run = loadRunDir(paths.runDir, runId);
|
|
119979
120279
|
} catch (err) {
|
|
119980
120280
|
console.error(chalk39.red(`failed to load run: ${err.message}`));
|
|
119981
120281
|
return 1;
|
|
@@ -120017,7 +120317,7 @@ async function reportCommand(runId, opts) {
|
|
|
120017
120317
|
}
|
|
120018
120318
|
if (opts.json) {
|
|
120019
120319
|
try {
|
|
120020
|
-
const run =
|
|
120320
|
+
const run = loadRunDir(paths.runDir, runId);
|
|
120021
120321
|
const payload = extractReportSection({ kind: "json", section: opts.section, run });
|
|
120022
120322
|
if (payload === null) {
|
|
120023
120323
|
console.error(chalk39.red(`section "${opts.section}" not present in this run`));
|
|
@@ -120031,8 +120331,10 @@ async function reportCommand(runId, opts) {
|
|
|
120031
120331
|
return 1;
|
|
120032
120332
|
}
|
|
120033
120333
|
}
|
|
120034
|
-
|
|
120035
|
-
|
|
120334
|
+
try {
|
|
120335
|
+
ensureReportHtml(paths);
|
|
120336
|
+
} catch (err) {
|
|
120337
|
+
console.error(chalk39.red(`failed to render report.html: ${err.message}`));
|
|
120036
120338
|
return 1;
|
|
120037
120339
|
}
|
|
120038
120340
|
const html = readFileSync43(paths.reportHtml, "utf8");
|
|
@@ -120044,7 +120346,13 @@ async function reportCommand(runId, opts) {
|
|
|
120044
120346
|
process.stdout.write(slice);
|
|
120045
120347
|
return 0;
|
|
120046
120348
|
}
|
|
120047
|
-
|
|
120349
|
+
try {
|
|
120350
|
+
const { rendered } = ensureReportHtml(paths);
|
|
120351
|
+
console.log(`${rendered ? `${chalk39.green("✓")} rendered` : "→"} ${paths.reportHtml}`);
|
|
120352
|
+
} catch (err) {
|
|
120353
|
+
console.error(chalk39.red(`failed to render report.html: ${err.message}`));
|
|
120354
|
+
return 1;
|
|
120355
|
+
}
|
|
120048
120356
|
await open3(paths.reportHtml).catch((err) => {
|
|
120049
120357
|
console.error(chalk39.red(`failed to open: ${err.message}`));
|
|
120050
120358
|
});
|
|
@@ -120378,8 +120686,10 @@ async function serveCommand(runId, opts) {
|
|
|
120378
120686
|
console.error(chalk41.red(`✖ Run não encontrado: ${runId} (em ${opts.output})`));
|
|
120379
120687
|
return 1;
|
|
120380
120688
|
}
|
|
120381
|
-
|
|
120382
|
-
|
|
120689
|
+
try {
|
|
120690
|
+
ensureReportHtml(paths);
|
|
120691
|
+
} catch (err) {
|
|
120692
|
+
console.error(chalk41.red(`✖ não foi possível gerar report.html: ${err.message}`));
|
|
120383
120693
|
return 1;
|
|
120384
120694
|
}
|
|
120385
120695
|
return serveRunAndBlock(paths.runDir, {
|
|
@@ -121951,7 +122261,7 @@ program.command("run").description([
|
|
|
121951
122261
|
" visual-pages=5, auto-selectors=ON (if LLM), learn=ON, visual-diff=ON,",
|
|
121952
122262
|
" warmup=OFF, vitals warm=ON, bypass-cache=OFF, fail-on=critical (exit 1 if hit)."
|
|
121953
122263
|
].join(`
|
|
121954
|
-
`)).option("--prod <url>", "Production URL (source of truth, e.g. Fresh site). Omit for a single site — the run will point you to `parity e2e` (issue #141).").requiredOption("--cand <url>", "Candidate URL (migrated site, e.g. TanStack)").option("--preset <name>", "Bundle of defaults: smoke (fast, ~30s, no LLM) | full (deep audit) | ci (CI-tuned)").option("--flows <list>", "Comma-separated flows: homepage,plp,pdp,purchase-journey", "purchase-journey").option("--viewports <list>", "Comma-separated viewports: mobile,desktop", "mobile,desktop").option("--cep <cep>", "CEP for shipping calculation", "01310-100").option("--add-to-cart-timeout <ms>", "How long (ms) the add-to-cart step polls for a success signal before failing. Default 3000. Raise/lower to match your site's success-toast lifetime (issue #143).", (v) => Number(v)).option("--runs <n>", "Repeat each measurement N times (median)", "1").option("--baseline <name>", "Compare against a saved baseline").option("--output <dir>", "Output directory", "./parity-output").option("--fail-on <severities>", "Comma-separated severities that cause exit 1 (default: critical)", "critical").option("--
|
|
122264
|
+
`)).option("--prod <url>", "Production URL (source of truth, e.g. Fresh site). Omit for a single site — the run will point you to `parity e2e` (issue #141).").requiredOption("--cand <url>", "Candidate URL (migrated site, e.g. TanStack)").option("--preset <name>", "Bundle of defaults: smoke (fast, ~30s, no LLM) | full (deep audit) | ci (CI-tuned)").option("--flows <list>", "Comma-separated flows: homepage,plp,pdp,purchase-journey", "purchase-journey").option("--viewports <list>", "Comma-separated viewports: mobile,desktop", "mobile,desktop").option("--cep <cep>", "CEP for shipping calculation", "01310-100").option("--prod-cookie <name=value>", "Cookie set on every prod browser context and plain request; repeatable. Pins prod to one A/B variant (e.g. a Fresh-vs-TanStack bucket cookie) so the run does not compare whichever build each fresh context drew. Values are redacted in logs and report.json.", collectCookie, []).option("--cand-cookie <name=value>", "Same as --prod-cookie, for the candidate side", collectCookie, []).option("--prod-header <Name: value>", "Request header sent on every prod request (all origins — no credentials); repeatable. The header twin of --prod-cookie. Values are redacted in logs and report.json.", collectHeader, []).option("--cand-header <Name: value>", "Same as --prod-header, for the candidate side", collectHeader, []).option("--add-to-cart-timeout <ms>", "How long (ms) the add-to-cart step polls for a success signal before failing. Default 3000. Raise/lower to match your site's success-toast lifetime (issue #143).", (v) => Number(v)).option("--runs <n>", "Repeat each measurement N times (median)", "1").option("--baseline <name>", "Compare against a saved baseline").option("--output <dir>", "Output directory", "./parity-output").option("--fail-on <severities>", "Comma-separated severities that cause exit 1 (default: critical)", "critical").option("--html", "Also write report.html (off by default: render it later with `parity report <runId>`)", false).option("--open", "Write report.html and open it after the run completes (implies --html)", false).option("--no-auto-selectors", "Disable LLM-based selector discovery (uses defaults instead)").option("--refresh-selectors", "Bypass selector cache and re-run discovery", false).option("--no-learn", "Don't write to learned-selectors.json (read-only mode)").option("--vitals-pages <n>", "Extra pages from sitemap to crawl for Vitals coverage, beyond what --flows/--pages already cover (default 10). These are auto-sampled and can add significant unrelated noise to findings — pass 0 to scope the run to only the pages you explicitly requested.", (v) => Number(v), 10).option("--max-viewport-concurrency <n>", "How many viewports run concurrently during collect (default 2: mobile+desktop together). Set to 1 if you hit OOM with many viewports.", (v) => Number(v), 2).option("--visual-pages <n>", "Pages to compare visually with the heatmap engine — pixel diff + box-tree diff, no LLM (home + sampled PLPs/PDPs from sitemap, default 5)", (v) => Number(v), 5).option("--pages <list>", 'Comma-separated paths to compare visually (overrides sitemap discovery). E.g. "/,/account,/p/some-product". Use "prod->cand" for a page that lives at DIFFERENT paths on each side (partial migration), e.g. "/encimera-gc60/p->/ar-condicionado-12k/p". Use this when you want deterministic coverage instead of sampled. Scopes the visual-diff + vitals-extra-pages passes ONLY — the flows crawl (--flows, default purchase-journey) discovers its own target pages independently and ignores this flag. To scope which page(s) a flow visits, use --flows to pick a lighter flow and/or set the matching *UrlHint (e.g. plpUrlHint) in .parityrc.json. Issue #178.').option("--pages-file <path>", `Read paths to compare visually from a text file (one entry per line). Lines starting with # are ignored. Accepts the same "prod->cand" pair syntax as --pages. Overrides --pages when both are present. Same visual-diff/vitals-only scope as --pages — see that flag's help. Issue #178.`).option("--no-visual-diff", "Skip the visual diff capture pass entirely").option("--no-cache", "Deprecated, no effect (the visual verdict cache is gone).").option("--clear-cache", "Deprecated, no effect (the visual verdict cache is gone).", false).option("--bypass-cache", "Bypass CDN/edge caches AND the browser's own HTTP cache (CDP cache-disable), forcing a cold-visit fetch. Use right after a deploy to avoid false failures from stale CF edge content, or to approximate Lighthouse/CrUX-comparable TTFB/FCP/LCP numbers — without this flag, parity's vitals are a warm-connection/cache-enabled ('repeat visit') measurement, not a cold first-visit one, so they aren't directly comparable 1:1 to Lighthouse.", false).option("--warmup", "Before measurement, hit each target URL once (per viewport) with a cache-buster so the Worker serves a fresh response. Recommended after deploys.", false).option("--no-warm", "Don't warm each side's URL before measuring vitals. By default every vitals-measured page is loaded once on BOTH sides first, in a throwaway page (same device + cookies), so a cold edge/loader cache on whichever side hit the route first isn't reported as a Web Vitals or CLS regression. Ignored under --bypass-cache, which measures cold on purpose. Distinct from --warmup (a cache-busted homepage hit after a deploy).").option("--accept-prod-quirks", "Demote prod-side cart-empty journey failures (VTEX session quirk) from failed to skipped. The cart-reveal-mode-divergence check still emits critical if prod/cand markup intents differ, so this flag never masks a real regression. See issue #12.", false).option("--cand-is-production", "Cand is the final production domain, not a staging host. Disables staging detection (cand on another host with noindex everywhere), so noindex/nofollow on cand is critical and third-party origins missing on cand are high again.", false).option("--llm-timeout <seconds>", "Deprecated, no effect: topIssues is ranked deterministically now, there is no LLM aggregation call to time out.").option("--keep-runs <n>", "After the run, delete all but the n newest runs of this prod/cand host pair under --output (other host pairs, runs without a readable report.json and baseline-referenced runs are never touched). 0 keeps everything. Default: 10.", (v) => Number(v), 10).option("--timeout <minutes>", "Hard wall-clock cap for the whole run (minutes). On expiry, parity writes a partial report and exits 130. Default: 30. Issue #56.", (v) => Number(v), 30).option("--flow <name>", "Alias for --flows when running a single flow (e.g. --flow cart). Issue #53.").option("--json <path|->", "Emit JSON-Lines (one line per check) to the given file path, or '-' for stdout. Schema versioned via leading metadata line. Issue #53.").option("--pt", "Tell the LLM to respond in Brazilian Portuguese. Only affects LLM-generated content (issues, explain, prompts) — the static HTML report stays in English. Issue #67.").option("--llm <provider>", "Force LLM provider: anthropic | openrouter | claude-code | none. Default: auto-detect (anthropic key → openrouter key → local claude CLI → none). Issue #66.").option("--llm-model <overrides>", "Per-feature model override, e.g. visual-diff=claude-opus-5,explain=claude-opus-5. Features: selector-discovery, step-recovery, search-terms, plp-matching, pdp-matching, section-understanding, visual-diff, explain, component-detection. Issue #66.").option("--llm-tier-default <tier>", "Override the default tier (haiku | sonnet | opus) for every feature that doesn't have a per-feature override. Issue #66.").option("--llm-model-default <model>", "Force every LLM call to use this exact model ID, ignoring per-feature defaults. Issue #66.").option("--llm-premium", "Bump the reasoning-heavy features (explain/visual-diff) to opus. Defaults are sonnet-first for cost/latency (opus blew the 60s timeout on most runs); opt into opus for hard fixes. Issue #256.").option("--no-interactive", "Disable the interactive selector prompt that auto-fires in a TTY without an LLM provider. Use in scripts and CI where stdin is technically a TTY but you don't want to pause. Issue #72.").option("--only <modules>", "Scope the run to these modules and/or single checks (comma-separated). Module names: e2e, seo, visual, vitals, cache, console, html, network. Single-check granularity via `check:<name>`, e.g. `--only e2e,check:cache-coverage`. Run `parity list modules` for the full check/flow mapping. Default: all modules. M3 module selection.").option("--skip <modules>", "Subtract these modules and/or single checks (comma-separated, same syntax as --only) from whatever base set was chosen (all modules, or --only's set if both are given). M3 module selection.").option("--why <text>", "Free-text reason for this run's scope, stored in report.json as `selectionReason`. Purely informational. M3 module selection.").option("--profile <type>", "Site profile: commerce | content. Scopes modules/flows/CEP. `content` (blog/custom site with no storefront) drops the e2e purchase journey, scopes flows to the homepage, and skips CEP. Auto-detected from the platform when omitted. Issues #254/#255.").action(async (opts) => {
|
|
121955
122265
|
if (opts.flow) {
|
|
121956
122266
|
opts.flows = opts.flow;
|
|
121957
122267
|
}
|
|
@@ -122097,7 +122407,7 @@ program.command("serve").argument("<runId>", "Run ID to serve").description("[de
|
|
|
122097
122407
|
program.command("event").argument("<type>", "Event type: phase-change | dispatch | bench | score | note | …").description("Record a migration event into <dir>/events.jsonl — the sanctioned emission path for hooks and the orchestrator. The cockpit daemon tails this file into its live activity feed.").option("--dir <dir>", "Directory holding events.jsonl (the target's .parity/)", ".parity").option("--data <json>", `JSON object of event fields, e.g. '{"agent":"porter","component":"hero"}'`).action((type, opts) => {
|
|
122098
122408
|
process.exit(eventCommand(type, opts));
|
|
122099
122409
|
});
|
|
122100
|
-
program.command("report").argument("<runId>", "Run ID
|
|
122410
|
+
program.command("report").argument("<runId>", "Run ID, or the run directory itself (runs/<runId>/)").description("Open the HTML report for a run in the default browser, rendering report.html from report.json first if the run has none (`parity run` only writes it with --html). With --section, extract a single tab to stdout instead — useful for agents that need just the SEO/Network/Vitals slice without parsing the whole report. Issue #74.").option("--output <dir>", "Output directory", "./parity-output").option("--section <name>", "Extract one tab to stdout instead of opening the report. Valid names: summary, visualdiff, seo, issues, vitals, cache, checks, pages, console, network, diff.").option("--json", "Pair with --section to emit a normalized JSON projection of the section (from report.json) instead of the raw HTML slice.").option("--deck", "Render the presentation deck instead: one topic per full-viewport page, advanced sideways, in a single self-contained HTML file. For showing the result to someone rather than debugging it. Issue #290.", false).option("--out <path>", "Where to write the deck (default: deck.html in the run dir)").option("--lang <pt|en>", "Initial deck language; the in-page toggle still switches live", "en").option("--open", "Open the rendered deck in the browser", false).option("--plan-dir <dir>", "With --deck: dir holding migration-plan.json. Adds the component heat map (grouped by page, plus global) and the block-by-block table. Without it those pages are omitted, not drawn empty. Issue #291.").action(async (runId, opts) => {
|
|
122101
122411
|
process.exit(await reportCommand(runId, {
|
|
122102
122412
|
output: opts.output,
|
|
122103
122413
|
section: opts.section,
|
|
@@ -122232,6 +122542,11 @@ function collectCookie(value, prev) {
|
|
|
122232
122542
|
throw new InvalidArgumentError2("expected name=value");
|
|
122233
122543
|
return [...prev, value];
|
|
122234
122544
|
}
|
|
122545
|
+
function collectHeader(value, prev) {
|
|
122546
|
+
if (value.indexOf(":") <= 0)
|
|
122547
|
+
throw new InvalidArgumentError2('expected "Name: value"');
|
|
122548
|
+
return [...prev, value];
|
|
122549
|
+
}
|
|
122235
122550
|
program.command("ab-detect").description("Is prod A/B-testing this component? Opens N fresh sessions, hashes what --selector (or the page) rendered in each, and records experiment signals (cookies/storage keys, variant attributes, A/B SDK globals). Exit 0 = no A/B seen (same structure, no signal differs), 1 = A/B detected or possible (same structure but experiment signals differ between sessions — a behaviour-only test); either way it names the signals to pin with --prod-cookie, 2 = inconclusive.").requiredOption("--url <url>", "Production page URL").option("--sessions <n>", "Fresh sessions to open (min 2)", "3").option("--selector <sel>", "Component to compare across sessions. Without it, the whole page.").option("--viewport <viewport>", "mobile | desktop | tablet", "mobile").option("--wait <ms>", "Extra ms after networkidle so hydration settles", "2000").option("--json", "Emit one-line JSON instead of pretty text", false).action(async (opts) => {
|
|
122236
122551
|
process.exit(await abDetectCommand(opts));
|
|
122237
122552
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decocms/parity",
|
|
3
|
-
"version": "0.35.
|
|
3
|
+
"version": "0.35.15",
|
|
4
4
|
"description": "E2E parity validator for site migrations. Compares prod vs cand and reports UI, functional, SEO, visual, and Web Vitals deltas with a ranked HTML report.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|