@decocms/parity 0.35.27 → 0.35.29
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 +1 -0
- package/CHANGELOG.md +21 -0
- package/dist/cli.js +503 -180
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -163,6 +163,7 @@ Hard caps already in place:
|
|
|
163
163
|
- **A page that was never captured (status 0) is not a status divergence.** `http-status-parity` files one inconclusive `http-status:not-captured:<page>` finding, the run gets a `cand-pages-not-captured` (or `prod-…`) caveat listing the paths, and the check is `warn`. A real 404/500 stays critical. Re-run against a warm server before reading the score.
|
|
164
164
|
- **`[hydration]` console errors are React's own hydration messages only.** A section that threw and was caught by an error boundary is `[section-crash]` (same severity); its `file:line` positions come from the candidate's build at capture time and may be stale against the working tree.
|
|
165
165
|
- **`Issue.page` is the `path::viewport` key**, never a URL; the URL is in `details`.
|
|
166
|
+
- **A local dev candidate (`--cand http://localhost:…`) is cold on its first request to each route.** A run started right after the server came up, or after adding routes, can time out on pages the server would answer in milliseconds once requested. `parity run` primes the candidate's pages one at a time and retries a never-answered capture once; if it still prints "warm-up/priming loads never answered" or a `cand-cold` caveat, the server was not ready: request the routes yourself (or wait) and re-run, and do not read the "status divergente: cand=0" findings as defects. Flows' own PLP/PDP navigations are not primed. `--no-prime-cand` turns priming off.
|
|
166
167
|
- **`parity run` doesn't apply schema changes from old runs** — if you change `src/types/schema.ts`, old `report.json` files won't parse. Delete `parity-output/` or re-run.
|
|
167
168
|
|
|
168
169
|
## Files agents should and should not write
|
package/CHANGELOG.md
CHANGED
|
@@ -50,6 +50,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
|
|
|
50
50
|
selection, empty golden, `--pages` outside the golden) exits 2 before any browser work. Recordings
|
|
51
51
|
now also carry the detected `platform` (optional; older recordings still load). See
|
|
52
52
|
`docs/cli.md`.
|
|
53
|
+
* **`parity run` primes a local dev candidate** (`--cand` on localhost) before each capture pass:
|
|
54
|
+
every distinct candidate URL is requested once, sequentially, in a real page (90s cap, nothing
|
|
55
|
+
measured), so a dev server's first-request compile no longer happens under 4 concurrent
|
|
56
|
+
captures. A capture that still never answered (status 0) is retried once, sequentially, after
|
|
57
|
+
the pass (`PageCapture.retried`). When most warm-up/priming loads fail, the run warns at once and
|
|
58
|
+
adds a `cand-cold` run caveat. The priming cost is its own `prime-cand` timing line;
|
|
59
|
+
`report.json.candPrime` is new and additive. `--no-prime-cand` turns priming off. Remote
|
|
60
|
+
candidates and prod behave as before. See `docs/cli.md`.
|
|
53
61
|
|
|
54
62
|
### Fixed
|
|
55
63
|
|
|
@@ -110,6 +118,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
|
|
|
110
118
|
|
|
111
119
|
### Changed
|
|
112
120
|
|
|
121
|
+
* **A missing tag manager is one finding per page, not four checks' worth.** `analytics-beacon-parity`
|
|
122
|
+
reports `analytics-beacon:tag-manager-absent:<page>` when prod loaded the GTM container and cand did
|
|
123
|
+
not, naming the container and the tags that go with it (replaces the per-tag
|
|
124
|
+
`analytics-beacon:missing:*` ids on that page; with the container present on cand they are
|
|
125
|
+
unchanged). `third-party-scripts-parity` lowers analytics/marketing vendor origins explained by it
|
|
126
|
+
to `low` + `inconclusive` (other missing origins keep `high`), and `html-structural-diff`
|
|
127
|
+
discounts those vendors' `<script>` tags from the script count and lists them once in
|
|
128
|
+
`html-structural:tag-manager-scripts`. Shared helper: `checks/lib/tag-manager.ts`.
|
|
129
|
+
* **A local dev server counts as a staging host** (`localhost`, `127.0.0.0/8`, `[::1]`,
|
|
130
|
+
`*.localhost`, prod not local), so the existing staging leniency applies there without a noindex
|
|
131
|
+
signal; `--cand-is-production` turns it off. On a dev server the consolidated tag-manager finding
|
|
132
|
+
is `low` + `inconclusive`.
|
|
133
|
+
|
|
113
134
|
* **`parity run`'s visual module runs on the `parity heatmap` engine — no LLM.**
|
|
114
135
|
The old pass sent screenshot pairs to a vision model and filed what it said.
|
|
115
136
|
On real runs it invented findings — a stat card on neither side, prod and cand
|
package/dist/cli.js
CHANGED
|
@@ -76646,100 +76646,6 @@ function urlPageKey(url, viewport) {
|
|
|
76646
76646
|
return `${path}::${viewport}`;
|
|
76647
76647
|
}
|
|
76648
76648
|
|
|
76649
|
-
// src/checks/analytics-beacon-parity.ts
|
|
76650
|
-
var BEACON_PATTERNS = [
|
|
76651
|
-
{
|
|
76652
|
-
id: "gtm-container",
|
|
76653
|
-
label: "Google Tag Manager (gtm.js)",
|
|
76654
|
-
match: (u) => /googletagmanager\.com\/gtm\.js/.test(u)
|
|
76655
|
-
},
|
|
76656
|
-
{
|
|
76657
|
-
id: "gtag-js",
|
|
76658
|
-
label: "Google gtag.js / Google Ads",
|
|
76659
|
-
match: (u) => /googletagmanager\.com\/gtag\/js/.test(u)
|
|
76660
|
-
},
|
|
76661
|
-
{
|
|
76662
|
-
id: "ga4-collect",
|
|
76663
|
-
label: "GA4 collect beacon",
|
|
76664
|
-
match: (u) => /google-analytics\.com\/g\/collect|analytics\.google\.com\/g\/collect/.test(u)
|
|
76665
|
-
},
|
|
76666
|
-
{
|
|
76667
|
-
id: "meta-pixel",
|
|
76668
|
-
label: "Meta (Facebook) Pixel",
|
|
76669
|
-
match: (u) => /connect\.facebook\.(net|com)\/.*\/fbevents\.js|facebook\.com\/tr\//.test(u)
|
|
76670
|
-
},
|
|
76671
|
-
{
|
|
76672
|
-
id: "tiktok-pixel",
|
|
76673
|
-
label: "TikTok Pixel",
|
|
76674
|
-
match: (u) => /analytics\.tiktok\.com\/i18n\/pixel/.test(u)
|
|
76675
|
-
},
|
|
76676
|
-
{
|
|
76677
|
-
id: "pinterest-tag",
|
|
76678
|
-
label: "Pinterest Tag",
|
|
76679
|
-
match: (u) => /ct\.pinterest\.com\/v3/.test(u)
|
|
76680
|
-
}
|
|
76681
|
-
];
|
|
76682
|
-
function analyticsBeaconParity(ctx) {
|
|
76683
|
-
const start = Date.now();
|
|
76684
|
-
if (ctx.prodPages.length === 0) {
|
|
76685
|
-
return skip(start, "sem baseline prod — nada para comparar (single-site)");
|
|
76686
|
-
}
|
|
76687
|
-
const { pairs } = pairCaptures(ctx.prodPages, ctx.candPages);
|
|
76688
|
-
const issues = [];
|
|
76689
|
-
let pairsWithAnyBeacon = 0;
|
|
76690
|
-
for (const pair of pairs) {
|
|
76691
|
-
const prodHits = detectedBeacons(pair.prod);
|
|
76692
|
-
const candHits = detectedBeacons(pair.cand);
|
|
76693
|
-
if (prodHits.size === 0 && candHits.size === 0)
|
|
76694
|
-
continue;
|
|
76695
|
-
pairsWithAnyBeacon++;
|
|
76696
|
-
for (const pattern of BEACON_PATTERNS) {
|
|
76697
|
-
const inProd = prodHits.has(pattern.id);
|
|
76698
|
-
const inCand = candHits.has(pattern.id);
|
|
76699
|
-
if (inProd && !inCand) {
|
|
76700
|
-
issues.push({
|
|
76701
|
-
id: `analytics-beacon:missing:${pattern.id}:${pair.key}`,
|
|
76702
|
-
severity: "high",
|
|
76703
|
-
category: "network",
|
|
76704
|
-
page: pair.key,
|
|
76705
|
-
check: "analytics-beacon-parity",
|
|
76706
|
-
summary: `${pattern.label} disparou em prod mas não no candidato em ${pair.key}`,
|
|
76707
|
-
suggestedFix: "Confirme o container/pixel ID no candidato — tag manager ausente derruba TODO o rastreamento a jusante dele, não só este evento."
|
|
76708
|
-
});
|
|
76709
|
-
}
|
|
76710
|
-
}
|
|
76711
|
-
}
|
|
76712
|
-
const hasHigh = issues.some((i) => i.severity === "high");
|
|
76713
|
-
return {
|
|
76714
|
-
name: "analytics-beacon-parity",
|
|
76715
|
-
status: hasHigh ? "fail" : issues.length > 0 ? "warn" : "pass",
|
|
76716
|
-
severity: "high",
|
|
76717
|
-
durationMs: Date.now() - start,
|
|
76718
|
-
summary: pairsWithAnyBeacon === 0 ? "Nenhum beacon de analytics conhecido observado em nenhum dos lados — nada a validar (ou o site usa uma ferramenta fora da lista de padrões)" : `${issues.length} beacon(s) de analytics perdido(s) em ${pairsWithAnyBeacon} página(s) com tráfego de analytics`,
|
|
76719
|
-
issues
|
|
76720
|
-
};
|
|
76721
|
-
}
|
|
76722
|
-
function detectedBeacons(page) {
|
|
76723
|
-
const hits = new Set;
|
|
76724
|
-
for (const entry of page.network) {
|
|
76725
|
-
for (const pattern of BEACON_PATTERNS) {
|
|
76726
|
-
if (pattern.match(entry.url))
|
|
76727
|
-
hits.add(pattern.id);
|
|
76728
|
-
}
|
|
76729
|
-
}
|
|
76730
|
-
return hits;
|
|
76731
|
-
}
|
|
76732
|
-
function skip(start, summary) {
|
|
76733
|
-
return {
|
|
76734
|
-
name: "analytics-beacon-parity",
|
|
76735
|
-
status: "skipped",
|
|
76736
|
-
severity: "high",
|
|
76737
|
-
durationMs: Date.now() - start,
|
|
76738
|
-
summary,
|
|
76739
|
-
issues: []
|
|
76740
|
-
};
|
|
76741
|
-
}
|
|
76742
|
-
|
|
76743
76649
|
// src/diff/dom.ts
|
|
76744
76650
|
init_esm10();
|
|
76745
76651
|
|
|
@@ -77400,6 +77306,264 @@ function diffMeta(prod, cand) {
|
|
|
77400
77306
|
return out;
|
|
77401
77307
|
}
|
|
77402
77308
|
|
|
77309
|
+
// src/util/localhost.ts
|
|
77310
|
+
var LOCALHOST_HOSTS = new Set(["localhost", "127.0.0.1", "0.0.0.0", "::1", "[::1]"]);
|
|
77311
|
+
function isLocalhost(rawUrl) {
|
|
77312
|
+
try {
|
|
77313
|
+
const url = new URL(rawUrl);
|
|
77314
|
+
return LOCALHOST_HOSTS.has(url.hostname);
|
|
77315
|
+
} catch {
|
|
77316
|
+
return false;
|
|
77317
|
+
}
|
|
77318
|
+
}
|
|
77319
|
+
|
|
77320
|
+
// src/checks/lib/staging.ts
|
|
77321
|
+
function isCandOnStagingHost(prodPages, candPages, candIsProduction = false) {
|
|
77322
|
+
if (candIsProduction)
|
|
77323
|
+
return false;
|
|
77324
|
+
if (isCandOnLoopbackHost(prodPages, candPages, candIsProduction))
|
|
77325
|
+
return true;
|
|
77326
|
+
const prodSite = siteHost(prodPages);
|
|
77327
|
+
const candSite = siteHost(candPages);
|
|
77328
|
+
if (!prodSite || !candSite || prodSite === candSite)
|
|
77329
|
+
return false;
|
|
77330
|
+
const { pairs } = pairCaptures(prodPages, candPages);
|
|
77331
|
+
const judged = pairs.filter((p) => bareHost(finalOf(p.prod)) === prodSite && bareHost(finalOf(p.cand)) === candSite && !isNoindex(p.prod) && hasHead(p.cand));
|
|
77332
|
+
if (judged.length === 0)
|
|
77333
|
+
return false;
|
|
77334
|
+
const noindexed = judged.filter((p) => isNoindex(p.cand)).length;
|
|
77335
|
+
return noindexed * 2 > judged.length;
|
|
77336
|
+
}
|
|
77337
|
+
function isCandOnLoopbackHost(prodPages, candPages, candIsProduction = false) {
|
|
77338
|
+
if (candIsProduction)
|
|
77339
|
+
return false;
|
|
77340
|
+
const prodSite = siteHost(prodPages);
|
|
77341
|
+
const candSite = siteHost(candPages);
|
|
77342
|
+
if (!prodSite || !candSite)
|
|
77343
|
+
return false;
|
|
77344
|
+
return isLoopbackHost(candSite) && !isLoopbackHost(prodSite);
|
|
77345
|
+
}
|
|
77346
|
+
function isLoopbackHost(host) {
|
|
77347
|
+
return isLocalhost(`http://${host}/`) || host.endsWith(".localhost") || /^127\./.test(host);
|
|
77348
|
+
}
|
|
77349
|
+
var STAGING_NOTE = "cand está num host de staging (noindex no host inteiro com prod indexável, ou dev server local) — esperado ali; reconfira depois da troca de domínio, ou rode com --cand-is-production se cand já é o domínio final.";
|
|
77350
|
+
function hasHead(page) {
|
|
77351
|
+
const { meta } = snapshotDom(page.html ?? "");
|
|
77352
|
+
return meta.title != null || meta.robots != null || Boolean(page.xRobotsTag);
|
|
77353
|
+
}
|
|
77354
|
+
function isNoindex(page) {
|
|
77355
|
+
const meta = snapshotDom(page.html ?? "").meta.robots ?? "";
|
|
77356
|
+
return /\bnoindex\b/i.test(meta) || /\bnoindex\b/i.test(page.xRobotsTag ?? "");
|
|
77357
|
+
}
|
|
77358
|
+
function finalOf(page) {
|
|
77359
|
+
return page.finalUrl || page.url;
|
|
77360
|
+
}
|
|
77361
|
+
function siteHost(pages) {
|
|
77362
|
+
const counts = new Map;
|
|
77363
|
+
for (const page of pages) {
|
|
77364
|
+
const host = bareHost(finalOf(page));
|
|
77365
|
+
if (host)
|
|
77366
|
+
counts.set(host, (counts.get(host) ?? 0) + 1);
|
|
77367
|
+
}
|
|
77368
|
+
let best = null;
|
|
77369
|
+
for (const [host, n] of counts)
|
|
77370
|
+
if (!best || n > (counts.get(best) ?? 0))
|
|
77371
|
+
best = host;
|
|
77372
|
+
return best;
|
|
77373
|
+
}
|
|
77374
|
+
function bareHost(url) {
|
|
77375
|
+
try {
|
|
77376
|
+
return new URL(url).hostname.replace(/^www\./, "");
|
|
77377
|
+
} catch {
|
|
77378
|
+
return null;
|
|
77379
|
+
}
|
|
77380
|
+
}
|
|
77381
|
+
var SECOND_LEVEL = new Set(["com", "net", "org", "gov", "edu", "co", "ac", "ne", "or", "go"]);
|
|
77382
|
+
function registrableDomain(hostname) {
|
|
77383
|
+
const parts = hostname.split(".");
|
|
77384
|
+
if (parts.length <= 2)
|
|
77385
|
+
return hostname;
|
|
77386
|
+
const sld = parts[parts.length - 2];
|
|
77387
|
+
const tld = parts[parts.length - 1];
|
|
77388
|
+
const take = tld.length === 2 && SECOND_LEVEL.has(sld) ? 3 : 2;
|
|
77389
|
+
return parts.slice(-take).join(".");
|
|
77390
|
+
}
|
|
77391
|
+
|
|
77392
|
+
// src/checks/lib/tag-manager.ts
|
|
77393
|
+
var GTM_CONTAINER_URL = /googletagmanager\.com\/gtm\.js/;
|
|
77394
|
+
function loadsTagManager(page) {
|
|
77395
|
+
return page.network.some((e) => GTM_CONTAINER_URL.test(e.url));
|
|
77396
|
+
}
|
|
77397
|
+
function tagManagerAbsentOnCand(prod, cand) {
|
|
77398
|
+
return loadsTagManager(prod) && !loadsTagManager(cand);
|
|
77399
|
+
}
|
|
77400
|
+
function tagManagerContainerIds(page) {
|
|
77401
|
+
const ids = new Set;
|
|
77402
|
+
for (const e of page.network) {
|
|
77403
|
+
if (GTM_CONTAINER_URL.test(e.url))
|
|
77404
|
+
ids.add(new URL(e.url).searchParams.get("id") ?? "(sem id)");
|
|
77405
|
+
}
|
|
77406
|
+
return [...ids];
|
|
77407
|
+
}
|
|
77408
|
+
var VENDOR_DOMAINS = new Set([
|
|
77409
|
+
"googletagmanager.com",
|
|
77410
|
+
"google-analytics.com",
|
|
77411
|
+
"doubleclick.net",
|
|
77412
|
+
"googleadservices.com",
|
|
77413
|
+
"facebook.net",
|
|
77414
|
+
"facebook.com",
|
|
77415
|
+
"clarity.ms",
|
|
77416
|
+
"bing.com",
|
|
77417
|
+
"hotjar.com",
|
|
77418
|
+
"tiktok.com",
|
|
77419
|
+
"pinterest.com"
|
|
77420
|
+
]);
|
|
77421
|
+
var GOOGLE_ADS_PATH = /^\/(pagead|ccm|rmkt|ads|g\/collect|j\/collect)(\/|$)/;
|
|
77422
|
+
function tagManagerVendorOrigins(prod) {
|
|
77423
|
+
const googlePaths = new Map;
|
|
77424
|
+
const out = new Set;
|
|
77425
|
+
for (const e of prod.network) {
|
|
77426
|
+
let u;
|
|
77427
|
+
try {
|
|
77428
|
+
u = new URL(e.url);
|
|
77429
|
+
} catch {
|
|
77430
|
+
continue;
|
|
77431
|
+
}
|
|
77432
|
+
const domain = registrableDomain(u.hostname);
|
|
77433
|
+
if (VENDOR_DOMAINS.has(domain))
|
|
77434
|
+
out.add(domain);
|
|
77435
|
+
else if (/^google\./.test(domain)) {
|
|
77436
|
+
googlePaths.set(domain, (googlePaths.get(domain) ?? true) && GOOGLE_ADS_PATH.test(u.pathname));
|
|
77437
|
+
}
|
|
77438
|
+
}
|
|
77439
|
+
for (const [domain, adsOnly] of googlePaths)
|
|
77440
|
+
if (adsOnly)
|
|
77441
|
+
out.add(domain);
|
|
77442
|
+
return out;
|
|
77443
|
+
}
|
|
77444
|
+
|
|
77445
|
+
// src/checks/analytics-beacon-parity.ts
|
|
77446
|
+
var BEACON_PATTERNS = [
|
|
77447
|
+
{
|
|
77448
|
+
id: "gtm-container",
|
|
77449
|
+
label: "Google Tag Manager (gtm.js)",
|
|
77450
|
+
match: (u) => GTM_CONTAINER_URL.test(u)
|
|
77451
|
+
},
|
|
77452
|
+
{
|
|
77453
|
+
id: "gtag-js",
|
|
77454
|
+
label: "Google gtag.js / Google Ads",
|
|
77455
|
+
match: (u) => /googletagmanager\.com\/gtag\/js/.test(u)
|
|
77456
|
+
},
|
|
77457
|
+
{
|
|
77458
|
+
id: "ga4-collect",
|
|
77459
|
+
label: "GA4 collect beacon",
|
|
77460
|
+
match: (u) => /google-analytics\.com\/g\/collect|analytics\.google\.com\/g\/collect/.test(u)
|
|
77461
|
+
},
|
|
77462
|
+
{
|
|
77463
|
+
id: "meta-pixel",
|
|
77464
|
+
label: "Meta (Facebook) Pixel",
|
|
77465
|
+
match: (u) => /connect\.facebook\.(net|com)\/.*\/fbevents\.js|facebook\.com\/tr\//.test(u)
|
|
77466
|
+
},
|
|
77467
|
+
{
|
|
77468
|
+
id: "tiktok-pixel",
|
|
77469
|
+
label: "TikTok Pixel",
|
|
77470
|
+
match: (u) => /analytics\.tiktok\.com\/i18n\/pixel/.test(u)
|
|
77471
|
+
},
|
|
77472
|
+
{
|
|
77473
|
+
id: "pinterest-tag",
|
|
77474
|
+
label: "Pinterest Tag",
|
|
77475
|
+
match: (u) => /ct\.pinterest\.com\/v3/.test(u)
|
|
77476
|
+
}
|
|
77477
|
+
];
|
|
77478
|
+
function analyticsBeaconParity(ctx) {
|
|
77479
|
+
const start = Date.now();
|
|
77480
|
+
if (ctx.prodPages.length === 0) {
|
|
77481
|
+
return skip(start, "sem baseline prod — nada para comparar (single-site)");
|
|
77482
|
+
}
|
|
77483
|
+
const { pairs } = pairCaptures(ctx.prodPages, ctx.candPages);
|
|
77484
|
+
const issues = [];
|
|
77485
|
+
let pairsWithAnyBeacon = 0;
|
|
77486
|
+
const devServer = isCandOnLoopbackHost(ctx.prodPages, ctx.candPages, ctx.candIsProduction);
|
|
77487
|
+
for (const pair of pairs) {
|
|
77488
|
+
const prodHits = detectedBeacons(pair.prod);
|
|
77489
|
+
const candHits = detectedBeacons(pair.cand);
|
|
77490
|
+
if (prodHits.size === 0 && candHits.size === 0)
|
|
77491
|
+
continue;
|
|
77492
|
+
pairsWithAnyBeacon++;
|
|
77493
|
+
const containerAbsent = tagManagerAbsentOnCand(pair.prod, pair.cand);
|
|
77494
|
+
if (containerAbsent) {
|
|
77495
|
+
const dependents = BEACON_PATTERNS.filter((p) => p.id !== "gtm-container" && prodHits.has(p.id) && !candHits.has(p.id));
|
|
77496
|
+
const containers = tagManagerContainerIds(pair.prod);
|
|
77497
|
+
issues.push({
|
|
77498
|
+
id: `analytics-beacon:tag-manager-absent:${pair.key}`,
|
|
77499
|
+
severity: devServer ? "low" : "high",
|
|
77500
|
+
...devServer ? { inconclusive: true } : {},
|
|
77501
|
+
category: "network",
|
|
77502
|
+
page: pair.key,
|
|
77503
|
+
check: "analytics-beacon-parity",
|
|
77504
|
+
summary: `Tag manager (${containers.join(", ")}) carregou em prod mas não no candidato em ${pair.key}${dependents.length > 0 ? ` — leva junto: ${dependents.map((d) => d.label).join(", ")}` : " — nenhuma outra tag conhecida de prod ficou de fora"}`,
|
|
77505
|
+
details: `${[
|
|
77506
|
+
`Container: ${containers.join(", ")} (gtm.js ausente no candidato).`,
|
|
77507
|
+
dependents.length > 0 ? `Tags de prod ausentes no candidato, atribuídas ao container:
|
|
77508
|
+
${dependents.map((d) => ` - ${d.label}`).join(`
|
|
77509
|
+
`)}` : "",
|
|
77510
|
+
"Atribuição presumida, não observada: um snippet hard-coded em prod não se distingue de uma tag injetada pelo container. Corrija o ID do container no candidato e rode de novo antes de procurar cada tag.",
|
|
77511
|
+
devServer ? "cand é um dev server local, onde o rastreamento não é ligado de propósito: informativo. Reconfira num host de preview." : ""
|
|
77512
|
+
].filter(Boolean).join(`
|
|
77513
|
+
|
|
77514
|
+
`)}`,
|
|
77515
|
+
suggestedFix: "Configure o container ID do tag manager no candidato — sem ele, todo o rastreamento a jusante some junto."
|
|
77516
|
+
});
|
|
77517
|
+
}
|
|
77518
|
+
for (const pattern of BEACON_PATTERNS) {
|
|
77519
|
+
const inProd = prodHits.has(pattern.id);
|
|
77520
|
+
const inCand = candHits.has(pattern.id);
|
|
77521
|
+
if (containerAbsent && inProd && !inCand)
|
|
77522
|
+
continue;
|
|
77523
|
+
if (inProd && !inCand) {
|
|
77524
|
+
issues.push({
|
|
77525
|
+
id: `analytics-beacon:missing:${pattern.id}:${pair.key}`,
|
|
77526
|
+
severity: "high",
|
|
77527
|
+
category: "network",
|
|
77528
|
+
page: pair.key,
|
|
77529
|
+
check: "analytics-beacon-parity",
|
|
77530
|
+
summary: `${pattern.label} disparou em prod mas não no candidato em ${pair.key}`,
|
|
77531
|
+
suggestedFix: "Confirme o container/pixel ID no candidato — tag manager ausente derruba TODO o rastreamento a jusante dele, não só este evento."
|
|
77532
|
+
});
|
|
77533
|
+
}
|
|
77534
|
+
}
|
|
77535
|
+
}
|
|
77536
|
+
const hasHigh = issues.some((i) => i.severity === "high");
|
|
77537
|
+
return {
|
|
77538
|
+
name: "analytics-beacon-parity",
|
|
77539
|
+
status: hasHigh ? "fail" : issues.length > 0 ? "warn" : "pass",
|
|
77540
|
+
severity: "high",
|
|
77541
|
+
durationMs: Date.now() - start,
|
|
77542
|
+
summary: pairsWithAnyBeacon === 0 ? "Nenhum beacon de analytics conhecido observado em nenhum dos lados — nada a validar (ou o site usa uma ferramenta fora da lista de padrões)" : `${issues.length} achado(s) de analytics em ${pairsWithAnyBeacon} página(s) com tráfego de analytics`,
|
|
77543
|
+
issues
|
|
77544
|
+
};
|
|
77545
|
+
}
|
|
77546
|
+
function detectedBeacons(page) {
|
|
77547
|
+
const hits = new Set;
|
|
77548
|
+
for (const entry of page.network) {
|
|
77549
|
+
for (const pattern of BEACON_PATTERNS) {
|
|
77550
|
+
if (pattern.match(entry.url))
|
|
77551
|
+
hits.add(pattern.id);
|
|
77552
|
+
}
|
|
77553
|
+
}
|
|
77554
|
+
return hits;
|
|
77555
|
+
}
|
|
77556
|
+
function skip(start, summary) {
|
|
77557
|
+
return {
|
|
77558
|
+
name: "analytics-beacon-parity",
|
|
77559
|
+
status: "skipped",
|
|
77560
|
+
severity: "high",
|
|
77561
|
+
durationMs: Date.now() - start,
|
|
77562
|
+
summary,
|
|
77563
|
+
issues: []
|
|
77564
|
+
};
|
|
77565
|
+
}
|
|
77566
|
+
|
|
77403
77567
|
// src/checks/lib/counts.ts
|
|
77404
77568
|
function unitCounts(args) {
|
|
77405
77569
|
const judged = new Set(args.judged);
|
|
@@ -78255,64 +78419,6 @@ function diffConsole(prod, cand, opts = {}) {
|
|
|
78255
78419
|
};
|
|
78256
78420
|
}
|
|
78257
78421
|
|
|
78258
|
-
// src/checks/lib/staging.ts
|
|
78259
|
-
function isCandOnStagingHost(prodPages, candPages, candIsProduction = false) {
|
|
78260
|
-
if (candIsProduction)
|
|
78261
|
-
return false;
|
|
78262
|
-
const prodSite = siteHost(prodPages);
|
|
78263
|
-
const candSite = siteHost(candPages);
|
|
78264
|
-
if (!prodSite || !candSite || prodSite === candSite)
|
|
78265
|
-
return false;
|
|
78266
|
-
const { pairs } = pairCaptures(prodPages, candPages);
|
|
78267
|
-
const judged = pairs.filter((p) => bareHost(finalOf(p.prod)) === prodSite && bareHost(finalOf(p.cand)) === candSite && !isNoindex(p.prod) && hasHead(p.cand));
|
|
78268
|
-
if (judged.length === 0)
|
|
78269
|
-
return false;
|
|
78270
|
-
const noindexed = judged.filter((p) => isNoindex(p.cand)).length;
|
|
78271
|
-
return noindexed * 2 > judged.length;
|
|
78272
|
-
}
|
|
78273
|
-
var STAGING_NOTE = "cand está num host de staging (noindex no host inteiro, prod indexável) — esperado ali; reconfira depois da troca de domínio, ou rode com --cand-is-production se cand já é o domínio final.";
|
|
78274
|
-
function hasHead(page) {
|
|
78275
|
-
const { meta } = snapshotDom(page.html ?? "");
|
|
78276
|
-
return meta.title != null || meta.robots != null || Boolean(page.xRobotsTag);
|
|
78277
|
-
}
|
|
78278
|
-
function isNoindex(page) {
|
|
78279
|
-
const meta = snapshotDom(page.html ?? "").meta.robots ?? "";
|
|
78280
|
-
return /\bnoindex\b/i.test(meta) || /\bnoindex\b/i.test(page.xRobotsTag ?? "");
|
|
78281
|
-
}
|
|
78282
|
-
function finalOf(page) {
|
|
78283
|
-
return page.finalUrl || page.url;
|
|
78284
|
-
}
|
|
78285
|
-
function siteHost(pages) {
|
|
78286
|
-
const counts = new Map;
|
|
78287
|
-
for (const page of pages) {
|
|
78288
|
-
const host = bareHost(finalOf(page));
|
|
78289
|
-
if (host)
|
|
78290
|
-
counts.set(host, (counts.get(host) ?? 0) + 1);
|
|
78291
|
-
}
|
|
78292
|
-
let best = null;
|
|
78293
|
-
for (const [host, n] of counts)
|
|
78294
|
-
if (!best || n > (counts.get(best) ?? 0))
|
|
78295
|
-
best = host;
|
|
78296
|
-
return best;
|
|
78297
|
-
}
|
|
78298
|
-
function bareHost(url) {
|
|
78299
|
-
try {
|
|
78300
|
-
return new URL(url).hostname.replace(/^www\./, "");
|
|
78301
|
-
} catch {
|
|
78302
|
-
return null;
|
|
78303
|
-
}
|
|
78304
|
-
}
|
|
78305
|
-
var SECOND_LEVEL = new Set(["com", "net", "org", "gov", "edu", "co", "ac", "ne", "or", "go"]);
|
|
78306
|
-
function registrableDomain(hostname) {
|
|
78307
|
-
const parts = hostname.split(".");
|
|
78308
|
-
if (parts.length <= 2)
|
|
78309
|
-
return hostname;
|
|
78310
|
-
const sld = parts[parts.length - 2];
|
|
78311
|
-
const tld = parts[parts.length - 1];
|
|
78312
|
-
const take = tld.length === 2 && SECOND_LEVEL.has(sld) ? 3 : 2;
|
|
78313
|
-
return parts.slice(-take).join(".");
|
|
78314
|
-
}
|
|
78315
|
-
|
|
78316
78422
|
// src/checks/console-errors.ts
|
|
78317
78423
|
var BENIGN = [/\bTransition was (?:skipped|aborted)\b/i];
|
|
78318
78424
|
var DETERMINISTIC = new Set(["hydration", "section-crash"]);
|
|
@@ -79040,6 +79146,7 @@ function htmlStructuralDiff(ctx) {
|
|
|
79040
79146
|
const issues = [];
|
|
79041
79147
|
const staging = isCandOnStagingHost(ctx.prodPages, ctx.candPages, ctx.candIsProduction);
|
|
79042
79148
|
const vendorDeltas = [];
|
|
79149
|
+
const tagManagerDeltas = [];
|
|
79043
79150
|
for (const pair of pairs) {
|
|
79044
79151
|
const prodSnap = snapshotDom(pair.prod.html ?? "");
|
|
79045
79152
|
const candSnap = snapshotDom(pair.cand.html ?? "");
|
|
@@ -79061,6 +79168,31 @@ function htmlStructuralDiff(ctx) {
|
|
|
79061
79168
|
}
|
|
79062
79169
|
if (lines.length > 0)
|
|
79063
79170
|
vendorDeltas.push({ page: pair.key, lines });
|
|
79171
|
+
} else if (tagManagerAbsentOnCand(pair.prod, pair.cand)) {
|
|
79172
|
+
const vendors = tagManagerVendorOrigins(pair.prod);
|
|
79173
|
+
const site = new Set([pair.prod, pair.cand].map((p) => hostDomain(p.finalUrl || p.url)).filter(Boolean));
|
|
79174
|
+
const prod = embeds(pair.prod.html ?? "", "scripts", site);
|
|
79175
|
+
const cand = embeds(pair.cand.html ?? "", "scripts", site);
|
|
79176
|
+
const lines = [];
|
|
79177
|
+
let lost = 0;
|
|
79178
|
+
for (const [origin, n] of prod.vendor) {
|
|
79179
|
+
const gone = Math.max(0, n - (cand.vendor.get(origin) ?? 0));
|
|
79180
|
+
if (!vendors.has(origin) || gone === 0)
|
|
79181
|
+
continue;
|
|
79182
|
+
lost += gone;
|
|
79183
|
+
lines.push(`${origin} ×${n}→${cand.vendor.get(origin) ?? 0}`);
|
|
79184
|
+
}
|
|
79185
|
+
const tag = "scripts";
|
|
79186
|
+
const scripts = diff.countsDelta[tag];
|
|
79187
|
+
if (lost > 0 && scripts) {
|
|
79188
|
+
const delta = scripts.delta + lost;
|
|
79189
|
+
if (Math.abs(delta) > COUNT_TOLERANCE) {
|
|
79190
|
+
diff.countsDelta[tag] = { prod: scripts.prod - lost, cand: scripts.cand, delta };
|
|
79191
|
+
} else {
|
|
79192
|
+
delete diff.countsDelta[tag];
|
|
79193
|
+
}
|
|
79194
|
+
tagManagerDeltas.push({ page: pair.key, lines });
|
|
79195
|
+
}
|
|
79064
79196
|
}
|
|
79065
79197
|
const NOISY = new Set(["imgs"]);
|
|
79066
79198
|
const structural = Object.entries(diff.countsDelta).filter(([k]) => !NOISY.has(k));
|
|
@@ -79126,6 +79258,23 @@ function htmlStructuralDiff(ctx) {
|
|
|
79126
79258
|
${STAGING_NOTE}`
|
|
79127
79259
|
});
|
|
79128
79260
|
}
|
|
79261
|
+
if (tagManagerDeltas.length > 0) {
|
|
79262
|
+
issues.push({
|
|
79263
|
+
id: "html-structural:tag-manager-scripts",
|
|
79264
|
+
severity: "low",
|
|
79265
|
+
inconclusive: true,
|
|
79266
|
+
category: "functional",
|
|
79267
|
+
page: tagManagerDeltas[0].page,
|
|
79268
|
+
check: "html-structural-diff",
|
|
79269
|
+
summary: `Scripts de vendors do tag manager ausentes em ${tagManagerDeltas.length} página(s) — descontados da contagem (tag manager ausente no candidato)`,
|
|
79270
|
+
details: `${tagManagerDeltas.map((v) => `${v.page}
|
|
79271
|
+
${v.lines.join(`
|
|
79272
|
+
`)}`).join(`
|
|
79273
|
+
`)}
|
|
79274
|
+
|
|
79275
|
+
Mesma causa de analytics-beacon:tag-manager-absent: o container não carregou no candidato, então as tags que ele injetaria não existem. Scripts inline escritos pelo container não são atribuídos e continuam na contagem.`
|
|
79276
|
+
});
|
|
79277
|
+
}
|
|
79129
79278
|
const hasBlocking = issues.some((i) => i.severity === "high" && !i.inconclusive);
|
|
79130
79279
|
return {
|
|
79131
79280
|
name: "html-structural-diff",
|
|
@@ -82934,19 +83083,6 @@ function hydrationDuringNavIssue(viewport, side, count, step) {
|
|
|
82934
83083
|
|
|
82935
83084
|
// src/checks/ssr-no-js.ts
|
|
82936
83085
|
init_esm10();
|
|
82937
|
-
|
|
82938
|
-
// src/util/localhost.ts
|
|
82939
|
-
var LOCALHOST_HOSTS = new Set(["localhost", "127.0.0.1", "0.0.0.0", "::1", "[::1]"]);
|
|
82940
|
-
function isLocalhost(rawUrl) {
|
|
82941
|
-
try {
|
|
82942
|
-
const url = new URL(rawUrl);
|
|
82943
|
-
return LOCALHOST_HOSTS.has(url.hostname);
|
|
82944
|
-
} catch {
|
|
82945
|
-
return false;
|
|
82946
|
-
}
|
|
82947
|
-
}
|
|
82948
|
-
|
|
82949
|
-
// src/checks/ssr-no-js.ts
|
|
82950
83086
|
async function ssrNoJs(ctx) {
|
|
82951
83087
|
const start = Date.now();
|
|
82952
83088
|
const issues = [];
|
|
@@ -85818,19 +85954,30 @@ function thirdPartyScriptsParity(ctx) {
|
|
|
85818
85954
|
const missing = [...prodOrigins].filter((o) => !candOrigins.has(o)).sort();
|
|
85819
85955
|
const added = [...candOrigins].filter((o) => !prodOrigins.has(o)).sort();
|
|
85820
85956
|
if (missing.length > 0) {
|
|
85957
|
+
const viaTagManager = tagManagerAbsentOnCand(pair.prod, pair.cand) ? tagManagerVendorOrigins(pair.prod) : new Set;
|
|
85958
|
+
const explained = missing.filter((o) => viaTagManager.has(o));
|
|
85959
|
+
const unexplained = missing.filter((o) => !viaTagManager.has(o));
|
|
85960
|
+
const lenient = staging || unexplained.length === 0;
|
|
85961
|
+
const body = [
|
|
85962
|
+
unexplained.join(`
|
|
85963
|
+
`),
|
|
85964
|
+
explained.length > 0 ? `Explicadas pela ausência do tag manager no candidato (ver analytics-beacon:tag-manager-absent:${pair.key}), não contam como severidade alta:
|
|
85965
|
+
${explained.join(`
|
|
85966
|
+
`)}` : ""
|
|
85967
|
+
].filter(Boolean).join(`
|
|
85968
|
+
|
|
85969
|
+
`);
|
|
85821
85970
|
issues.push({
|
|
85822
85971
|
id: `3p-scripts:missing:${pair.key}`,
|
|
85823
|
-
severity:
|
|
85824
|
-
...
|
|
85972
|
+
severity: lenient ? "low" : "high",
|
|
85973
|
+
...lenient ? { inconclusive: true } : {},
|
|
85825
85974
|
category: "network",
|
|
85826
85975
|
page: pair.key,
|
|
85827
85976
|
check: "third-party-scripts-parity",
|
|
85828
|
-
summary: `${missing.length} origem(ns) de terceiro presente(s) em prod mas ausente(s) no candidato em ${pair.key}`,
|
|
85829
|
-
details: staging ? `${
|
|
85830
|
-
`)}
|
|
85977
|
+
summary: `${missing.length} origem(ns) de terceiro presente(s) em prod mas ausente(s) no candidato em ${pair.key}${explained.length > 0 ? ` (${explained.length} explicada(s) pelo tag manager ausente)` : ""}`,
|
|
85978
|
+
details: staging ? `${body}
|
|
85831
85979
|
|
|
85832
|
-
${STAGING_NOTE}` :
|
|
85833
|
-
`),
|
|
85980
|
+
${STAGING_NOTE}` : body,
|
|
85834
85981
|
suggestedFix: "Confirme se o script foi migrado deliberadamente ou se a tag (GTM, pixel, chat, avaliações, etc.) foi perdida na porta."
|
|
85835
85982
|
});
|
|
85836
85983
|
}
|
|
@@ -90498,7 +90645,8 @@ var PageCapture = z2.object({
|
|
|
90498
90645
|
xRobotsTag: z2.string().nullable().optional(),
|
|
90499
90646
|
pairKey: z2.string().optional(),
|
|
90500
90647
|
pass: z2.enum(["extra", "visual"]).optional(),
|
|
90501
|
-
variant: VariantFingerprint.optional()
|
|
90648
|
+
variant: VariantFingerprint.optional(),
|
|
90649
|
+
retried: z2.boolean().optional()
|
|
90502
90650
|
});
|
|
90503
90651
|
var StepCapture = z2.object({
|
|
90504
90652
|
step: z2.number(),
|
|
@@ -90875,6 +91023,13 @@ var Run = z2.object({
|
|
|
90875
91023
|
failed: z2.number().optional(),
|
|
90876
91024
|
totalMs: z2.number().optional()
|
|
90877
91025
|
}).optional(),
|
|
91026
|
+
candPrime: z2.object({
|
|
91027
|
+
attempted: z2.number(),
|
|
91028
|
+
failedUrls: z2.array(z2.string()),
|
|
91029
|
+
totalMs: z2.number(),
|
|
91030
|
+
retried: z2.number(),
|
|
91031
|
+
recovered: z2.number()
|
|
91032
|
+
}).optional(),
|
|
90878
91033
|
selectionReason: z2.string().optional(),
|
|
90879
91034
|
moduleVerdicts: z2.array(ModuleVerdict).optional(),
|
|
90880
91035
|
acceptedFindings: z2.object({
|
|
@@ -118446,6 +118601,76 @@ function formatSecs(ms) {
|
|
|
118446
118601
|
return `${min}m${sec.toString().padStart(2, "0")}s`;
|
|
118447
118602
|
}
|
|
118448
118603
|
|
|
118604
|
+
// src/engine/cand-prime.ts
|
|
118605
|
+
var PRIME_TIMEOUT_MS = 90000;
|
|
118606
|
+
var PRIME_LOAD_MS = 1e4;
|
|
118607
|
+
function planCandPrime(candBase, paths, alreadyPrimed) {
|
|
118608
|
+
if (!isLocalhost(candBase))
|
|
118609
|
+
return [];
|
|
118610
|
+
const out = [];
|
|
118611
|
+
const seen = new Set(alreadyPrimed);
|
|
118612
|
+
for (const p of paths) {
|
|
118613
|
+
let url;
|
|
118614
|
+
try {
|
|
118615
|
+
url = new URL(p, candBase).toString();
|
|
118616
|
+
} catch {
|
|
118617
|
+
continue;
|
|
118618
|
+
}
|
|
118619
|
+
if (seen.has(url))
|
|
118620
|
+
continue;
|
|
118621
|
+
seen.add(url);
|
|
118622
|
+
out.push(url);
|
|
118623
|
+
}
|
|
118624
|
+
return out;
|
|
118625
|
+
}
|
|
118626
|
+
async function primeSequentially(urls, primed, prime) {
|
|
118627
|
+
const start = Date.now();
|
|
118628
|
+
const failed = [];
|
|
118629
|
+
for (const url of urls) {
|
|
118630
|
+
primed.add(url);
|
|
118631
|
+
const ok = await prime(url).catch(() => false);
|
|
118632
|
+
if (!ok)
|
|
118633
|
+
failed.push(url);
|
|
118634
|
+
}
|
|
118635
|
+
return { attempted: urls.length, failed, totalMs: Date.now() - start };
|
|
118636
|
+
}
|
|
118637
|
+
async function primeCandUrls(browser, urls, primed, ctxOpts) {
|
|
118638
|
+
if (urls.length === 0)
|
|
118639
|
+
return { attempted: 0, failed: [], totalMs: 0 };
|
|
118640
|
+
const ctx = await newContext(browser, { cohortCookieValue: "control", ...ctxOpts });
|
|
118641
|
+
try {
|
|
118642
|
+
return await primeSequentially(urls, primed, async (url) => {
|
|
118643
|
+
const page = await ctx.newPage();
|
|
118644
|
+
try {
|
|
118645
|
+
await page.goto(url, { waitUntil: "domcontentloaded", timeout: PRIME_TIMEOUT_MS });
|
|
118646
|
+
await page.waitForLoadState("load", { timeout: PRIME_LOAD_MS }).catch(() => {
|
|
118647
|
+
return;
|
|
118648
|
+
});
|
|
118649
|
+
return true;
|
|
118650
|
+
} finally {
|
|
118651
|
+
await page.close().catch(() => {
|
|
118652
|
+
return;
|
|
118653
|
+
});
|
|
118654
|
+
}
|
|
118655
|
+
});
|
|
118656
|
+
} finally {
|
|
118657
|
+
await ctx.close().catch(() => {
|
|
118658
|
+
return;
|
|
118659
|
+
});
|
|
118660
|
+
}
|
|
118661
|
+
}
|
|
118662
|
+
function needsRetry(side, candUrl, cap) {
|
|
118663
|
+
if (side !== "cand" || !isLocalhost(candUrl))
|
|
118664
|
+
return false;
|
|
118665
|
+
if (!cap)
|
|
118666
|
+
return true;
|
|
118667
|
+
return cap.status === 0 && !cap.retried;
|
|
118668
|
+
}
|
|
118669
|
+
var COLD_SHARE = 0.25;
|
|
118670
|
+
function isColdCandidate(loads) {
|
|
118671
|
+
return loads.failed >= 2 && loads.failed / loads.total > COLD_SHARE;
|
|
118672
|
+
}
|
|
118673
|
+
|
|
118449
118674
|
// src/engine/run-context.ts
|
|
118450
118675
|
function detectRunCaveats(input) {
|
|
118451
118676
|
const out = [];
|
|
@@ -118457,6 +118682,15 @@ function detectRunCaveats(input) {
|
|
|
118457
118682
|
detail: "Vitals, cache e bundle de um dev server não são representativos: sem minificação, sem cache de edge, HMR aberto. Reconfirme num build de produção antes de tratar qualquer número de performance como resultado."
|
|
118458
118683
|
});
|
|
118459
118684
|
}
|
|
118685
|
+
if (input.warmLoads && isColdCandidate(input.warmLoads)) {
|
|
118686
|
+
const { failed, total } = input.warmLoads;
|
|
118687
|
+
out.push({
|
|
118688
|
+
id: "cand-cold",
|
|
118689
|
+
level: "warn",
|
|
118690
|
+
summary: `${failed} of ${total} warm-up/priming loads never answered — the server looked cold or unhealthy`,
|
|
118691
|
+
detail: "Pages that did not answer are missing from this run or were measured cold, so counts, vitals and status findings of the affected routes are not a fair comparison. Wait for the candidate to finish starting, or request each route once, then re-run."
|
|
118692
|
+
});
|
|
118693
|
+
}
|
|
118460
118694
|
if (isLocalhost(input.prodUrl)) {
|
|
118461
118695
|
out.push({
|
|
118462
118696
|
id: "prod-dev-server",
|
|
@@ -118470,7 +118704,7 @@ function detectRunCaveats(input) {
|
|
|
118470
118704
|
id: "cand-staging-host",
|
|
118471
118705
|
level: "warn",
|
|
118472
118706
|
summary: "Candidato num host de staging — noindex e terceiros não julgados",
|
|
118473
|
-
detail: "cand está noutro host e marca noindex em todas as páginas que prod indexa
|
|
118707
|
+
detail: "cand está noutro host e marca noindex em todas as páginas que prod indexa (é o comportamento de um host de staging: deco marca noindex fora do domínio de produção), ou é um dev server local, onde rastreamento e vendors não são ligados. noindex/nofollow, terceiros ausentes e requests a terceiros que falham só em cand ficaram inconclusivos. Reconfira depois da troca de domínio, ou rode com --cand-is-production se cand já é o domínio final."
|
|
118474
118708
|
});
|
|
118475
118709
|
}
|
|
118476
118710
|
for (const side of ["prod", "cand"]) {
|
|
@@ -119180,6 +119414,65 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
119180
119414
|
} else if (warmPlan.skippedReason === "bypass-cache") {
|
|
119181
119415
|
console.log(chalk34.dim(" vitals warm-up: off (--bypass-cache measures cold on purpose)"));
|
|
119182
119416
|
}
|
|
119417
|
+
const primeEnabled = opts.primeCand !== false && isLocalhost(opts.cand);
|
|
119418
|
+
const primed = new Set;
|
|
119419
|
+
const primeAcc = { attempted: 0, failed: [], totalMs: 0 };
|
|
119420
|
+
const candRetry = { retried: 0, recovered: 0 };
|
|
119421
|
+
const retrying = new Set;
|
|
119422
|
+
const warmLoadsNow = () => ({
|
|
119423
|
+
total: primeAcc.attempted + (vitalsWarm?.stats.loads ?? 0),
|
|
119424
|
+
failed: primeAcc.failed.length + (vitalsWarm?.stats.failed ?? 0)
|
|
119425
|
+
});
|
|
119426
|
+
let coldWarned = false;
|
|
119427
|
+
const warnIfCold = () => {
|
|
119428
|
+
const loads = warmLoadsNow();
|
|
119429
|
+
if (coldWarned || !isColdCandidate(loads))
|
|
119430
|
+
return;
|
|
119431
|
+
coldWarned = true;
|
|
119432
|
+
console.log(chalk34.yellow(` ! ${loads.failed} of ${loads.total} warm-up/priming loads never answered — the server looks cold or unhealthy. Captures that follow will likely time out. Wait for it to finish starting, or request each route once, then re-run.`));
|
|
119433
|
+
};
|
|
119434
|
+
const primeCand = async (candPaths) => {
|
|
119435
|
+
if (!primeEnabled || !browser)
|
|
119436
|
+
return;
|
|
119437
|
+
const urls = planCandPrime(opts.cand, candPaths, primed);
|
|
119438
|
+
if (urls.length === 0)
|
|
119439
|
+
return;
|
|
119440
|
+
console.log(chalk34.dim(` priming cand: ${urls.length} URL(s), one at a time (--no-prime-cand to skip)`));
|
|
119441
|
+
const r = await primeCandUrls(browser, urls, primed, {
|
|
119442
|
+
viewport: viewports[0],
|
|
119443
|
+
cookies: pins.cand.cookies,
|
|
119444
|
+
headers: pins.cand.headers
|
|
119445
|
+
});
|
|
119446
|
+
primeAcc.attempted += r.attempted;
|
|
119447
|
+
primeAcc.failed.push(...r.failed);
|
|
119448
|
+
primeAcc.totalMs += r.totalMs;
|
|
119449
|
+
phaseStart += r.totalMs;
|
|
119450
|
+
warnIfCold();
|
|
119451
|
+
};
|
|
119452
|
+
const retryColdCand = async (pass, passTasks, runTask) => {
|
|
119453
|
+
const capOf = (t) => {
|
|
119454
|
+
const url = new URL(t.path, opts.cand).toString();
|
|
119455
|
+
return allPageCaptures.find((c) => c.pass === pass && c.side === "cand" && c.viewport === t.viewport && c.url === url);
|
|
119456
|
+
};
|
|
119457
|
+
for (const t of passTasks.filter((x) => needsRetry(x.side, opts.cand, capOf(x)))) {
|
|
119458
|
+
const old = capOf(t);
|
|
119459
|
+
const before = allPageCaptures.length;
|
|
119460
|
+
retrying.add(t);
|
|
119461
|
+
candRetry.retried++;
|
|
119462
|
+
await runTask(t);
|
|
119463
|
+
if (allPageCaptures.length === before)
|
|
119464
|
+
continue;
|
|
119465
|
+
const fresh = allPageCaptures[allPageCaptures.length - 1];
|
|
119466
|
+
if (fresh.status > 0)
|
|
119467
|
+
candRetry.recovered++;
|
|
119468
|
+
if (old) {
|
|
119469
|
+
allPageCaptures.splice(allPageCaptures.indexOf(old), 1);
|
|
119470
|
+
const fi = allFlowCaptures.findIndex((f) => f.pages.length === 1 && f.pages[0] === old);
|
|
119471
|
+
if (fi >= 0)
|
|
119472
|
+
allFlowCaptures.splice(fi, 1);
|
|
119473
|
+
}
|
|
119474
|
+
}
|
|
119475
|
+
};
|
|
119183
119476
|
const timeoutMinutes = Math.max(1, Math.floor(opts.timeout ?? 30));
|
|
119184
119477
|
const globalTimeoutTimer = setTimeout(() => {
|
|
119185
119478
|
shutdown(`timeout ${timeoutMinutes}min`);
|
|
@@ -119305,8 +119598,10 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
119305
119598
|
}
|
|
119306
119599
|
};
|
|
119307
119600
|
const maxViewportConcurrency = Math.max(1, opts.maxViewportConcurrency ?? 2);
|
|
119601
|
+
await primeCand(["/"]);
|
|
119308
119602
|
await runWithConcurrency2(viewports, maxViewportConcurrency, runOneViewport);
|
|
119309
119603
|
stampPhase("collect");
|
|
119604
|
+
warnIfCold();
|
|
119310
119605
|
spinner.succeed("Coleta concluída");
|
|
119311
119606
|
if (isLlmAvailable()) {
|
|
119312
119607
|
const prodPdp = findPdpCapture(allFlowCaptures, "prod");
|
|
@@ -119381,7 +119676,8 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
119381
119676
|
}
|
|
119382
119677
|
}
|
|
119383
119678
|
let done = 0;
|
|
119384
|
-
await
|
|
119679
|
+
await primeCand(extraPaths);
|
|
119680
|
+
const runTask = async (task) => {
|
|
119385
119681
|
const baseUrl = task.side === "prod" ? opts.prod : opts.cand;
|
|
119386
119682
|
const fullUrl = new URL(task.path, baseUrl).toString();
|
|
119387
119683
|
const targetIsDevServer = isLocalhost(baseUrl);
|
|
@@ -119425,6 +119721,8 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
119425
119721
|
return;
|
|
119426
119722
|
}
|
|
119427
119723
|
cap.pass = "extra";
|
|
119724
|
+
if (retrying.has(task))
|
|
119725
|
+
cap.retried = true;
|
|
119428
119726
|
allPageCaptures.push(cap);
|
|
119429
119727
|
allFlowCaptures.push({
|
|
119430
119728
|
flow: "homepage",
|
|
@@ -119446,7 +119744,9 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
119446
119744
|
vitalsHb.bump();
|
|
119447
119745
|
extraSpinner.text = `[vitals extras] ${done}/${tasks.length} (último: ${task.path})`;
|
|
119448
119746
|
}
|
|
119449
|
-
}
|
|
119747
|
+
};
|
|
119748
|
+
await runWithConcurrency2(tasks, 4, runTask);
|
|
119749
|
+
await retryColdCand("extra", tasks, runTask);
|
|
119450
119750
|
vitalsHb.stop();
|
|
119451
119751
|
extraSpinner.succeed(`+${extraPaths.length} página(s) com vitals`);
|
|
119452
119752
|
} else {
|
|
@@ -119458,6 +119758,7 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
119458
119758
|
extraSpinner.warn(`vitals extras pulado: ${err.message}`);
|
|
119459
119759
|
} finally {
|
|
119460
119760
|
stampPhase("vitals-pages");
|
|
119761
|
+
warnIfCold();
|
|
119461
119762
|
}
|
|
119462
119763
|
}
|
|
119463
119764
|
const explicitPaths = resolveExplicitPages(opts.pagesFile, opts.pages);
|
|
@@ -119491,7 +119792,8 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
119491
119792
|
} else {
|
|
119492
119793
|
visualSpinner.text = `Visual diff: capturando ${tasks.length} screenshot(s) (${visualPaths.length} páginas × ${viewports.length} viewport(s) × 2 sides)…`;
|
|
119493
119794
|
let done = 0;
|
|
119494
|
-
await
|
|
119795
|
+
await primeCand(visualPaths.map((p) => p.cand));
|
|
119796
|
+
const runTask = async (task) => {
|
|
119495
119797
|
const baseUrl = task.side === "prod" ? opts.prod : opts.cand;
|
|
119496
119798
|
const fullUrl = new URL(task.path, baseUrl).toString();
|
|
119497
119799
|
const safePath = task.path.replace(/[/?&=]+/g, "_") || "_root";
|
|
@@ -119520,6 +119822,8 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
119520
119822
|
pairKey: task.pairKey
|
|
119521
119823
|
});
|
|
119522
119824
|
cap.pass = "visual";
|
|
119825
|
+
if (retrying.has(task))
|
|
119826
|
+
cap.retried = true;
|
|
119523
119827
|
allPageCaptures.push(cap);
|
|
119524
119828
|
if (existsSync31(screenshotPath)) {
|
|
119525
119829
|
visualProbes.set(screenshotPath, await probeFullPage(page, screenshotPath, task.side === "prod" ? screenshotPath.replace(/\.png$/, "-repeat.png") : null));
|
|
@@ -119537,7 +119841,9 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
119537
119841
|
visualHb.bump();
|
|
119538
119842
|
visualSpinner.text = `[visual] ${done}/${tasks.length} (último: ${task.path})`;
|
|
119539
119843
|
}
|
|
119540
|
-
}
|
|
119844
|
+
};
|
|
119845
|
+
await runWithConcurrency2(tasks, 4, runTask);
|
|
119846
|
+
await retryColdCand("visual", tasks, runTask);
|
|
119541
119847
|
visualHb.stop();
|
|
119542
119848
|
visualSpinner.succeed(`Visual diff: ${tasks.length} screenshot(s) capturado(s)`);
|
|
119543
119849
|
}
|
|
@@ -119552,6 +119858,14 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
119552
119858
|
const w = vitalsWarm.stats;
|
|
119553
119859
|
console.log(chalk34.dim(` vitals warm-up: ${w.pages} page(s), ${w.loads} load(s)${w.failed ? `, ${w.failed} failed` : ""}, +${(w.totalMs / 1000).toFixed(1)}s summed across captures`));
|
|
119554
119860
|
}
|
|
119861
|
+
warnIfCold();
|
|
119862
|
+
if (primeAcc.attempted > 0) {
|
|
119863
|
+
const f = primeAcc.failed.map((u) => new URL(u).pathname);
|
|
119864
|
+
console.log(chalk34.dim(` cand priming: ${primeAcc.attempted} URL(s), ${(primeAcc.totalMs / 1000).toFixed(1)}s${f.length ? `, ${f.length} never answered: ${f.slice(0, 5).join(", ")}${f.length > 5 ? "…" : ""}` : ""}`));
|
|
119865
|
+
}
|
|
119866
|
+
if (candRetry.retried > 0) {
|
|
119867
|
+
console.log(chalk34.dim(` cand retry: ${candRetry.retried} capture(s) retried after not answering, ${candRetry.recovered} recovered`));
|
|
119868
|
+
}
|
|
119555
119869
|
if (goldenRec && goldenPlan) {
|
|
119556
119870
|
const merged = mergeGoldenContext(goldenRec, goldenPlan, {
|
|
119557
119871
|
pages: allPageCaptures,
|
|
@@ -119685,6 +119999,8 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
119685
119999
|
const visualDiff = visualCheck?.data?.visualDiff;
|
|
119686
120000
|
const seoCheck = checks.find((c) => c.name === "seo-deep-audit");
|
|
119687
120001
|
const seo = seoCheck?.data?.seo;
|
|
120002
|
+
if (primeAcc.totalMs > 0)
|
|
120003
|
+
timings.push("prime-cand", primeAcc.totalMs);
|
|
119688
120004
|
const runTimings = timings.finalize();
|
|
119689
120005
|
const run = {
|
|
119690
120006
|
schemaVersion: "0.1",
|
|
@@ -119708,6 +120024,12 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
119708
120024
|
baseline: baselineSection,
|
|
119709
120025
|
timings: runTimings,
|
|
119710
120026
|
vitalsWarmup: vitalsWarm ? { enabled: true, loadsPerPage: vitalsWarm.loads, ...vitalsWarm.stats } : { enabled: false, skippedReason: warmPlan.skippedReason },
|
|
120027
|
+
candPrime: primeAcc.attempted > 0 || candRetry.retried > 0 ? {
|
|
120028
|
+
attempted: primeAcc.attempted,
|
|
120029
|
+
failedUrls: primeAcc.failed,
|
|
120030
|
+
totalMs: primeAcc.totalMs,
|
|
120031
|
+
...candRetry
|
|
120032
|
+
} : undefined,
|
|
119711
120033
|
selectionReason: opts.why,
|
|
119712
120034
|
moduleVerdicts: moduleVerdicts.length > 0 ? moduleVerdicts : undefined,
|
|
119713
120035
|
acceptedFindings: acceptance.accepted > 0 || acceptance.stale.length > 0 ? {
|
|
@@ -119723,7 +120045,8 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
119723
120045
|
verdict,
|
|
119724
120046
|
llmEnabled: llmStillAvailable,
|
|
119725
120047
|
candIsProduction: opts.candIsProduction,
|
|
119726
|
-
prodPinned: !isEmptyPin(pins.prod)
|
|
120048
|
+
prodPinned: !isEmptyPin(pins.prod),
|
|
120049
|
+
warmLoads: warmLoadsNow()
|
|
119727
120050
|
})),
|
|
119728
120051
|
pinned: isEmptyPin(pins.prod) && isEmptyPin(pins.cand) ? undefined : { prod: pinNames(pins.prod), cand: pinNames(pins.cand) },
|
|
119729
120052
|
pagePairs,
|
|
@@ -125084,7 +125407,7 @@ program.command("run").description([
|
|
|
125084
125407
|
" visual-pages=5, auto-selectors=ON (if LLM), learn=ON, visual-diff=ON,",
|
|
125085
125408
|
" warmup=OFF, vitals warm=ON, bypass-cache=OFF, fail-on=critical (exit 1 if hit)."
|
|
125086
125409
|
].join(`
|
|
125087
|
-
`)).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("--record <dir>", "Save the exact input the checks ran on (captures with full page HTML, resolved config, visual probes, screenshots, and the fetches the checks made) into <dir>, which must be new or empty. Contains full HTML and screenshots of both sites: do not commit it.").option("--golden <dir>", "Use the PROD half of a `--record` recording as the reference and capture only cand (--prod becomes optional). Pages come from the recording, prod-origin fetches by the checks are served from it, and a prod request it never saw is reported as stale (exit 2). Never written to. See docs/cli.md.").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) => {
|
|
125410
|
+
`)).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("--no-prime-cand", "Don't request each candidate URL once (sequentially, in a real page) before the capture passes. Applies only when --cand is a local dev server (localhost), which compiles each route on its first request and times out when several first requests overlap; ignored for any other candidate. Separate from --no-warm: priming is cand-only, measures nothing, and still runs under --bypass-cache.").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("--record <dir>", "Save the exact input the checks ran on (captures with full page HTML, resolved config, visual probes, screenshots, and the fetches the checks made) into <dir>, which must be new or empty. Contains full HTML and screenshots of both sites: do not commit it.").option("--golden <dir>", "Use the PROD half of a `--record` recording as the reference and capture only cand (--prod becomes optional). Pages come from the recording, prod-origin fetches by the checks are served from it, and a prod request it never saw is reported as stale (exit 2). Never written to. See docs/cli.md.").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) => {
|
|
125088
125411
|
if (opts.flow) {
|
|
125089
125412
|
opts.flows = opts.flow;
|
|
125090
125413
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decocms/parity",
|
|
3
|
-
"version": "0.35.
|
|
3
|
+
"version": "0.35.29",
|
|
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",
|