@decocms/parity 0.35.32 → 0.35.33
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/CHANGELOG.md +15 -0
- package/dist/cli.js +87 -17
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -81,6 +81,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
|
|
|
81
81
|
|
|
82
82
|
### Fixed
|
|
83
83
|
|
|
84
|
+
* **A dev-server candidate no longer fails the run on numbers the dev server itself produces.**
|
|
85
|
+
`cache-coverage` ("22 cacheable requests are not cached", hit rate down 54 points),
|
|
86
|
+
`network-summary-delta` (request volume 7x prod) and `web-vitals-mobile` were filed live against
|
|
87
|
+
a Vite dev server, while the `cand-dev-server` caveat said those numbers were not representative.
|
|
88
|
+
When cand is on a loopback host AND its captures show the dev toolchain (`/@vite/client`,
|
|
89
|
+
`/@react-refresh`, `/@id/`, `/node_modules/.vite/`, Next/webpack HMR, raw `/src/*.tsx` requests,
|
|
90
|
+
or the dev client tag in the HTML), the cand-derived findings of those checks, of
|
|
91
|
+
`lighthouse-opportunities`, of `lighthouse-scores` (performance category only) and of
|
|
92
|
+
`cookie-cep-modal-cls` are `inconclusive`: kept with a note, out of the score, check `warn`
|
|
93
|
+
rather than `fail`, pairs counted as inconclusive. A request that 404s, a lost deco section, an
|
|
94
|
+
accessibility score drop etc. stay live. A production build served on localhost is NOT a dev
|
|
95
|
+
server and keeps every finding (it now gets an info `cand-local-build` caveat instead of
|
|
96
|
+
`cand-dev-server`). The verdict is derived from the recorded captures, so `replay` / `--golden`
|
|
97
|
+
agree; no new recorded field.
|
|
98
|
+
|
|
84
99
|
* **The compared / passed counts agree across checks again.** Three changes that each assumed
|
|
85
100
|
the others were already in: a pair a not-captured guard (`withCapturedPairs`) withholds now
|
|
86
101
|
lands in the check's `inconclusive` count (a check that does not count stays uncounted);
|
package/dist/cli.js
CHANGED
|
@@ -78011,6 +78011,44 @@ function buildCacheReport(entries, baseUrl) {
|
|
|
78011
78011
|
};
|
|
78012
78012
|
}
|
|
78013
78013
|
|
|
78014
|
+
// src/checks/lib/dev-server.ts
|
|
78015
|
+
var DEV_URL_MARKERS = [
|
|
78016
|
+
/\/@vite\/client/,
|
|
78017
|
+
/\/@react-refresh/,
|
|
78018
|
+
/\/@id\//,
|
|
78019
|
+
/\/@fs\//,
|
|
78020
|
+
/\/node_modules\/\.vite\//,
|
|
78021
|
+
/\/__vite_ping/,
|
|
78022
|
+
/\/_next\/webpack-hmr/,
|
|
78023
|
+
/\/_next\/static\/development\//,
|
|
78024
|
+
/\/webpack-dev-server\//,
|
|
78025
|
+
/\/sockjs-node\//,
|
|
78026
|
+
/\.hot-update\.(json|js)(\?|$)/,
|
|
78027
|
+
/\/src\/[^?#]*\.(tsx|ts|jsx)(\?|#|$)/
|
|
78028
|
+
];
|
|
78029
|
+
var DEV_HTML_MARKERS = [/\/@vite\/client/, /\/@react-refresh/, /\/_next\/webpack-hmr/];
|
|
78030
|
+
function isCandDevServer(candPages, candIsProduction = false) {
|
|
78031
|
+
if (candIsProduction)
|
|
78032
|
+
return false;
|
|
78033
|
+
const host = siteHost(candPages);
|
|
78034
|
+
if (!host || !isLoopbackHost(host))
|
|
78035
|
+
return false;
|
|
78036
|
+
return candPages.some((p) => {
|
|
78037
|
+
const html = p.html ?? "";
|
|
78038
|
+
return (p.network ?? []).some((e) => DEV_URL_MARKERS.some((re) => re.test(e.url))) || DEV_HTML_MARKERS.some((re) => re.test(html));
|
|
78039
|
+
});
|
|
78040
|
+
}
|
|
78041
|
+
var DEV_SERVER_NOTE = "Medido contra um dev server (cand-dev-server): sem minificação, sem cache de edge, módulos sem bundle. Este número não é evidência sobre a migração — reconfirme contra um build de produção.";
|
|
78042
|
+
function asDevServerInconclusive(issue) {
|
|
78043
|
+
return {
|
|
78044
|
+
...issue,
|
|
78045
|
+
inconclusive: true,
|
|
78046
|
+
details: issue.details ? `${DEV_SERVER_NOTE}
|
|
78047
|
+
|
|
78048
|
+
${issue.details}` : DEV_SERVER_NOTE
|
|
78049
|
+
};
|
|
78050
|
+
}
|
|
78051
|
+
|
|
78014
78052
|
// src/checks/cache-coverage.ts
|
|
78015
78053
|
function cacheCoverage(ctx) {
|
|
78016
78054
|
const start = Date.now();
|
|
@@ -78075,14 +78113,27 @@ Cache-Control: ${opp.entry.cacheControl ?? "(missing)"}
|
|
|
78075
78113
|
Status: ${opp.entry.status}`
|
|
78076
78114
|
});
|
|
78077
78115
|
}
|
|
78078
|
-
const
|
|
78116
|
+
const devServer = isCandDevServer(ctx.candPages, ctx.candIsProduction);
|
|
78117
|
+
const reported = devServer ? issues.length > 0 ? issues.map(asDevServerInconclusive) : [
|
|
78118
|
+
{
|
|
78119
|
+
id: "cache:dev-server-not-judged",
|
|
78120
|
+
severity: "low",
|
|
78121
|
+
inconclusive: true,
|
|
78122
|
+
category: "performance",
|
|
78123
|
+
check: "cache-coverage",
|
|
78124
|
+
summary: "Cache de cand não julgado: dev server (cand-dev-server)",
|
|
78125
|
+
details: DEV_SERVER_NOTE
|
|
78126
|
+
}
|
|
78127
|
+
] : issues;
|
|
78128
|
+
const live = reported.filter((i) => !i.inconclusive);
|
|
78129
|
+
const status = live.some((i) => i.severity === "high") ? "fail" : reported.length > 0 ? "warn" : "pass";
|
|
78079
78130
|
return {
|
|
78080
78131
|
name: "cache-coverage",
|
|
78081
78132
|
status,
|
|
78082
78133
|
severity: "high",
|
|
78083
78134
|
durationMs: Date.now() - start,
|
|
78084
|
-
summary: `Cache hit rate cand: ${(report.hitRate * 100).toFixed(0)}% · ${oppCount} oportunidade(s) (${(oppBytes / 1024).toFixed(0)} KB)`,
|
|
78085
|
-
issues,
|
|
78135
|
+
summary: `Cache hit rate cand: ${(report.hitRate * 100).toFixed(0)}% · ${oppCount} oportunidade(s) (${(oppBytes / 1024).toFixed(0)} KB)${devServer ? " · dev server: inconclusivo" : ""}`,
|
|
78136
|
+
issues: reported,
|
|
78086
78137
|
data: {
|
|
78087
78138
|
hitRate: report.hitRate,
|
|
78088
78139
|
prodHitRate: prodReport?.hitRate,
|
|
@@ -78943,14 +78994,15 @@ function cookieCepModalCls(ctx) {
|
|
|
78943
78994
|
}
|
|
78944
78995
|
}
|
|
78945
78996
|
}
|
|
78946
|
-
const
|
|
78997
|
+
const reported = isCandDevServer(ctx.candPages, ctx.candIsProduction) ? issues.map(asDevServerInconclusive) : issues;
|
|
78998
|
+
const status = reported.some((i) => !i.inconclusive && (i.severity === "critical" || i.severity === "high")) ? "fail" : reported.length > 0 ? "warn" : "pass";
|
|
78947
78999
|
return {
|
|
78948
79000
|
name: "cookie-cep-modal-cls",
|
|
78949
79001
|
status,
|
|
78950
79002
|
severity: "high",
|
|
78951
79003
|
durationMs: Date.now() - start,
|
|
78952
|
-
summary: `${
|
|
78953
|
-
issues
|
|
79004
|
+
summary: `${reported.length} issue(s)`,
|
|
79005
|
+
issues: reported
|
|
78954
79006
|
};
|
|
78955
79007
|
}
|
|
78956
79008
|
function keyFor(p) {
|
|
@@ -80576,13 +80628,14 @@ function networkSummaryDelta(ctx) {
|
|
|
80576
80628
|
const start = Date.now();
|
|
80577
80629
|
const { pairs } = pairCaptures(ctx.prodPages, ctx.candPages);
|
|
80578
80630
|
const issues = [];
|
|
80631
|
+
const devServer = isCandDevServer(ctx.candPages, ctx.candIsProduction);
|
|
80579
80632
|
for (const pair of pairs) {
|
|
80580
80633
|
const diff = diffNetwork(pair.prod.network, pair.cand.network, {
|
|
80581
80634
|
ignorePatterns: ctx.ignore.ignoreRequestPatterns,
|
|
80582
80635
|
maxTotalPct: TOLERANCES.network.maxTotalPct.value
|
|
80583
80636
|
});
|
|
80584
80637
|
if (diff.anyFailed) {
|
|
80585
|
-
|
|
80638
|
+
const volume = {
|
|
80586
80639
|
id: `network:volume:${pair.key}`,
|
|
80587
80640
|
severity: "medium",
|
|
80588
80641
|
category: "network",
|
|
@@ -80596,7 +80649,8 @@ function networkSummaryDelta(ctx) {
|
|
|
80596
80649
|
`URLs apenas em cand (${diff.urls.onlyCand.length} primeiras 5): ${diff.urls.onlyCand.slice(0, 5).join(", ")}`
|
|
80597
80650
|
].join(`
|
|
80598
80651
|
`)
|
|
80599
|
-
}
|
|
80652
|
+
};
|
|
80653
|
+
issues.push(devServer ? asDevServerInconclusive(volume) : volume);
|
|
80600
80654
|
}
|
|
80601
80655
|
const prodApi = new Set(diff.prod.decoSectionsHit);
|
|
80602
80656
|
for (const sec of prodApi) {
|
|
@@ -90906,6 +90960,7 @@ function webVitalsMobile(ctx) {
|
|
|
90906
90960
|
const { pairs } = pairCaptures(ctx.prodPages, ctx.candPages);
|
|
90907
90961
|
const mobilePairs = pairs.filter((p) => p.viewport === "mobile");
|
|
90908
90962
|
const issues = [];
|
|
90963
|
+
const devServer = isCandDevServer(ctx.candPages, ctx.candIsProduction);
|
|
90909
90964
|
for (const pair of mobilePairs) {
|
|
90910
90965
|
const diff = diffVitals(pair.prod.vitals, pair.cand.vitals, DEFAULT_THRESHOLDS);
|
|
90911
90966
|
if (!diff.anyFailed)
|
|
@@ -90916,7 +90971,7 @@ function webVitalsMobile(ctx) {
|
|
|
90916
90971
|
return `${k.toUpperCase()}: prod=${fmt(v.prod)}, cand=${fmt(v.cand)} (${v.reason})`;
|
|
90917
90972
|
}).join(`
|
|
90918
90973
|
`);
|
|
90919
|
-
|
|
90974
|
+
const regression = {
|
|
90920
90975
|
id: `vitals:${pair.key}`,
|
|
90921
90976
|
severity: "high",
|
|
90922
90977
|
category: "performance",
|
|
@@ -90928,11 +90983,13 @@ function webVitalsMobile(ctx) {
|
|
|
90928
90983
|
{ kind: "screenshot", path: pair.prod.screenshotPath, label: "prod" },
|
|
90929
90984
|
{ kind: "screenshot", path: pair.cand.screenshotPath, label: "cand" }
|
|
90930
90985
|
]
|
|
90931
|
-
}
|
|
90986
|
+
};
|
|
90987
|
+
issues.push(devServer ? asDevServerInconclusive(regression) : regression);
|
|
90932
90988
|
}
|
|
90989
|
+
const live = issues.filter((i) => !i.inconclusive);
|
|
90933
90990
|
return {
|
|
90934
90991
|
name: "web-vitals-mobile",
|
|
90935
|
-
status:
|
|
90992
|
+
status: live.length > 0 ? "fail" : issues.length > 0 ? "warn" : "pass",
|
|
90936
90993
|
severity: "high",
|
|
90937
90994
|
durationMs: Date.now() - start,
|
|
90938
90995
|
summary: `${mobilePairs.length} página(s) mobile, ${issues.length} regressão(ões)`,
|
|
@@ -119463,7 +119520,16 @@ function isColdCandidate(loads) {
|
|
|
119463
119520
|
// src/engine/run-context.ts
|
|
119464
119521
|
function detectRunCaveats(input) {
|
|
119465
119522
|
const out = [];
|
|
119466
|
-
|
|
119523
|
+
const candHost = siteHost(input.candPages);
|
|
119524
|
+
const localBuild = isLocalhost(input.candUrl) && !input.candIsProduction && candHost !== null && isLoopbackHost(candHost) && input.candPages.some((p) => (p.network?.length ?? 0) > 0) && !isCandDevServer(input.candPages, input.candIsProduction);
|
|
119525
|
+
if (localBuild) {
|
|
119526
|
+
out.push({
|
|
119527
|
+
id: "cand-local-build",
|
|
119528
|
+
level: "info",
|
|
119529
|
+
summary: "Candidato servido localmente, sem sinais de dev server",
|
|
119530
|
+
detail: "Nenhum marcador de dev server (HMR, módulos sem bundle) nas capturas: cache, volume de requests e vitals foram julgados como num host remoto. Se este local é na verdade um dev server, os números de performance não são representativos."
|
|
119531
|
+
});
|
|
119532
|
+
} else if (isLocalhost(input.candUrl)) {
|
|
119467
119533
|
out.push({
|
|
119468
119534
|
id: "cand-dev-server",
|
|
119469
119535
|
level: "warn",
|
|
@@ -125812,9 +125878,10 @@ function lighthouseOpportunities(ctx) {
|
|
|
125812
125878
|
}
|
|
125813
125879
|
const deltas = diffOpportunities(ctx.prodPages, ctx.candPages);
|
|
125814
125880
|
const reportable = deltas.filter((d) => opportunitySeverity(d.cand.savingsMs) !== "low");
|
|
125881
|
+
const devServer = isCandDevServer(ctx.candPages, ctx.candIsProduction);
|
|
125815
125882
|
const issues = reportable.map((d) => {
|
|
125816
125883
|
const sev = opportunitySeverity(d.cand.savingsMs);
|
|
125817
|
-
|
|
125884
|
+
const issue = {
|
|
125818
125885
|
id: `lh:${d.cand.id}`,
|
|
125819
125886
|
severity: d.regression && sev === "medium" ? "high" : sev,
|
|
125820
125887
|
category: "performance",
|
|
@@ -125822,6 +125889,7 @@ function lighthouseOpportunities(ctx) {
|
|
|
125822
125889
|
summary: `${d.cand.title} — ${fmtMs2(d.cand.savingsMs)} recuperáveis${d.regression ? " (regressão: prod não tem, ou tem bem menos)" : ""}`,
|
|
125823
125890
|
details: buildDetails(d.cand, d.prod, d.regression)
|
|
125824
125891
|
};
|
|
125892
|
+
return devServer ? asDevServerInconclusive(issue) : issue;
|
|
125825
125893
|
});
|
|
125826
125894
|
const dropped = deltas.length - reportable.length;
|
|
125827
125895
|
const worst = reportable[0]?.cand;
|
|
@@ -125833,7 +125901,7 @@ function lighthouseOpportunities(ctx) {
|
|
|
125833
125901
|
].filter(Boolean);
|
|
125834
125902
|
return {
|
|
125835
125903
|
name,
|
|
125836
|
-
status: issues.length > 0 ? "
|
|
125904
|
+
status: issues.some((i) => !i.inconclusive) ? "fail" : issues.length > 0 ? "warn" : "pass",
|
|
125837
125905
|
severity: "medium",
|
|
125838
125906
|
durationMs: Date.now() - start,
|
|
125839
125907
|
summary: summaryParts.join(", "),
|
|
@@ -125876,6 +125944,7 @@ function lighthouseScores(ctx) {
|
|
|
125876
125944
|
const start = Date.now();
|
|
125877
125945
|
const { pairs } = pairCaptures(ctx.prodPages, ctx.candPages);
|
|
125878
125946
|
const issues = [];
|
|
125947
|
+
const devServer = isCandDevServer(ctx.candPages, ctx.candIsProduction);
|
|
125879
125948
|
for (const pair of pairs) {
|
|
125880
125949
|
const prod = pair.prod.lhScores;
|
|
125881
125950
|
const cand = pair.cand.lhScores;
|
|
@@ -125889,7 +125958,7 @@ function lighthouseScores(ctx) {
|
|
|
125889
125958
|
const delta = c - p;
|
|
125890
125959
|
if (delta >= -REGRESSION_DELTA)
|
|
125891
125960
|
continue;
|
|
125892
|
-
|
|
125961
|
+
const regression = {
|
|
125893
125962
|
id: `lh-score:${key}:${pair.key}`,
|
|
125894
125963
|
severity: -delta >= TOLERANCES.vitals.lighthouseScoreHighDrop.value ? "high" : "medium",
|
|
125895
125964
|
category: key === "seo" ? "seo" : key === "accessibility" ? "a11y" : "performance",
|
|
@@ -125897,13 +125966,14 @@ function lighthouseScores(ctx) {
|
|
|
125897
125966
|
check: "lighthouse-scores",
|
|
125898
125967
|
summary: `${label} regrediu em ${pair.key}: cand ${c} vs prod ${p} (${delta})`,
|
|
125899
125968
|
details: `Objetivo da migração é igual ou melhor. ${label}: prod=${p}, cand=${c}. Recupere pelo menos o nível de prod.`
|
|
125900
|
-
}
|
|
125969
|
+
};
|
|
125970
|
+
issues.push(devServer && key === "performance" ? asDevServerInconclusive(regression) : regression);
|
|
125901
125971
|
}
|
|
125902
125972
|
}
|
|
125903
125973
|
const hasScores = pairs.some((p) => p.prod.lhScores && p.cand.lhScores);
|
|
125904
125974
|
return {
|
|
125905
125975
|
name: "lighthouse-scores",
|
|
125906
|
-
status: !hasScores ? "skipped" : issues.length > 0 ? "
|
|
125976
|
+
status: !hasScores ? "skipped" : issues.some((i) => !i.inconclusive) ? "fail" : issues.length > 0 ? "warn" : "pass",
|
|
125907
125977
|
severity: "medium",
|
|
125908
125978
|
durationMs: Date.now() - start,
|
|
125909
125979
|
summary: !hasScores ? "Sem scores Lighthouse (rode sem --no-lighthouse)" : `${pairs.length} página(s), ${issues.length} regressão(ões) de categoria`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decocms/parity",
|
|
3
|
-
"version": "0.35.
|
|
3
|
+
"version": "0.35.33",
|
|
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",
|