@decocms/parity 0.29.0 → 0.29.1

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.
Files changed (2) hide show
  1. package/dist/cli.js +329 -220
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -49462,6 +49462,112 @@ function hash(s) {
49462
49462
  return Math.abs(h).toString(36);
49463
49463
  }
49464
49464
 
49465
+ // src/checks/content-structure.ts
49466
+ init_esm10();
49467
+ var CONTENT_PATH = /(politica|policy|termos|terminos|terms|tyc|privacidad|privacy|sobre|about|garantia|warranty|institucional|institutional|contacta|contact)/i;
49468
+ var TOLERANCE = 0.8;
49469
+ function readStructure(html3) {
49470
+ const $2 = load(html3);
49471
+ $2("script, style, nav, header, footer").remove();
49472
+ const root2 = $2("main").length > 0 ? $2("main") : $2("body");
49473
+ const boldish = root2.find("strong, b, span, em").filter((_, el) => {
49474
+ const tag = el.tagName?.toLowerCase();
49475
+ if (tag === "strong" || tag === "b")
49476
+ return true;
49477
+ const cls = String($2(el).attr("class") ?? "");
49478
+ return /(^|\s)b(\s|$)/.test(cls) || /strong|bold/i.test(cls);
49479
+ }).length;
49480
+ return {
49481
+ chars: root2.text().replace(/\s+/g, " ").trim().length,
49482
+ paragraphs: root2.find("p").length,
49483
+ breaks: root2.find("br").length,
49484
+ bold: boldish,
49485
+ links: root2.find("a[href]").length
49486
+ };
49487
+ }
49488
+ function pathOf2(url) {
49489
+ try {
49490
+ return new URL(url).pathname.replace(/\/+$/, "") || "/";
49491
+ } catch {
49492
+ return url;
49493
+ }
49494
+ }
49495
+ function pair(prod, cand) {
49496
+ const byPath = new Map;
49497
+ for (const c of cand)
49498
+ if (!byPath.has(pathOf2(c.url)))
49499
+ byPath.set(pathOf2(c.url), c);
49500
+ const pairs = [];
49501
+ for (const p of prod) {
49502
+ const match = byPath.get(pathOf2(p.url));
49503
+ if (match && CONTENT_PATH.test(pathOf2(p.url)))
49504
+ pairs.push([p, match]);
49505
+ }
49506
+ return pairs;
49507
+ }
49508
+ function contentStructureParity(ctx) {
49509
+ const start = Date.now();
49510
+ const issues = [];
49511
+ const pairs = pair(ctx.prodPages, ctx.candPages);
49512
+ if (pairs.length === 0) {
49513
+ return {
49514
+ name: "content-structure",
49515
+ status: "skipped",
49516
+ severity: "medium",
49517
+ durationMs: Date.now() - start,
49518
+ summary: "Nenhuma página editorial capturada nos dois lados — comparação de estrutura desabilitada",
49519
+ issues: []
49520
+ };
49521
+ }
49522
+ for (const [prodPage, candPage] of pairs) {
49523
+ const path = pathOf2(prodPage.url);
49524
+ const a = readStructure(prodPage.html);
49525
+ const b = readStructure(candPage.html);
49526
+ if (a.chars < 500)
49527
+ continue;
49528
+ if (b.chars < a.chars * TOLERANCE) {
49529
+ issues.push({
49530
+ id: `content:missing-body:${path}`,
49531
+ severity: "high",
49532
+ category: "functional",
49533
+ check: "content-structure",
49534
+ summary: `${path}: corpo incompleto — ${b.chars} caracteres contra ${a.chars} no prod`,
49535
+ details: "A página existe e responde 200, mas o conteúdo não foi migrado por inteiro."
49536
+ });
49537
+ continue;
49538
+ }
49539
+ const lost = [];
49540
+ if (a.bold > 0 && b.bold < a.bold * TOLERANCE)
49541
+ lost.push(`negrito ${b.bold}/${a.bold}`);
49542
+ if (a.breaks > 0 && b.breaks < a.breaks * TOLERANCE)
49543
+ lost.push(`quebras de linha ${b.breaks}/${a.breaks}`);
49544
+ if (a.links > 0 && b.links < a.links * TOLERANCE)
49545
+ lost.push(`links ${b.links}/${a.links}`);
49546
+ if (a.paragraphs > 0 && b.paragraphs < a.paragraphs * TOLERANCE) {
49547
+ lost.push(`parágrafos ${b.paragraphs}/${a.paragraphs}`);
49548
+ }
49549
+ if (lost.length > 0) {
49550
+ issues.push({
49551
+ id: `content:lost-formatting:${path}`,
49552
+ severity: "medium",
49553
+ category: "visual",
49554
+ check: "content-structure",
49555
+ summary: `${path}: texto migrado sem a formatação — ${lost.join(", ")}`,
49556
+ details: "O número de caracteres bate, então um diff de texto não acusa. Costuma ser extração por " + "`innerText`, que achata `<br>` e perde marcação de negrito quando ela vem por classe " + '(`<span class="b">`) em vez de `<strong>`.'
49557
+ });
49558
+ }
49559
+ }
49560
+ const status = issues.some((i) => i.severity === "high") ? "fail" : issues.length > 0 ? "warn" : "pass";
49561
+ return {
49562
+ name: "content-structure",
49563
+ status,
49564
+ severity: "high",
49565
+ durationMs: Date.now() - start,
49566
+ summary: issues.length === 0 ? `${pairs.length} página(s) editorial(is) com estrutura equivalente ao prod` : `${issues.length} página(s) editorial(is) com conteúdo ou formatação faltando`,
49567
+ issues
49568
+ };
49569
+ }
49570
+
49465
49571
  // src/checks/cookie-cep-modal-cls.ts
49466
49572
  var CLS_HIGH_THRESHOLD = 0.1;
49467
49573
  var CLS_REGRESSION_RATIO = 1.5;
@@ -49782,8 +49888,8 @@ async function footerLinksHealth(ctx) {
49782
49888
  const candLinks = extractFooterLinks(candHome, { followExternal, maxLinks });
49783
49889
  const prodResults = await probeLinks(prodLinks);
49784
49890
  const candResults = await probeLinks(candLinks);
49785
- const prodByPath = new Map(prodResults.map((r) => [pathOf2(r.url), r]));
49786
- const candByPath = new Map(candResults.map((r) => [pathOf2(r.url), r]));
49891
+ const prodByPath = new Map(prodResults.map((r) => [pathOf3(r.url), r]));
49892
+ const candByPath = new Map(candResults.map((r) => [pathOf3(r.url), r]));
49787
49893
  for (const [path, candR] of candByPath) {
49788
49894
  const prodR = prodByPath.get(path);
49789
49895
  const candBroken = candR.status >= 400 || candR.status === 0;
@@ -49889,7 +49995,7 @@ async function probeLinks(urls) {
49889
49995
  }
49890
49996
  }));
49891
49997
  }
49892
- function pathOf2(url) {
49998
+ function pathOf3(url) {
49893
49999
  try {
49894
50000
  return new URL(url).pathname;
49895
50001
  } catch {
@@ -49907,9 +50013,9 @@ function htmlStructuralDiff(ctx) {
49907
50013
  const start = Date.now();
49908
50014
  const { pairs } = pairCaptures(ctx.prodPages, ctx.candPages);
49909
50015
  const issues = [];
49910
- for (const pair of pairs) {
49911
- const prodSnap = snapshotDom(pair.prod.html);
49912
- const candSnap = snapshotDom(pair.cand.html);
50016
+ for (const pair2 of pairs) {
50017
+ const prodSnap = snapshotDom(pair2.prod.html);
50018
+ const candSnap = snapshotDom(pair2.cand.html);
49913
50019
  const diff = diffDom(prodSnap, candSnap, { countTolerance: 2 });
49914
50020
  const NOISY = new Set(["imgs"]);
49915
50021
  const structural = Object.entries(diff.countsDelta).filter(([k]) => !NOISY.has(k));
@@ -49917,15 +50023,15 @@ function htmlStructuralDiff(ctx) {
49917
50023
  if (structural.length > 0) {
49918
50024
  const summary = structural.map(([k, v]) => `${k}: ${v?.prod}→${v?.cand} (Δ${v?.delta})`).join(", ");
49919
50025
  issues.push({
49920
- id: `html-structural:counts:${pair.key}`,
50026
+ id: `html-structural:counts:${pair2.key}`,
49921
50027
  severity: "high",
49922
50028
  category: "functional",
49923
- page: pair.key,
50029
+ page: pair2.key,
49924
50030
  check: "html-structural-diff",
49925
- summary: `Contagem de elementos divergente em ${pair.key}: ${summary}`,
50031
+ summary: `Contagem de elementos divergente em ${pair2.key}: ${summary}`,
49926
50032
  evidence: [
49927
- { kind: "screenshot", path: pair.prod.screenshotPath, label: "prod" },
49928
- { kind: "screenshot", path: pair.cand.screenshotPath, label: "cand" }
50033
+ { kind: "screenshot", path: pair2.prod.screenshotPath, label: "prod" },
50034
+ { kind: "screenshot", path: pair2.cand.screenshotPath, label: "cand" }
49929
50035
  ]
49930
50036
  });
49931
50037
  }
@@ -49934,24 +50040,24 @@ function htmlStructuralDiff(ctx) {
49934
50040
  const candUnique = new Set(candSnap.imageStats.src).size;
49935
50041
  const summary = noisy.map(([k, v]) => `${k}: ${v?.prod}→${v?.cand} (Δ${v?.delta})`).join(", ");
49936
50042
  issues.push({
49937
- id: `html-structural:counts-informational:${pair.key}`,
50043
+ id: `html-structural:counts-informational:${pair2.key}`,
49938
50044
  severity: "low",
49939
50045
  category: "visual",
49940
- page: pair.key,
50046
+ page: pair2.key,
49941
50047
  check: "html-structural-diff",
49942
50048
  inconclusive: true,
49943
- summary: `Contagem de imagens divergente em ${pair.key} (informativo — estratégias de render diferentes): ${summary}. Imagens únicas por src: prod=${prodUnique} cand=${candUnique}`,
50049
+ summary: `Contagem de imagens divergente em ${pair2.key} (informativo — estratégias de render diferentes): ${summary}. Imagens únicas por src: prod=${prodUnique} cand=${candUnique}`,
49944
50050
  details: "Contagem bruta de <img> não é sinal confiável quando prod defere (Lazy) e cand faz SSR, ou quando há clones de carousel / conteúdo dinâmico (geocoding). Compare imagens únicas por src acima."
49945
50051
  });
49946
50052
  }
49947
50053
  if (diff.decoSectionsOnlyProd.length > 0) {
49948
50054
  issues.push({
49949
- id: `html-structural:deco-missing:${pair.key}`,
50055
+ id: `html-structural:deco-missing:${pair2.key}`,
49950
50056
  severity: "high",
49951
50057
  category: "functional",
49952
- page: pair.key,
50058
+ page: pair2.key,
49953
50059
  check: "html-structural-diff",
49954
- summary: `Sections renderizadas em prod ausentes em cand (${pair.key}): ${diff.decoSectionsOnlyProd.join(", ")}`
50060
+ summary: `Sections renderizadas em prod ausentes em cand (${pair2.key}): ${diff.decoSectionsOnlyProd.join(", ")}`
49955
50061
  });
49956
50062
  }
49957
50063
  }
@@ -49982,18 +50088,18 @@ function httpStatusParity(ctx) {
49982
50088
  }
49983
50089
  const { pairs, orphansProd, orphansCand } = pairCaptures(ctx.prodPages, ctx.candPages);
49984
50090
  const issues = [];
49985
- for (const pair of pairs) {
49986
- if (pair.prod.status !== pair.cand.status) {
50091
+ for (const pair2 of pairs) {
50092
+ if (pair2.prod.status !== pair2.cand.status) {
49987
50093
  issues.push({
49988
- id: `http-status:${pair.key}`,
50094
+ id: `http-status:${pair2.key}`,
49989
50095
  severity: "critical",
49990
50096
  category: "functional",
49991
- page: pair.key,
50097
+ page: pair2.key,
49992
50098
  check: "http-status-parity",
49993
- summary: `Status divergente em ${pair.key}: prod=${pair.prod.status} cand=${pair.cand.status}`,
50099
+ summary: `Status divergente em ${pair2.key}: prod=${pair2.prod.status} cand=${pair2.cand.status}`,
49994
50100
  evidence: [
49995
- { kind: "screenshot", path: pair.prod.screenshotPath, label: "prod" },
49996
- { kind: "screenshot", path: pair.cand.screenshotPath, label: "cand" }
50101
+ { kind: "screenshot", path: pair2.prod.screenshotPath, label: "prod" },
50102
+ { kind: "screenshot", path: pair2.cand.screenshotPath, label: "cand" }
49997
50103
  ]
49998
50104
  });
49999
50105
  }
@@ -50036,26 +50142,26 @@ function imageLoadingHealth(ctx) {
50036
50142
  const start = Date.now();
50037
50143
  const { pairs } = pairCaptures(ctx.prodPages, ctx.candPages);
50038
50144
  const issues = [];
50039
- for (const pair of pairs) {
50040
- const prodSnap = snapshotDom(pair.prod.html);
50041
- const candSnap = snapshotDom(pair.cand.html);
50042
- const candFailedImgs = countFailedImageRequests(pair.cand.network);
50145
+ for (const pair2 of pairs) {
50146
+ const prodSnap = snapshotDom(pair2.prod.html);
50147
+ const candSnap = snapshotDom(pair2.cand.html);
50148
+ const candFailedImgs = countFailedImageRequests(pair2.cand.network);
50043
50149
  if (candFailedImgs > 0) {
50044
50150
  issues.push({
50045
- id: `images:failed:${pair.key}`,
50151
+ id: `images:failed:${pair2.key}`,
50046
50152
  severity: "medium",
50047
50153
  category: "network",
50048
- page: pair.key,
50154
+ page: pair2.key,
50049
50155
  check: "image-loading-health",
50050
- summary: `${candFailedImgs} imagem(ns) com falha de carregamento em cand (${pair.key})`
50156
+ summary: `${candFailedImgs} imagem(ns) com falha de carregamento em cand (${pair2.key})`
50051
50157
  });
50052
50158
  }
50053
50159
  if (candSnap.imageStats.withoutAlt - prodSnap.imageStats.withoutAlt > 1) {
50054
50160
  issues.push({
50055
- id: `images:alt:${pair.key}`,
50161
+ id: `images:alt:${pair2.key}`,
50056
50162
  severity: "low",
50057
50163
  category: "seo",
50058
- page: pair.key,
50164
+ page: pair2.key,
50059
50165
  check: "image-loading-health",
50060
50166
  summary: `Mais imagens sem alt em cand: prod=${prodSnap.imageStats.withoutAlt} cand=${candSnap.imageStats.withoutAlt}`
50061
50167
  });
@@ -50063,12 +50169,12 @@ function imageLoadingHealth(ctx) {
50063
50169
  const srcsetLoss = prodSnap.imageStats.withSrcset - candSnap.imageStats.withSrcset;
50064
50170
  if (srcsetLoss > 2) {
50065
50171
  issues.push({
50066
- id: `images:srcset:${pair.key}`,
50172
+ id: `images:srcset:${pair2.key}`,
50067
50173
  severity: "medium",
50068
50174
  category: "performance",
50069
- page: pair.key,
50175
+ page: pair2.key,
50070
50176
  check: "image-loading-health",
50071
- summary: `Perda de srcset em cand (${pair.key}): prod=${prodSnap.imageStats.withSrcset}, cand=${candSnap.imageStats.withSrcset}`
50177
+ summary: `Perda de srcset em cand (${pair2.key}): prod=${prodSnap.imageStats.withSrcset}, cand=${candSnap.imageStats.withSrcset}`
50072
50178
  });
50073
50179
  }
50074
50180
  }
@@ -50093,9 +50199,9 @@ function lazySectionPresence(ctx) {
50093
50199
  const start = Date.now();
50094
50200
  const { pairs } = pairCaptures(ctx.prodPages, ctx.candPages);
50095
50201
  const issues = [];
50096
- for (const pair of pairs) {
50097
- const prodSections = extractSectionIds(pair.prod.network);
50098
- const candSections = extractSectionIds(pair.cand.network);
50202
+ for (const pair2 of pairs) {
50203
+ const prodSections = extractSectionIds(pair2.prod.network);
50204
+ const candSections = extractSectionIds(pair2.cand.network);
50099
50205
  const onlyProd = [...prodSections].filter((s) => !candSections.has(s));
50100
50206
  const onlyCand = [...candSections].filter((s) => !prodSections.has(s));
50101
50207
  const union = prodSections.size + candSections.size;
@@ -50103,18 +50209,18 @@ function lazySectionPresence(ctx) {
50103
50209
  const jaccard = union === 0 ? 1 : intersection / (union - intersection);
50104
50210
  const candIsIntentionallyEager = detectIntentionalEager({
50105
50211
  candSections,
50106
- candHtml: pair.cand.html,
50107
- prodHtml: pair.prod.html
50212
+ candHtml: pair2.cand.html,
50213
+ prodHtml: pair2.prod.html
50108
50214
  });
50109
50215
  if (onlyProd.length > 0) {
50110
50216
  if (candIsIntentionallyEager) {
50111
50217
  issues.push({
50112
- id: `lazy:intentional-eager:${pair.key}`,
50218
+ id: `lazy:intentional-eager:${pair2.key}`,
50113
50219
  severity: "low",
50114
50220
  category: "performance",
50115
- page: pair.key,
50221
+ page: pair2.key,
50116
50222
  check: "lazy-section-presence",
50117
- summary: `[${pair.key}] cand renderiza ${onlyProd.length} section(s) eagerly que prod faz lazy — intentional-eager-rendering`,
50223
+ summary: `[${pair2.key}] cand renderiza ${onlyProd.length} section(s) eagerly que prod faz lazy — intentional-eager-rendering`,
50118
50224
  details: [
50119
50225
  `Faltando lazy em cand: ${onlyProd.join(", ")}`,
50120
50226
  "",
@@ -50132,12 +50238,12 @@ function lazySectionPresence(ctx) {
50132
50238
  });
50133
50239
  } else {
50134
50240
  issues.push({
50135
- id: `lazy:missing:${pair.key}`,
50241
+ id: `lazy:missing:${pair2.key}`,
50136
50242
  severity: "high",
50137
50243
  category: "functional",
50138
- page: pair.key,
50244
+ page: pair2.key,
50139
50245
  check: "lazy-section-presence",
50140
- summary: `${onlyProd.length} lazy section(s) presentes em prod ausentes em cand (${pair.key})`,
50246
+ summary: `${onlyProd.length} lazy section(s) presentes em prod ausentes em cand (${pair2.key})`,
50141
50247
  details: `Faltando: ${onlyProd.join(", ")}
50142
50248
  Novos em cand: ${onlyCand.join(", ") || "—"}`
50143
50249
  });
@@ -50145,12 +50251,12 @@ Novos em cand: ${onlyCand.join(", ") || "—"}`
50145
50251
  }
50146
50252
  if (jaccard < 0.9 && union > 4 && !candIsIntentionallyEager) {
50147
50253
  issues.push({
50148
- id: `lazy:overlap:${pair.key}`,
50254
+ id: `lazy:overlap:${pair2.key}`,
50149
50255
  severity: "medium",
50150
50256
  category: "functional",
50151
- page: pair.key,
50257
+ page: pair2.key,
50152
50258
  check: "lazy-section-presence",
50153
- summary: `Overlap de lazy sections < 90% em ${pair.key} (Jaccard ${jaccard.toFixed(2)})`
50259
+ summary: `Overlap de lazy sections < 90% em ${pair2.key} (Jaccard ${jaccard.toFixed(2)})`
50154
50260
  });
50155
50261
  }
50156
50262
  }
@@ -50301,20 +50407,20 @@ function metaSeoParity(ctx) {
50301
50407
  const { pairs } = pairCaptures(ctx.prodPages, ctx.candPages);
50302
50408
  const ignoreKeys = new Set(ctx.ignore.ignoreMetaKeys);
50303
50409
  const issues = [];
50304
- for (const pair of pairs) {
50305
- const prodSnap = snapshotDom(pair.prod.html);
50306
- const candSnap = snapshotDom(pair.cand.html);
50410
+ for (const pair2 of pairs) {
50411
+ const prodSnap = snapshotDom(pair2.prod.html);
50412
+ const candSnap = snapshotDom(pair2.cand.html);
50307
50413
  const diff = diffDom(prodSnap, candSnap);
50308
50414
  const divergent = diff.metaDelta.filter((m) => !m.equal && !ignoreKeys.has(m.key));
50309
50415
  if (divergent.length > 0) {
50310
50416
  const summary = divergent.slice(0, 5).map((m) => `${m.key}`).join(", ");
50311
50417
  issues.push({
50312
- id: `meta-seo:${pair.key}`,
50418
+ id: `meta-seo:${pair2.key}`,
50313
50419
  severity: divergent.some((d) => d.key === "title" || d.key === "canonical") ? "high" : "medium",
50314
50420
  category: "seo",
50315
- page: pair.key,
50421
+ page: pair2.key,
50316
50422
  check: "meta-seo-parity",
50317
- summary: `Meta/SEO divergente em ${pair.key} (${divergent.length} key(s) com diferença): ${summary}${divergent.length > 5 ? "…" : ""}`,
50423
+ summary: `Meta/SEO divergente em ${pair2.key} (${divergent.length} key(s) com diferença): ${summary}${divergent.length > 5 ? "…" : ""}`,
50318
50424
  details: divergent.map((d) => `• ${d.key}
50319
50425
  prod: ${d.prod ?? "—"}
50320
50426
  cand: ${d.cand ?? "—"}`).join(`
@@ -50488,19 +50594,19 @@ function networkSummaryDelta(ctx) {
50488
50594
  const start = Date.now();
50489
50595
  const { pairs } = pairCaptures(ctx.prodPages, ctx.candPages);
50490
50596
  const issues = [];
50491
- for (const pair of pairs) {
50492
- const diff = diffNetwork(pair.prod.network, pair.cand.network, {
50597
+ for (const pair2 of pairs) {
50598
+ const diff = diffNetwork(pair2.prod.network, pair2.cand.network, {
50493
50599
  ignorePatterns: ctx.ignore.ignoreRequestPatterns,
50494
50600
  maxTotalPct: 0.3
50495
50601
  });
50496
50602
  if (diff.anyFailed) {
50497
50603
  issues.push({
50498
- id: `network:volume:${pair.key}`,
50604
+ id: `network:volume:${pair2.key}`,
50499
50605
  severity: "medium",
50500
50606
  category: "network",
50501
- page: pair.key,
50607
+ page: pair2.key,
50502
50608
  check: "network-summary-delta",
50503
- summary: `Volume de requests divergente em ${pair.key}: prod=${diff.prod.total}, cand=${diff.cand.total} (Δ ${(diff.delta.totalPct * 100).toFixed(0)}%)`,
50609
+ summary: `Volume de requests divergente em ${pair2.key}: prod=${diff.prod.total}, cand=${diff.cand.total} (Δ ${(diff.delta.totalPct * 100).toFixed(0)}%)`,
50504
50610
  details: [
50505
50611
  `Bytes Δ ${(diff.delta.bytesPct * 100).toFixed(0)}%`,
50506
50612
  `Cache hit rate prod=${(diff.prod.cacheHitRate * 100).toFixed(0)}%, cand=${(diff.cand.cacheHitRate * 100).toFixed(0)}%`,
@@ -50514,12 +50620,12 @@ function networkSummaryDelta(ctx) {
50514
50620
  for (const sec of prodApi) {
50515
50621
  if (!diff.cand.decoSectionsHit.includes(sec)) {
50516
50622
  issues.push({
50517
- id: `network:deco-section-gone:${pair.key}:${sec}`,
50623
+ id: `network:deco-section-gone:${pair2.key}:${sec}`,
50518
50624
  severity: "high",
50519
50625
  category: "network",
50520
- page: pair.key,
50626
+ page: pair2.key,
50521
50627
  check: "network-summary-delta",
50522
- summary: `Deco section renderizada em prod ausente em cand: "${sec}" (${pair.key})`
50628
+ summary: `Deco section renderizada em prod ausente em cand: "${sec}" (${pair2.key})`
50523
50629
  });
50524
50630
  }
50525
50631
  }
@@ -50911,7 +51017,7 @@ function pdpBreadcrumbs(ctx) {
50911
51017
  const single = prodPdps.length === 0 || candPdps.length === 0;
50912
51018
  const sourcePages = single ? candPdps.length > 0 ? candPdps : prodPdps : candPdps;
50913
51019
  for (const page of sourcePages) {
50914
- const pair = single ? undefined : prodPdps.find((p) => p.viewport === page.viewport);
51020
+ const pair2 = single ? undefined : prodPdps.find((p) => p.viewport === page.viewport);
50915
51021
  const candHas = hasAnyBreadcrumbSignal(page.html);
50916
51022
  if (single) {
50917
51023
  if (!candHas) {
@@ -50924,8 +51030,8 @@ function pdpBreadcrumbs(ctx) {
50924
51030
  page: page.url
50925
51031
  });
50926
51032
  }
50927
- } else if (pair) {
50928
- const prodHas = hasAnyBreadcrumbSignal(pair.html);
51033
+ } else if (pair2) {
51034
+ const prodHas = hasAnyBreadcrumbSignal(pair2.html);
50929
51035
  if (prodHas && !candHas) {
50930
51036
  issues.push({
50931
51037
  id: `pdp-breadcrumbs:${page.viewport}:lost`,
@@ -50991,7 +51097,7 @@ function pdpGalleryRelated(ctx) {
50991
51097
  const single = prodPdps.length === 0 || candPdps.length === 0;
50992
51098
  const sourcePages = single ? candPdps.length > 0 ? candPdps : prodPdps : candPdps;
50993
51099
  for (const page of sourcePages) {
50994
- const pair = single ? undefined : prodPdps.find((p) => p.viewport === page.viewport);
51100
+ const pair2 = single ? undefined : prodPdps.find((p) => p.viewport === page.viewport);
50995
51101
  const hasGalleryMain = matchAny(page.html, GALLERY_MAIN_PATTERNS);
50996
51102
  const hasThumb = matchAny(page.html, GALLERY_THUMB_PATTERNS);
50997
51103
  const hasRelated = matchAny(page.html, RELATED_PATTERNS);
@@ -51026,10 +51132,10 @@ function pdpGalleryRelated(ctx) {
51026
51132
  page: page.url
51027
51133
  });
51028
51134
  }
51029
- } else if (pair) {
51030
- const prodGallery = matchAny(pair.html, GALLERY_MAIN_PATTERNS);
51031
- const prodThumb = matchAny(pair.html, GALLERY_THUMB_PATTERNS);
51032
- const prodRelated = matchAny(pair.html, RELATED_PATTERNS);
51135
+ } else if (pair2) {
51136
+ const prodGallery = matchAny(pair2.html, GALLERY_MAIN_PATTERNS);
51137
+ const prodThumb = matchAny(pair2.html, GALLERY_THUMB_PATTERNS);
51138
+ const prodRelated = matchAny(pair2.html, RELATED_PATTERNS);
51033
51139
  if (prodGallery && !hasGalleryMain) {
51034
51140
  issues.push({
51035
51141
  id: `pdp-gallery:${page.viewport}:lost-main`,
@@ -51755,34 +51861,34 @@ function redirectsParity(ctx) {
51755
51861
  const { pairs } = pairCaptures(ctx.prodPages, ctx.candPages);
51756
51862
  const issues = [];
51757
51863
  let redirectsChecked = 0;
51758
- for (const pair of pairs) {
51759
- const prodRedirected = didRedirect(pair.prod.url, pair.prod.finalUrl);
51864
+ for (const pair2 of pairs) {
51865
+ const prodRedirected = didRedirect(pair2.prod.url, pair2.prod.finalUrl);
51760
51866
  if (!prodRedirected)
51761
51867
  continue;
51762
51868
  redirectsChecked++;
51763
- const candRedirected = didRedirect(pair.cand.url, pair.cand.finalUrl);
51869
+ const candRedirected = didRedirect(pair2.cand.url, pair2.cand.finalUrl);
51764
51870
  if (!candRedirected) {
51765
51871
  issues.push({
51766
- id: `redirect:not-preserved:${pair.key}`,
51872
+ id: `redirect:not-preserved:${pair2.key}`,
51767
51873
  severity: "high",
51768
51874
  category: "seo",
51769
- page: pair.key,
51875
+ page: pair2.key,
51770
51876
  check: "redirects-parity",
51771
- summary: `prod redireciona ${pair.key} para ${pathOf3(pair.prod.finalUrl)}, candidato não redireciona (serve o próprio caminho)`,
51877
+ summary: `prod redireciona ${pair2.key} para ${pathOf4(pair2.prod.finalUrl)}, candidato não redireciona (serve o próprio caminho)`,
51772
51878
  suggestedFix: "Confirme se a tabela de redirects legada foi migrada para este caminho."
51773
51879
  });
51774
51880
  continue;
51775
51881
  }
51776
- const prodDest = pathOf3(pair.prod.finalUrl);
51777
- const candDest = pathOf3(pair.cand.finalUrl);
51882
+ const prodDest = pathOf4(pair2.prod.finalUrl);
51883
+ const candDest = pathOf4(pair2.cand.finalUrl);
51778
51884
  if (prodDest !== candDest) {
51779
51885
  issues.push({
51780
- id: `redirect:destination-diff:${pair.key}`,
51886
+ id: `redirect:destination-diff:${pair2.key}`,
51781
51887
  severity: "medium",
51782
51888
  category: "seo",
51783
- page: pair.key,
51889
+ page: pair2.key,
51784
51890
  check: "redirects-parity",
51785
- summary: `Destino de redirect diverge em ${pair.key}: prod→${prodDest} cand→${candDest}`,
51891
+ summary: `Destino de redirect diverge em ${pair2.key}: prod→${prodDest} cand→${candDest}`,
51786
51892
  inconclusive: true
51787
51893
  });
51788
51894
  }
@@ -51799,9 +51905,9 @@ function redirectsParity(ctx) {
51799
51905
  function didRedirect(requested, final) {
51800
51906
  if (!requested || !final)
51801
51907
  return false;
51802
- return pathOf3(requested) !== pathOf3(final);
51908
+ return pathOf4(requested) !== pathOf4(final);
51803
51909
  }
51804
- function pathOf3(url) {
51910
+ function pathOf4(url) {
51805
51911
  try {
51806
51912
  const u = new URL(url);
51807
51913
  return u.pathname.replace(/\/+$/, "") || "/";
@@ -52123,11 +52229,11 @@ function sectionOrderParity(ctx) {
52123
52229
  }
52124
52230
  const { pairs } = pairCaptures(ctx.prodPages, ctx.candPages);
52125
52231
  const issues = [];
52126
- for (const pair of pairs) {
52127
- if (!pair.prod.html || !pair.cand.html)
52232
+ for (const pair2 of pairs) {
52233
+ if (!pair2.prod.html || !pair2.cand.html)
52128
52234
  continue;
52129
- const prodOrder = snapshotDom(pair.prod.html).decoSectionsOrder;
52130
- const candOrder = snapshotDom(pair.cand.html).decoSectionsOrder;
52235
+ const prodOrder = snapshotDom(pair2.prod.html).decoSectionsOrder;
52236
+ const candOrder = snapshotDom(pair2.cand.html).decoSectionsOrder;
52131
52237
  if (prodOrder.length === 0 || candOrder.length === 0)
52132
52238
  continue;
52133
52239
  if (prodOrder.length !== candOrder.length)
@@ -52139,17 +52245,17 @@ function sectionOrderParity(ctx) {
52139
52245
  if (sameOrder)
52140
52246
  continue;
52141
52247
  issues.push({
52142
- id: `section-order:${pair.key}`,
52248
+ id: `section-order:${pair2.key}`,
52143
52249
  severity: "medium",
52144
52250
  category: "functional",
52145
- page: pair.key,
52251
+ page: pair2.key,
52146
52252
  check: "section-order-parity",
52147
- summary: `Seções na mesma página em ordem diferente em ${pair.key}`,
52253
+ summary: `Seções na mesma página em ordem diferente em ${pair2.key}`,
52148
52254
  details: `prod: ${prodOrder.join(" → ")}
52149
52255
  cand: ${candOrder.join(" → ")}`,
52150
52256
  evidence: [
52151
- { kind: "screenshot", path: pair.prod.screenshotPath, label: "prod" },
52152
- { kind: "screenshot", path: pair.cand.screenshotPath, label: "cand" }
52257
+ { kind: "screenshot", path: pair2.prod.screenshotPath, label: "prod" },
52258
+ { kind: "screenshot", path: pair2.cand.screenshotPath, label: "cand" }
52153
52259
  ]
52154
52260
  });
52155
52261
  }
@@ -52322,19 +52428,19 @@ async function seoDeepAudit(ctx) {
52322
52428
  candBaseUrl: originOf(sample.cand.url)
52323
52429
  };
52324
52430
  const pageSnapshots = [];
52325
- for (const pair of pairs) {
52431
+ for (const pair2 of pairs) {
52326
52432
  const pageIssues = [];
52327
- pageIssues.push(...checkMetaRobots(pair));
52328
- pageIssues.push(...checkXRobotsHeader(pair));
52329
- pageIssues.push(...checkCanonical(pair));
52330
- pageIssues.push(...checkHreflang(pair));
52331
- pageIssues.push(...checkJsonLd(pair));
52433
+ pageIssues.push(...checkMetaRobots(pair2));
52434
+ pageIssues.push(...checkXRobotsHeader(pair2));
52435
+ pageIssues.push(...checkCanonical(pair2));
52436
+ pageIssues.push(...checkHreflang(pair2));
52437
+ pageIssues.push(...checkJsonLd(pair2));
52332
52438
  issues.push(...pageIssues);
52333
- const prodSnap = snapshotDom(pair.prod.html);
52334
- const candSnap = snapshotDom(pair.cand.html);
52439
+ const prodSnap = snapshotDom(pair2.prod.html);
52440
+ const candSnap = snapshotDom(pair2.cand.html);
52335
52441
  pageSnapshots.push({
52336
- pageKey: pair.key,
52337
- pageLabel: labelForPageKey(pair.key),
52442
+ pageKey: pair2.key,
52443
+ pageLabel: labelForPageKey(pair2.key),
52338
52444
  prodTitle: prodSnap.meta.title,
52339
52445
  candTitle: candSnap.meta.title,
52340
52446
  prodDescription: prodSnap.meta.description,
@@ -52343,8 +52449,8 @@ async function seoDeepAudit(ctx) {
52343
52449
  candCanonical: candSnap.meta.canonical,
52344
52450
  prodRobots: prodSnap.meta.robots,
52345
52451
  candRobots: candSnap.meta.robots,
52346
- prodXRobotsTag: pair.prod.xRobotsTag ?? null,
52347
- candXRobotsTag: pair.cand.xRobotsTag ?? null,
52452
+ prodXRobotsTag: pair2.prod.xRobotsTag ?? null,
52453
+ candXRobotsTag: pair2.cand.xRobotsTag ?? null,
52348
52454
  prodJsonLdTypes: prodSnap.meta.jsonLdTypes,
52349
52455
  candJsonLdTypes: candSnap.meta.jsonLdTypes,
52350
52456
  maxSeverity: maxSeverity(pageIssues),
@@ -52373,9 +52479,9 @@ async function seoDeepAudit(ctx) {
52373
52479
  data: { pages: pairs.length, seo }
52374
52480
  };
52375
52481
  }
52376
- function checkMetaRobots(pair) {
52377
- const prodMeta = snapshotDom(pair.prod.html).meta.robots ?? "";
52378
- const candMeta = snapshotDom(pair.cand.html).meta.robots ?? "";
52482
+ function checkMetaRobots(pair2) {
52483
+ const prodMeta = snapshotDom(pair2.prod.html).meta.robots ?? "";
52484
+ const candMeta = snapshotDom(pair2.cand.html).meta.robots ?? "";
52379
52485
  const prodIndexable = !/\bnoindex\b/i.test(prodMeta);
52380
52486
  const candIndexable = !/\bnoindex\b/i.test(candMeta);
52381
52487
  const prodFollowable = !/\bnofollow\b/i.test(prodMeta);
@@ -52383,164 +52489,164 @@ function checkMetaRobots(pair) {
52383
52489
  const out = [];
52384
52490
  if (prodIndexable && !candIndexable) {
52385
52491
  out.push({
52386
- id: `seo:noindex-introduced:${pair.key}`,
52492
+ id: `seo:noindex-introduced:${pair2.key}`,
52387
52493
  severity: "critical",
52388
52494
  category: "seo",
52389
- page: pair.key,
52495
+ page: pair2.key,
52390
52496
  check: "seo-deep-audit",
52391
- summary: `cand introduziu 'noindex' em ${pair.key} (prod era indexável) — página sairá do Google`,
52497
+ summary: `cand introduziu 'noindex' em ${pair2.key} (prod era indexável) — página sairá do Google`,
52392
52498
  details: `prod meta robots: "${prodMeta || "—"}"
52393
52499
  cand meta robots: "${candMeta || "—"}"`
52394
52500
  });
52395
52501
  }
52396
52502
  if (prodFollowable && !candFollowable) {
52397
52503
  out.push({
52398
- id: `seo:nofollow-introduced:${pair.key}`,
52504
+ id: `seo:nofollow-introduced:${pair2.key}`,
52399
52505
  severity: "high",
52400
52506
  category: "seo",
52401
- page: pair.key,
52507
+ page: pair2.key,
52402
52508
  check: "seo-deep-audit",
52403
- summary: `cand introduziu 'nofollow' em ${pair.key} (prod era follow)`,
52509
+ summary: `cand introduziu 'nofollow' em ${pair2.key} (prod era follow)`,
52404
52510
  details: `prod meta robots: "${prodMeta || "—"}"
52405
52511
  cand meta robots: "${candMeta || "—"}"`
52406
52512
  });
52407
52513
  }
52408
52514
  return out;
52409
52515
  }
52410
- function checkXRobotsHeader(pair) {
52411
- const p = (pair.prod.xRobotsTag ?? "").toLowerCase();
52412
- const c = (pair.cand.xRobotsTag ?? "").toLowerCase();
52516
+ function checkXRobotsHeader(pair2) {
52517
+ const p = (pair2.prod.xRobotsTag ?? "").toLowerCase();
52518
+ const c = (pair2.cand.xRobotsTag ?? "").toLowerCase();
52413
52519
  const prodIndexable = !/noindex/.test(p);
52414
52520
  const candIndexable = !/noindex/.test(c);
52415
52521
  if (prodIndexable && !candIndexable) {
52416
52522
  return [
52417
52523
  {
52418
- id: `seo:x-robots-noindex:${pair.key}`,
52524
+ id: `seo:x-robots-noindex:${pair2.key}`,
52419
52525
  severity: "critical",
52420
52526
  category: "seo",
52421
- page: pair.key,
52527
+ page: pair2.key,
52422
52528
  check: "seo-deep-audit",
52423
- summary: `Header X-Robots-Tag em cand contém 'noindex' (prod=indexável) em ${pair.key}`,
52424
- details: `prod X-Robots-Tag: "${pair.prod.xRobotsTag ?? "—"}"
52425
- cand X-Robots-Tag: "${pair.cand.xRobotsTag ?? "—"}"`
52529
+ summary: `Header X-Robots-Tag em cand contém 'noindex' (prod=indexável) em ${pair2.key}`,
52530
+ details: `prod X-Robots-Tag: "${pair2.prod.xRobotsTag ?? "—"}"
52531
+ cand X-Robots-Tag: "${pair2.cand.xRobotsTag ?? "—"}"`
52426
52532
  }
52427
52533
  ];
52428
52534
  }
52429
52535
  if (p !== c && (p || c)) {
52430
52536
  return [
52431
52537
  {
52432
- id: `seo:x-robots-diff:${pair.key}`,
52538
+ id: `seo:x-robots-diff:${pair2.key}`,
52433
52539
  severity: "high",
52434
52540
  category: "seo",
52435
- page: pair.key,
52541
+ page: pair2.key,
52436
52542
  check: "seo-deep-audit",
52437
- summary: `Header X-Robots-Tag diverge em ${pair.key}`,
52438
- details: `prod: "${pair.prod.xRobotsTag ?? "—"}"
52439
- cand: "${pair.cand.xRobotsTag ?? "—"}"`
52543
+ summary: `Header X-Robots-Tag diverge em ${pair2.key}`,
52544
+ details: `prod: "${pair2.prod.xRobotsTag ?? "—"}"
52545
+ cand: "${pair2.cand.xRobotsTag ?? "—"}"`
52440
52546
  }
52441
52547
  ];
52442
52548
  }
52443
52549
  return [];
52444
52550
  }
52445
- function checkCanonical(pair) {
52446
- const prodSnap = snapshotDom(pair.prod.html);
52447
- const candSnap = snapshotDom(pair.cand.html);
52551
+ function checkCanonical(pair2) {
52552
+ const prodSnap = snapshotDom(pair2.prod.html);
52553
+ const candSnap = snapshotDom(pair2.cand.html);
52448
52554
  const prodCanon = prodSnap.meta.canonical;
52449
52555
  const candCanon = candSnap.meta.canonical;
52450
52556
  const out = [];
52451
52557
  if (prodCanon && !candCanon) {
52452
52558
  out.push({
52453
- id: `seo:canonical-missing:${pair.key}`,
52559
+ id: `seo:canonical-missing:${pair2.key}`,
52454
52560
  severity: "high",
52455
52561
  category: "seo",
52456
- page: pair.key,
52562
+ page: pair2.key,
52457
52563
  check: "seo-deep-audit",
52458
- summary: `Canonical sumiu em cand (${pair.key}) — prod tinha "${prodCanon}"`
52564
+ summary: `Canonical sumiu em cand (${pair2.key}) — prod tinha "${prodCanon}"`
52459
52565
  });
52460
52566
  return out;
52461
52567
  }
52462
52568
  if (candCanon) {
52463
52569
  if (!isAbsoluteUrl(candCanon)) {
52464
52570
  out.push({
52465
- id: `seo:canonical-relative:${pair.key}`,
52571
+ id: `seo:canonical-relative:${pair2.key}`,
52466
52572
  severity: "high",
52467
52573
  category: "seo",
52468
- page: pair.key,
52574
+ page: pair2.key,
52469
52575
  check: "seo-deep-audit",
52470
52576
  summary: `Canonical em cand não é URL absoluta: "${candCanon}"`
52471
52577
  });
52472
52578
  }
52473
52579
  try {
52474
- const candUrlPath = new URL(pair.cand.url).pathname;
52475
- const canonPath = new URL(candCanon, pair.cand.url).pathname;
52580
+ const candUrlPath = new URL(pair2.cand.url).pathname;
52581
+ const canonPath = new URL(candCanon, pair2.cand.url).pathname;
52476
52582
  if (canonPath !== candUrlPath && canonPath === "/" && candUrlPath !== "/") {
52477
52583
  out.push({
52478
- id: `seo:canonical-home:${pair.key}`,
52584
+ id: `seo:canonical-home:${pair2.key}`,
52479
52585
  severity: "medium",
52480
52586
  category: "seo",
52481
- page: pair.key,
52587
+ page: pair2.key,
52482
52588
  check: "seo-deep-audit",
52483
- summary: `Canonical aponta para home (/) em uma página interna (${pair.key}): "${candCanon}"`
52589
+ summary: `Canonical aponta para home (/) em uma página interna (${pair2.key}): "${candCanon}"`
52484
52590
  });
52485
52591
  }
52486
52592
  } catch {}
52487
52593
  }
52488
52594
  return out;
52489
52595
  }
52490
- function checkHreflang(pair) {
52596
+ function checkHreflang(pair2) {
52491
52597
  const re = /<link[^>]+rel=["']alternate["'][^>]+hreflang=["']([^"']+)["']/gi;
52492
- const prodLangs = [...pair.prod.html.matchAll(re)].map((m) => m[1]).filter(Boolean).sort();
52493
- const candLangs = [...pair.cand.html.matchAll(re)].map((m) => m[1]).filter(Boolean).sort();
52598
+ const prodLangs = [...pair2.prod.html.matchAll(re)].map((m) => m[1]).filter(Boolean).sort();
52599
+ const candLangs = [...pair2.cand.html.matchAll(re)].map((m) => m[1]).filter(Boolean).sort();
52494
52600
  const prodSet = new Set(prodLangs);
52495
52601
  const candSet = new Set(candLangs);
52496
52602
  const onlyProd = [...prodSet].filter((l) => !candSet.has(l));
52497
52603
  if (onlyProd.length > 0) {
52498
52604
  return [
52499
52605
  {
52500
- id: `seo:hreflang-missing:${pair.key}`,
52606
+ id: `seo:hreflang-missing:${pair2.key}`,
52501
52607
  severity: "medium",
52502
52608
  category: "seo",
52503
- page: pair.key,
52609
+ page: pair2.key,
52504
52610
  check: "seo-deep-audit",
52505
- summary: `hreflang(s) ausentes em cand (${pair.key}): ${onlyProd.join(", ")}`
52611
+ summary: `hreflang(s) ausentes em cand (${pair2.key}): ${onlyProd.join(", ")}`
52506
52612
  }
52507
52613
  ];
52508
52614
  }
52509
52615
  return [];
52510
52616
  }
52511
- function checkJsonLd(pair) {
52617
+ function checkJsonLd(pair2) {
52512
52618
  const out = [];
52513
- const prodLd = extractJsonLd(pair.prod.html);
52514
- const candLd = extractJsonLd(pair.cand.html);
52619
+ const prodLd = extractJsonLd(pair2.prod.html);
52620
+ const candLd = extractJsonLd(pair2.cand.html);
52515
52621
  const productDiff = diffProductSchema(prodLd, candLd);
52516
52622
  if (productDiff.prodOnly) {
52517
52623
  out.push({
52518
- id: `seo:jsonld-product-missing:${pair.key}`,
52624
+ id: `seo:jsonld-product-missing:${pair2.key}`,
52519
52625
  severity: "high",
52520
52626
  category: "seo",
52521
- page: pair.key,
52627
+ page: pair2.key,
52522
52628
  check: "seo-deep-audit",
52523
- summary: `Product JSON-LD sumiu em cand (${pair.key}) — rich snippet de produto será perdido`
52629
+ summary: `Product JSON-LD sumiu em cand (${pair2.key}) — rich snippet de produto será perdido`
52524
52630
  });
52525
52631
  } else if (productDiff.bothPresent) {
52526
52632
  if (productDiff.missingFieldsInCand.length > 0) {
52527
52633
  out.push({
52528
- id: `seo:jsonld-product-fields:${pair.key}`,
52634
+ id: `seo:jsonld-product-fields:${pair2.key}`,
52529
52635
  severity: "high",
52530
52636
  category: "seo",
52531
- page: pair.key,
52637
+ page: pair2.key,
52532
52638
  check: "seo-deep-audit",
52533
- summary: `Campos críticos do Product JSON-LD ausentes em cand (${pair.key}): ${productDiff.missingFieldsInCand.join(", ")}`
52639
+ summary: `Campos críticos do Product JSON-LD ausentes em cand (${pair2.key}): ${productDiff.missingFieldsInCand.join(", ")}`
52534
52640
  });
52535
52641
  }
52536
52642
  if (productDiff.changedFields.length > 0) {
52537
52643
  out.push({
52538
- id: `seo:jsonld-product-changed:${pair.key}`,
52644
+ id: `seo:jsonld-product-changed:${pair2.key}`,
52539
52645
  severity: "medium",
52540
52646
  category: "seo",
52541
- page: pair.key,
52647
+ page: pair2.key,
52542
52648
  check: "seo-deep-audit",
52543
- summary: `Campos do Product JSON-LD mudaram em ${pair.key}: ${productDiff.changedFields.map((c) => c.field).join(", ")}`,
52649
+ summary: `Campos do Product JSON-LD mudaram em ${pair2.key}: ${productDiff.changedFields.map((c) => c.field).join(", ")}`,
52544
52650
  details: productDiff.changedFields.map((c) => `• ${c.field}
52545
52651
  prod: ${JSON.stringify(c.prod)}
52546
52652
  cand: ${JSON.stringify(c.cand)}`).join(`
@@ -52551,32 +52657,32 @@ function checkJsonLd(pair) {
52551
52657
  const breadcrumbDiff = diffBreadcrumbSchema(prodLd, candLd);
52552
52658
  if (breadcrumbDiff.prodOnly) {
52553
52659
  out.push({
52554
- id: `seo:jsonld-breadcrumb-missing:${pair.key}`,
52660
+ id: `seo:jsonld-breadcrumb-missing:${pair2.key}`,
52555
52661
  severity: "medium",
52556
52662
  category: "seo",
52557
- page: pair.key,
52663
+ page: pair2.key,
52558
52664
  check: "seo-deep-audit",
52559
- summary: `BreadcrumbList JSON-LD sumiu em cand (${pair.key})`
52665
+ summary: `BreadcrumbList JSON-LD sumiu em cand (${pair2.key})`
52560
52666
  });
52561
52667
  } else if (breadcrumbDiff.bothPresent && breadcrumbDiff.prodItemCount !== breadcrumbDiff.candItemCount) {
52562
52668
  out.push({
52563
- id: `seo:jsonld-breadcrumb-count:${pair.key}`,
52669
+ id: `seo:jsonld-breadcrumb-count:${pair2.key}`,
52564
52670
  severity: "medium",
52565
52671
  category: "seo",
52566
- page: pair.key,
52672
+ page: pair2.key,
52567
52673
  check: "seo-deep-audit",
52568
- summary: `Breadcrumb itens divergem em ${pair.key}: prod=${breadcrumbDiff.prodItemCount}, cand=${breadcrumbDiff.candItemCount}`
52674
+ summary: `Breadcrumb itens divergem em ${pair2.key}: prod=${breadcrumbDiff.prodItemCount}, cand=${breadcrumbDiff.candItemCount}`
52569
52675
  });
52570
52676
  }
52571
52677
  const orgDiff = diffOrganizationSchema(prodLd, candLd);
52572
52678
  if (orgDiff.prodPresent && !orgDiff.candPresent) {
52573
52679
  out.push({
52574
- id: `seo:jsonld-organization-missing:${pair.key}`,
52680
+ id: `seo:jsonld-organization-missing:${pair2.key}`,
52575
52681
  severity: "low",
52576
52682
  category: "seo",
52577
- page: pair.key,
52683
+ page: pair2.key,
52578
52684
  check: "seo-deep-audit",
52579
- summary: `Organization JSON-LD sumiu em cand (${pair.key})`
52685
+ summary: `Organization JSON-LD sumiu em cand (${pair2.key})`
52580
52686
  });
52581
52687
  }
52582
52688
  return out;
@@ -52995,22 +53101,22 @@ function thirdPartyScriptsParity(ctx) {
52995
53101
  const { pairs } = pairCaptures(ctx.prodPages, ctx.candPages);
52996
53102
  const issues = [];
52997
53103
  let pairsChecked = 0;
52998
- for (const pair of pairs) {
52999
- if (pair.prod.network.length === 0 && pair.cand.network.length === 0)
53104
+ for (const pair2 of pairs) {
53105
+ if (pair2.prod.network.length === 0 && pair2.cand.network.length === 0)
53000
53106
  continue;
53001
53107
  pairsChecked++;
53002
- const prodOrigins = thirdPartyOrigins(pair.prod);
53003
- const candOrigins = thirdPartyOrigins(pair.cand);
53108
+ const prodOrigins = thirdPartyOrigins(pair2.prod);
53109
+ const candOrigins = thirdPartyOrigins(pair2.cand);
53004
53110
  const missing = [...prodOrigins].filter((o) => !candOrigins.has(o)).sort();
53005
53111
  const added = [...candOrigins].filter((o) => !prodOrigins.has(o)).sort();
53006
53112
  if (missing.length > 0) {
53007
53113
  issues.push({
53008
- id: `3p-scripts:missing:${pair.key}`,
53114
+ id: `3p-scripts:missing:${pair2.key}`,
53009
53115
  severity: "high",
53010
53116
  category: "network",
53011
- page: pair.key,
53117
+ page: pair2.key,
53012
53118
  check: "third-party-scripts-parity",
53013
- summary: `${missing.length} origem(ns) de terceiro presente(s) em prod mas ausente(s) no candidato em ${pair.key}`,
53119
+ summary: `${missing.length} origem(ns) de terceiro presente(s) em prod mas ausente(s) no candidato em ${pair2.key}`,
53014
53120
  details: missing.join(`
53015
53121
  `),
53016
53122
  suggestedFix: "Confirme se o script foi migrado deliberadamente ou se a tag (GTM, pixel, chat, avaliações, etc.) foi perdida na porta."
@@ -53018,12 +53124,12 @@ function thirdPartyScriptsParity(ctx) {
53018
53124
  }
53019
53125
  if (added.length > 0) {
53020
53126
  issues.push({
53021
- id: `3p-scripts:added:${pair.key}`,
53127
+ id: `3p-scripts:added:${pair2.key}`,
53022
53128
  severity: "low",
53023
53129
  category: "network",
53024
- page: pair.key,
53130
+ page: pair2.key,
53025
53131
  check: "third-party-scripts-parity",
53026
- summary: `${added.length} origem(ns) de terceiro nova(s) no candidato (ausente em prod) em ${pair.key}`,
53132
+ summary: `${added.length} origem(ns) de terceiro nova(s) no candidato (ausente em prod) em ${pair2.key}`,
53027
53133
  details: added.join(`
53028
53134
  `),
53029
53135
  inconclusive: true
@@ -53551,17 +53657,17 @@ async function visualRegressionKeyframes(ctx) {
53551
53657
  let llmCallsUsed = 0;
53552
53658
  const cache = ctx.cacheDir && !ctx.noCache ? readCache(ctx.cacheDir) : {};
53553
53659
  const prepared = [];
53554
- for (const pair of pairs) {
53555
- if (!existsSync9(pair.prod.screenshotPath) || !existsSync9(pair.cand.screenshotPath)) {
53660
+ for (const pair2 of pairs) {
53661
+ if (!existsSync9(pair2.prod.screenshotPath) || !existsSync9(pair2.cand.screenshotPath)) {
53556
53662
  continue;
53557
53663
  }
53558
- const heatmapName = `diff-${pair.viewport}-${basename(pair.key.replace(/[/:]/g, "_"))}.png`;
53664
+ const heatmapName = `diff-${pair2.viewport}-${basename(pair2.key.replace(/[/:]/g, "_"))}.png`;
53559
53665
  const heatmapPath = join12(diffDir, heatmapName);
53560
53666
  const preflightIssues = [];
53561
53667
  let pctDiff = 0;
53562
53668
  let heatmapWritten = false;
53563
53669
  try {
53564
- const r = diffScreenshots(pair.prod.screenshotPath, pair.cand.screenshotPath, heatmapPath, {
53670
+ const r = diffScreenshots(pair2.prod.screenshotPath, pair2.cand.screenshotPath, heatmapPath, {
53565
53671
  maxPctDiff: 999,
53566
53672
  threshold: PIXEL_THRESHOLD
53567
53673
  });
@@ -53569,16 +53675,16 @@ async function visualRegressionKeyframes(ctx) {
53569
53675
  heatmapWritten = true;
53570
53676
  } catch (err) {
53571
53677
  preflightIssues.push({
53572
- id: `visual:error:${pair.key}`,
53678
+ id: `visual:error:${pair2.key}`,
53573
53679
  severity: "low",
53574
53680
  category: "visual",
53575
- page: pair.key,
53681
+ page: pair2.key,
53576
53682
  check: "visual-regression-keyframes",
53577
- summary: `Falha ao comparar screenshots em ${pair.key}: ${err.message}`
53683
+ summary: `Falha ao comparar screenshots em ${pair2.key}: ${err.message}`
53578
53684
  });
53579
53685
  }
53580
- const prodSnapshot = pair.prod.html ? snapshotDom(pair.prod.html) : null;
53581
- const candSnapshot = pair.cand.html ? snapshotDom(pair.cand.html) : null;
53686
+ const prodSnapshot = pair2.prod.html ? snapshotDom(pair2.prod.html) : null;
53687
+ const candSnapshot = pair2.cand.html ? snapshotDom(pair2.cand.html) : null;
53582
53688
  const prodSections = prodSnapshot?.decoSectionsRendered ?? [];
53583
53689
  const candSections = candSnapshot?.decoSectionsRendered ?? [];
53584
53690
  const candSet = new Set(candSections);
@@ -53592,7 +53698,7 @@ async function visualRegressionKeyframes(ctx) {
53592
53698
  let cacheHit;
53593
53699
  if (ctx.cacheDir && !ctx.noCache) {
53594
53700
  try {
53595
- hash2 = hashScreenshotPair(pair.prod.screenshotPath, pair.cand.screenshotPath, LLM_PROMPT_VERSION);
53701
+ hash2 = hashScreenshotPair(pair2.prod.screenshotPath, pair2.cand.screenshotPath, LLM_PROMPT_VERSION);
53596
53702
  const entry = getCacheEntry(cache, hash2, LLM_PROMPT_VERSION);
53597
53703
  if (entry) {
53598
53704
  cacheHit = {
@@ -53604,7 +53710,7 @@ async function visualRegressionKeyframes(ctx) {
53604
53710
  } catch {}
53605
53711
  }
53606
53712
  prepared.push({
53607
- pair,
53713
+ pair: pair2,
53608
53714
  heatmapPath,
53609
53715
  heatmapWritten,
53610
53716
  pctDiff,
@@ -53878,8 +53984,8 @@ function webVitalsMobile(ctx) {
53878
53984
  const { pairs } = pairCaptures(ctx.prodPages, ctx.candPages);
53879
53985
  const mobilePairs = pairs.filter((p) => p.viewport === "mobile");
53880
53986
  const issues = [];
53881
- for (const pair of mobilePairs) {
53882
- const diff = diffVitals(pair.prod.vitals, pair.cand.vitals, DEFAULT_THRESHOLDS);
53987
+ for (const pair2 of mobilePairs) {
53988
+ const diff = diffVitals(pair2.prod.vitals, pair2.cand.vitals, DEFAULT_THRESHOLDS);
53883
53989
  if (!diff.anyFailed)
53884
53990
  continue;
53885
53991
  const failed = ["lcp", "fcp", "ttfb", "inp", "cls"].filter((k) => !diff[k].passed);
@@ -53889,16 +53995,16 @@ function webVitalsMobile(ctx) {
53889
53995
  }).join(`
53890
53996
  `);
53891
53997
  issues.push({
53892
- id: `vitals:${pair.key}`,
53998
+ id: `vitals:${pair2.key}`,
53893
53999
  severity: "high",
53894
54000
  category: "performance",
53895
- page: pair.key,
54001
+ page: pair2.key,
53896
54002
  check: "web-vitals-mobile",
53897
- summary: `Regressão Web Vitals mobile em ${pair.key}: ${failed.map((f) => f.toUpperCase()).join(", ")}`,
54003
+ summary: `Regressão Web Vitals mobile em ${pair2.key}: ${failed.map((f) => f.toUpperCase()).join(", ")}`,
53898
54004
  details,
53899
54005
  evidence: [
53900
- { kind: "screenshot", path: pair.prod.screenshotPath, label: "prod" },
53901
- { kind: "screenshot", path: pair.cand.screenshotPath, label: "cand" }
54006
+ { kind: "screenshot", path: pair2.prod.screenshotPath, label: "prod" },
54007
+ { kind: "screenshot", path: pair2.cand.screenshotPath, label: "cand" }
53902
54008
  ]
53903
54009
  });
53904
54010
  }
@@ -53953,6 +54059,7 @@ var ALL_CHECKS = [
53953
54059
  serverFnHoverFlood,
53954
54060
  faviconParity,
53955
54061
  fontParity,
54062
+ contentStructureParity,
53956
54063
  ssrNoJs,
53957
54064
  navLinksHealth,
53958
54065
  redirectsParity,
@@ -53993,6 +54100,7 @@ var ALL_CHECKS_BY_NAME = {
53993
54100
  "serverfn-hover-flood": serverFnHoverFlood,
53994
54101
  "favicon-parity": faviconParity,
53995
54102
  "font-parity": fontParity,
54103
+ "content-structure": contentStructureParity,
53996
54104
  "ssr-no-js": ssrNoJs,
53997
54105
  "nav-links-health": navLinksHealth,
53998
54106
  "redirects-parity": redirectsParity,
@@ -54114,7 +54222,7 @@ var MODULES = {
54114
54222
  },
54115
54223
  html: {
54116
54224
  name: "html",
54117
- description: "HTML structure — structural diff, lazy sections, image loading health, missing picture dimensions",
54225
+ description: "HTML structure — structural diff, lazy sections, image loading health, missing picture dimensions, editorial content structure",
54118
54226
  checks: [
54119
54227
  "html-structural-diff",
54120
54228
  "lazy-section-presence",
@@ -54122,7 +54230,8 @@ var MODULES = {
54122
54230
  "picture-missing-dims",
54123
54231
  "font-parity",
54124
54232
  "ssr-no-js",
54125
- "section-order-parity"
54233
+ "section-order-parity",
54234
+ "content-structure"
54126
54235
  ],
54127
54236
  flows: ["homepage", "plp", "pdp"]
54128
54237
  },
@@ -55088,7 +55197,7 @@ function renderVitalsPanel(run) {
55088
55197
  continue;
55089
55198
  for (const p of fc.pages) {
55090
55199
  const v = p.vitals;
55091
- const pageKey = humanKey(`${pathOf4(p.url)}::${p.viewport}`);
55200
+ const pageKey = humanKey(`${pathOf5(p.url)}::${p.viewport}`);
55092
55201
  const sideLabel = p.side;
55093
55202
  rows.push({ page: pageKey, viewport: p.viewport, metric: "LCP", prod: 0, cand: 0 });
55094
55203
  rows.push({ page: pageKey, viewport: p.viewport, metric: "FCP", prod: 0, cand: 0 });
@@ -55103,7 +55212,7 @@ function renderVitalsPanel(run) {
55103
55212
  if (fc.viewport !== "mobile")
55104
55213
  continue;
55105
55214
  for (const p of fc.pages) {
55106
- const key = pathOf4(p.url);
55215
+ const key = pathOf5(p.url);
55107
55216
  const entry = pageVitals.get(key) ?? { viewport: p.viewport };
55108
55217
  if (p.side === "prod") {
55109
55218
  entry.prod = p.vitals;
@@ -55286,7 +55395,7 @@ function formatVital2(v, unit) {
55286
55395
  return v.toFixed(3);
55287
55396
  return `${v.toFixed(0)}ms`;
55288
55397
  }
55289
- function pathOf4(url) {
55398
+ function pathOf5(url) {
55290
55399
  try {
55291
55400
  return new URL(url).pathname || "/";
55292
55401
  } catch {
@@ -55303,7 +55412,7 @@ function renderPagesTable2(run) {
55303
55412
  continue;
55304
55413
  seen.add(k);
55305
55414
  rows.push({
55306
- key: humanKey(`${pathOf4(p.url)}::${p.viewport}`),
55415
+ key: humanKey(`${pathOf5(p.url)}::${p.viewport}`),
55307
55416
  viewport: p.viewport,
55308
55417
  side: p.side,
55309
55418
  status: String(p.status),
@@ -55341,7 +55450,7 @@ function renderNetworkPanel(run) {
55341
55450
  baseUrl = p.url;
55342
55451
  candEntries.push(...p.network);
55343
55452
  if (p.network.length > 0) {
55344
- perPage.push({ label: `${pathOf4(p.url)} · ${p.viewport}`, entries: p.network });
55453
+ perPage.push({ label: `${pathOf5(p.url)} · ${p.viewport}`, entries: p.network });
55345
55454
  }
55346
55455
  }
55347
55456
  }
@@ -55910,7 +56019,7 @@ function buildSideBySidePairs(run) {
55910
56019
  if (fc.side !== side || fc.viewport !== "mobile")
55911
56020
  continue;
55912
56021
  for (const p of fc.pages) {
55913
- const path = pathOf4(p.url);
56022
+ const path = pathOf5(p.url);
55914
56023
  if (path === "/" || path === "")
55915
56024
  continue;
55916
56025
  const role = classifyPath(path, !seenNonHome);
@@ -66688,14 +66797,14 @@ function pairedPathMismatches(prodPages, candPages) {
66688
66797
  const prod = prodPages.find((p) => p.pairKey === cand.pairKey);
66689
66798
  if (!prod)
66690
66799
  continue;
66691
- const prodPath = pathOf5(prod.url);
66692
- const candPath = pathOf5(cand.url);
66800
+ const prodPath = pathOf6(prod.url);
66801
+ const candPath = pathOf6(cand.url);
66693
66802
  if (prodPath && candPath && prodPath !== candPath)
66694
66803
  out.push(`${prodPath} → ${candPath}`);
66695
66804
  }
66696
66805
  return [...new Set(out)];
66697
66806
  }
66698
- function pathOf5(raw) {
66807
+ function pathOf6(raw) {
66699
66808
  try {
66700
66809
  return new URL(raw).pathname;
66701
66810
  } catch {
@@ -67767,11 +67876,11 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
67767
67876
  const visualPaths = explicitPaths ?? (await discoverPagesFromSitemap(opts.prod, { sampleSize: visualPagesLimit })).all.map((p) => ({ prod: p.path, cand: p.path }));
67768
67877
  const tasks = [];
67769
67878
  for (const viewport of viewports) {
67770
- for (const pair of visualPaths) {
67879
+ for (const pair2 of visualPaths) {
67771
67880
  for (const side of ["prod", "cand"]) {
67772
67881
  tasks.push({
67773
- path: side === "prod" ? pair.prod : pair.cand,
67774
- pairKey: pair.prod,
67882
+ path: side === "prod" ? pair2.prod : pair2.cand,
67883
+ pairKey: pair2.prod,
67775
67884
  viewport,
67776
67885
  side
67777
67886
  });
@@ -68889,7 +68998,7 @@ function extractVitalsSlice(run) {
68889
68998
  for (const p of fc.pages) {
68890
68999
  if (!p.vitals)
68891
69000
  continue;
68892
- const k = `${p.side}::${p.viewport}::${pathOf6(p.url)}`;
69001
+ const k = `${p.side}::${p.viewport}::${pathOf7(p.url)}`;
68893
69002
  out[k] = p.vitalsFullPage ? { ...p.vitals, fullPage: p.vitalsFullPage } : p.vitals;
68894
69003
  }
68895
69004
  }
@@ -68934,8 +69043,8 @@ function extractSideBySideSlice(run) {
68934
69043
  for (const p of fc.pages) {
68935
69044
  if (p.side !== "prod")
68936
69045
  continue;
68937
- const candPath = pathOf6(p.url);
68938
- const cand = fc.pages.find((q) => q.side === "cand" && pathOf6(q.url) === candPath && q.viewport === p.viewport);
69046
+ const candPath = pathOf7(p.url);
69047
+ const cand = fc.pages.find((q) => q.side === "cand" && pathOf7(q.url) === candPath && q.viewport === p.viewport);
68939
69048
  if (!cand)
68940
69049
  continue;
68941
69050
  pairs.push({
@@ -68948,7 +69057,7 @@ function extractSideBySideSlice(run) {
68948
69057
  }
68949
69058
  return pairs;
68950
69059
  }
68951
- function pathOf6(url) {
69060
+ function pathOf7(url) {
68952
69061
  try {
68953
69062
  return new URL(url).pathname || "/";
68954
69063
  } catch {
@@ -69280,9 +69389,9 @@ function lighthouseScores(ctx) {
69280
69389
  const start = Date.now();
69281
69390
  const { pairs } = pairCaptures(ctx.prodPages, ctx.candPages);
69282
69391
  const issues = [];
69283
- for (const pair of pairs) {
69284
- const prod = pair.prod.lhScores;
69285
- const cand = pair.cand.lhScores;
69392
+ for (const pair2 of pairs) {
69393
+ const prod = pair2.prod.lhScores;
69394
+ const cand = pair2.cand.lhScores;
69286
69395
  if (!prod || !cand)
69287
69396
  continue;
69288
69397
  for (const { key: key2, label } of CATEGORIES) {
@@ -69294,12 +69403,12 @@ function lighthouseScores(ctx) {
69294
69403
  if (delta >= -REGRESSION_DELTA)
69295
69404
  continue;
69296
69405
  issues.push({
69297
- id: `lh-score:${key2}:${pair.key}`,
69406
+ id: `lh-score:${key2}:${pair2.key}`,
69298
69407
  severity: -delta >= 10 ? "high" : "medium",
69299
69408
  category: key2 === "seo" ? "seo" : key2 === "accessibility" ? "a11y" : "performance",
69300
- page: pair.key,
69409
+ page: pair2.key,
69301
69410
  check: "lighthouse-scores",
69302
- summary: `${label} regrediu em ${pair.key}: cand ${c} vs prod ${p} (${delta})`,
69411
+ summary: `${label} regrediu em ${pair2.key}: cand ${c} vs prod ${p} (${delta})`,
69303
69412
  details: `Objetivo da migração é igual ou melhor. ${label}: prod=${p}, cand=${c}. Recupere pelo menos o nível de prod.`
69304
69413
  });
69305
69414
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decocms/parity",
3
- "version": "0.29.0",
3
+ "version": "0.29.1",
4
4
  "description": "E2E parity validator for site migrations. Compares prod vs cand and reports UI, functional, SEO, visual, and Web Vitals deltas with an LLM-ranked HTML report.",
5
5
  "type": "module",
6
6
  "license": "MIT",