@decocms/parity 0.35.21 → 0.35.23
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 +19 -0
- package/dist/cli.js +1088 -235
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -15854,7 +15854,7 @@ var require_request = __commonJS(function(exports, module) {
|
|
|
15854
15854
|
var invalidPathRegex = /[^\u0021-\u00ff]/;
|
|
15855
15855
|
var kHandler = Symbol("handler");
|
|
15856
15856
|
|
|
15857
|
-
class
|
|
15857
|
+
class Request2 {
|
|
15858
15858
|
constructor(origin, {
|
|
15859
15859
|
path,
|
|
15860
15860
|
method,
|
|
@@ -16181,7 +16181,7 @@ var require_request = __commonJS(function(exports, module) {
|
|
|
16181
16181
|
request.headers.push(key, val);
|
|
16182
16182
|
}
|
|
16183
16183
|
}
|
|
16184
|
-
module.exports =
|
|
16184
|
+
module.exports = Request2;
|
|
16185
16185
|
});
|
|
16186
16186
|
|
|
16187
16187
|
// ../../node_modules/.bun/undici@7.25.0/node_modules/undici/lib/handler/wrap-handler.js
|
|
@@ -21565,7 +21565,7 @@ var require_client = __commonJS(function(exports, module) {
|
|
|
21565
21565
|
var util = require_util();
|
|
21566
21566
|
var { ClientStats } = require_stats();
|
|
21567
21567
|
var { channels } = require_diagnostics();
|
|
21568
|
-
var
|
|
21568
|
+
var Request2 = require_request();
|
|
21569
21569
|
var DispatcherBase = require_dispatcher_base();
|
|
21570
21570
|
var {
|
|
21571
21571
|
InvalidArgumentError,
|
|
@@ -21812,7 +21812,7 @@ var require_client = __commonJS(function(exports, module) {
|
|
|
21812
21812
|
this.once("connect", cb);
|
|
21813
21813
|
}
|
|
21814
21814
|
[kDispatch](opts, handler) {
|
|
21815
|
-
const request = new
|
|
21815
|
+
const request = new Request2(this[kUrl].origin, opts, handler);
|
|
21816
21816
|
this[kQueue].push(request);
|
|
21817
21817
|
if (this[kResuming]) {} else if (util.bodyLength(request.body) == null && util.isIterable(request.body)) {
|
|
21818
21818
|
this[kResuming] = 1;
|
|
@@ -30485,7 +30485,7 @@ var require_response = __commonJS(function(exports, module) {
|
|
|
30485
30485
|
var { isomorphicEncode, serializeJavascriptValueToJSONString } = require_infra();
|
|
30486
30486
|
var textEncoder = new TextEncoder("utf-8");
|
|
30487
30487
|
|
|
30488
|
-
class
|
|
30488
|
+
class Response2 {
|
|
30489
30489
|
#headers;
|
|
30490
30490
|
#state;
|
|
30491
30491
|
static error() {
|
|
@@ -30543,11 +30543,11 @@ var require_response = __commonJS(function(exports, module) {
|
|
|
30543
30543
|
initializeResponse(this, init, bodyWithType);
|
|
30544
30544
|
}
|
|
30545
30545
|
get type() {
|
|
30546
|
-
webidl.brandCheck(this,
|
|
30546
|
+
webidl.brandCheck(this, Response2);
|
|
30547
30547
|
return this.#state.type;
|
|
30548
30548
|
}
|
|
30549
30549
|
get url() {
|
|
30550
|
-
webidl.brandCheck(this,
|
|
30550
|
+
webidl.brandCheck(this, Response2);
|
|
30551
30551
|
const urlList = this.#state.urlList;
|
|
30552
30552
|
const url = urlList[urlList.length - 1] ?? null;
|
|
30553
30553
|
if (url === null) {
|
|
@@ -30556,35 +30556,35 @@ var require_response = __commonJS(function(exports, module) {
|
|
|
30556
30556
|
return URLSerializer(url, true);
|
|
30557
30557
|
}
|
|
30558
30558
|
get redirected() {
|
|
30559
|
-
webidl.brandCheck(this,
|
|
30559
|
+
webidl.brandCheck(this, Response2);
|
|
30560
30560
|
return this.#state.urlList.length > 1;
|
|
30561
30561
|
}
|
|
30562
30562
|
get status() {
|
|
30563
|
-
webidl.brandCheck(this,
|
|
30563
|
+
webidl.brandCheck(this, Response2);
|
|
30564
30564
|
return this.#state.status;
|
|
30565
30565
|
}
|
|
30566
30566
|
get ok() {
|
|
30567
|
-
webidl.brandCheck(this,
|
|
30567
|
+
webidl.brandCheck(this, Response2);
|
|
30568
30568
|
return this.#state.status >= 200 && this.#state.status <= 299;
|
|
30569
30569
|
}
|
|
30570
30570
|
get statusText() {
|
|
30571
|
-
webidl.brandCheck(this,
|
|
30571
|
+
webidl.brandCheck(this, Response2);
|
|
30572
30572
|
return this.#state.statusText;
|
|
30573
30573
|
}
|
|
30574
30574
|
get headers() {
|
|
30575
|
-
webidl.brandCheck(this,
|
|
30575
|
+
webidl.brandCheck(this, Response2);
|
|
30576
30576
|
return this.#headers;
|
|
30577
30577
|
}
|
|
30578
30578
|
get body() {
|
|
30579
|
-
webidl.brandCheck(this,
|
|
30579
|
+
webidl.brandCheck(this, Response2);
|
|
30580
30580
|
return this.#state.body ? this.#state.body.stream : null;
|
|
30581
30581
|
}
|
|
30582
30582
|
get bodyUsed() {
|
|
30583
|
-
webidl.brandCheck(this,
|
|
30583
|
+
webidl.brandCheck(this, Response2);
|
|
30584
30584
|
return !!this.#state.body && util.isDisturbed(this.#state.body.stream);
|
|
30585
30585
|
}
|
|
30586
30586
|
clone() {
|
|
30587
|
-
webidl.brandCheck(this,
|
|
30587
|
+
webidl.brandCheck(this, Response2);
|
|
30588
30588
|
if (bodyUnusable(this.#state)) {
|
|
30589
30589
|
throw webidl.errors.exception({
|
|
30590
30590
|
header: "Response.clone",
|
|
@@ -30628,13 +30628,13 @@ var require_response = __commonJS(function(exports, module) {
|
|
|
30628
30628
|
response.#state = newState;
|
|
30629
30629
|
}
|
|
30630
30630
|
}
|
|
30631
|
-
var { getResponseHeaders, setResponseHeaders, getResponseState, setResponseState } =
|
|
30632
|
-
Reflect.deleteProperty(
|
|
30633
|
-
Reflect.deleteProperty(
|
|
30634
|
-
Reflect.deleteProperty(
|
|
30635
|
-
Reflect.deleteProperty(
|
|
30636
|
-
mixinBody(
|
|
30637
|
-
Object.defineProperties(
|
|
30631
|
+
var { getResponseHeaders, setResponseHeaders, getResponseState, setResponseState } = Response2;
|
|
30632
|
+
Reflect.deleteProperty(Response2, "getResponseHeaders");
|
|
30633
|
+
Reflect.deleteProperty(Response2, "setResponseHeaders");
|
|
30634
|
+
Reflect.deleteProperty(Response2, "getResponseState");
|
|
30635
|
+
Reflect.deleteProperty(Response2, "setResponseState");
|
|
30636
|
+
mixinBody(Response2, getResponseState);
|
|
30637
|
+
Object.defineProperties(Response2.prototype, {
|
|
30638
30638
|
type: kEnumerableProperty,
|
|
30639
30639
|
url: kEnumerableProperty,
|
|
30640
30640
|
status: kEnumerableProperty,
|
|
@@ -30650,7 +30650,7 @@ var require_response = __commonJS(function(exports, module) {
|
|
|
30650
30650
|
configurable: true
|
|
30651
30651
|
}
|
|
30652
30652
|
});
|
|
30653
|
-
Object.defineProperties(
|
|
30653
|
+
Object.defineProperties(Response2, {
|
|
30654
30654
|
json: kEnumerableProperty,
|
|
30655
30655
|
redirect: kEnumerableProperty,
|
|
30656
30656
|
error: kEnumerableProperty
|
|
@@ -30776,7 +30776,7 @@ var require_response = __commonJS(function(exports, module) {
|
|
|
30776
30776
|
}
|
|
30777
30777
|
}
|
|
30778
30778
|
function fromInnerResponse(innerResponse, guard) {
|
|
30779
|
-
const response = new
|
|
30779
|
+
const response = new Response2(kConstruct);
|
|
30780
30780
|
setResponseState(response, innerResponse);
|
|
30781
30781
|
const headers = new Headers(kConstruct);
|
|
30782
30782
|
setResponseHeaders(response, headers);
|
|
@@ -30830,14 +30830,14 @@ var require_response = __commonJS(function(exports, module) {
|
|
|
30830
30830
|
converter: webidl.converters.HeadersInit
|
|
30831
30831
|
}
|
|
30832
30832
|
]);
|
|
30833
|
-
webidl.is.Response = webidl.util.MakeTypeAssertion(
|
|
30833
|
+
webidl.is.Response = webidl.util.MakeTypeAssertion(Response2);
|
|
30834
30834
|
module.exports = {
|
|
30835
30835
|
isNetworkError,
|
|
30836
30836
|
makeNetworkError,
|
|
30837
30837
|
makeResponse,
|
|
30838
30838
|
makeAppropriateNetworkError,
|
|
30839
30839
|
filterResponse,
|
|
30840
|
-
Response,
|
|
30840
|
+
Response: Response2,
|
|
30841
30841
|
cloneResponse,
|
|
30842
30842
|
fromInnerResponse,
|
|
30843
30843
|
getResponseState
|
|
@@ -30908,7 +30908,7 @@ var require_request2 = __commonJS(function(exports, module) {
|
|
|
30908
30908
|
}
|
|
30909
30909
|
var patchMethodWarning = false;
|
|
30910
30910
|
|
|
30911
|
-
class
|
|
30911
|
+
class Request2 {
|
|
30912
30912
|
#signal;
|
|
30913
30913
|
#dispatcher;
|
|
30914
30914
|
#headers;
|
|
@@ -31146,23 +31146,23 @@ var require_request2 = __commonJS(function(exports, module) {
|
|
|
31146
31146
|
this.#state.body = finalBody;
|
|
31147
31147
|
}
|
|
31148
31148
|
get method() {
|
|
31149
|
-
webidl.brandCheck(this,
|
|
31149
|
+
webidl.brandCheck(this, Request2);
|
|
31150
31150
|
return this.#state.method;
|
|
31151
31151
|
}
|
|
31152
31152
|
get url() {
|
|
31153
|
-
webidl.brandCheck(this,
|
|
31153
|
+
webidl.brandCheck(this, Request2);
|
|
31154
31154
|
return URLSerializer(this.#state.url);
|
|
31155
31155
|
}
|
|
31156
31156
|
get headers() {
|
|
31157
|
-
webidl.brandCheck(this,
|
|
31157
|
+
webidl.brandCheck(this, Request2);
|
|
31158
31158
|
return this.#headers;
|
|
31159
31159
|
}
|
|
31160
31160
|
get destination() {
|
|
31161
|
-
webidl.brandCheck(this,
|
|
31161
|
+
webidl.brandCheck(this, Request2);
|
|
31162
31162
|
return this.#state.destination;
|
|
31163
31163
|
}
|
|
31164
31164
|
get referrer() {
|
|
31165
|
-
webidl.brandCheck(this,
|
|
31165
|
+
webidl.brandCheck(this, Request2);
|
|
31166
31166
|
if (this.#state.referrer === "no-referrer") {
|
|
31167
31167
|
return "";
|
|
31168
31168
|
}
|
|
@@ -31172,59 +31172,59 @@ var require_request2 = __commonJS(function(exports, module) {
|
|
|
31172
31172
|
return this.#state.referrer.toString();
|
|
31173
31173
|
}
|
|
31174
31174
|
get referrerPolicy() {
|
|
31175
|
-
webidl.brandCheck(this,
|
|
31175
|
+
webidl.brandCheck(this, Request2);
|
|
31176
31176
|
return this.#state.referrerPolicy;
|
|
31177
31177
|
}
|
|
31178
31178
|
get mode() {
|
|
31179
|
-
webidl.brandCheck(this,
|
|
31179
|
+
webidl.brandCheck(this, Request2);
|
|
31180
31180
|
return this.#state.mode;
|
|
31181
31181
|
}
|
|
31182
31182
|
get credentials() {
|
|
31183
|
-
webidl.brandCheck(this,
|
|
31183
|
+
webidl.brandCheck(this, Request2);
|
|
31184
31184
|
return this.#state.credentials;
|
|
31185
31185
|
}
|
|
31186
31186
|
get cache() {
|
|
31187
|
-
webidl.brandCheck(this,
|
|
31187
|
+
webidl.brandCheck(this, Request2);
|
|
31188
31188
|
return this.#state.cache;
|
|
31189
31189
|
}
|
|
31190
31190
|
get redirect() {
|
|
31191
|
-
webidl.brandCheck(this,
|
|
31191
|
+
webidl.brandCheck(this, Request2);
|
|
31192
31192
|
return this.#state.redirect;
|
|
31193
31193
|
}
|
|
31194
31194
|
get integrity() {
|
|
31195
|
-
webidl.brandCheck(this,
|
|
31195
|
+
webidl.brandCheck(this, Request2);
|
|
31196
31196
|
return this.#state.integrity;
|
|
31197
31197
|
}
|
|
31198
31198
|
get keepalive() {
|
|
31199
|
-
webidl.brandCheck(this,
|
|
31199
|
+
webidl.brandCheck(this, Request2);
|
|
31200
31200
|
return this.#state.keepalive;
|
|
31201
31201
|
}
|
|
31202
31202
|
get isReloadNavigation() {
|
|
31203
|
-
webidl.brandCheck(this,
|
|
31203
|
+
webidl.brandCheck(this, Request2);
|
|
31204
31204
|
return this.#state.reloadNavigation;
|
|
31205
31205
|
}
|
|
31206
31206
|
get isHistoryNavigation() {
|
|
31207
|
-
webidl.brandCheck(this,
|
|
31207
|
+
webidl.brandCheck(this, Request2);
|
|
31208
31208
|
return this.#state.historyNavigation;
|
|
31209
31209
|
}
|
|
31210
31210
|
get signal() {
|
|
31211
|
-
webidl.brandCheck(this,
|
|
31211
|
+
webidl.brandCheck(this, Request2);
|
|
31212
31212
|
return this.#signal;
|
|
31213
31213
|
}
|
|
31214
31214
|
get body() {
|
|
31215
|
-
webidl.brandCheck(this,
|
|
31215
|
+
webidl.brandCheck(this, Request2);
|
|
31216
31216
|
return this.#state.body ? this.#state.body.stream : null;
|
|
31217
31217
|
}
|
|
31218
31218
|
get bodyUsed() {
|
|
31219
|
-
webidl.brandCheck(this,
|
|
31219
|
+
webidl.brandCheck(this, Request2);
|
|
31220
31220
|
return !!this.#state.body && util.isDisturbed(this.#state.body.stream);
|
|
31221
31221
|
}
|
|
31222
31222
|
get duplex() {
|
|
31223
|
-
webidl.brandCheck(this,
|
|
31223
|
+
webidl.brandCheck(this, Request2);
|
|
31224
31224
|
return "half";
|
|
31225
31225
|
}
|
|
31226
31226
|
clone() {
|
|
31227
|
-
webidl.brandCheck(this,
|
|
31227
|
+
webidl.brandCheck(this, Request2);
|
|
31228
31228
|
if (bodyUnusable(this.#state)) {
|
|
31229
31229
|
throw new TypeError("unusable");
|
|
31230
31230
|
}
|
|
@@ -31288,14 +31288,14 @@ var require_request2 = __commonJS(function(exports, module) {
|
|
|
31288
31288
|
request.#state = newState;
|
|
31289
31289
|
}
|
|
31290
31290
|
}
|
|
31291
|
-
var { setRequestSignal, getRequestDispatcher, setRequestDispatcher, setRequestHeaders, getRequestState, setRequestState } =
|
|
31292
|
-
Reflect.deleteProperty(
|
|
31293
|
-
Reflect.deleteProperty(
|
|
31294
|
-
Reflect.deleteProperty(
|
|
31295
|
-
Reflect.deleteProperty(
|
|
31296
|
-
Reflect.deleteProperty(
|
|
31297
|
-
Reflect.deleteProperty(
|
|
31298
|
-
mixinBody(
|
|
31291
|
+
var { setRequestSignal, getRequestDispatcher, setRequestDispatcher, setRequestHeaders, getRequestState, setRequestState } = Request2;
|
|
31292
|
+
Reflect.deleteProperty(Request2, "setRequestSignal");
|
|
31293
|
+
Reflect.deleteProperty(Request2, "getRequestDispatcher");
|
|
31294
|
+
Reflect.deleteProperty(Request2, "setRequestDispatcher");
|
|
31295
|
+
Reflect.deleteProperty(Request2, "setRequestHeaders");
|
|
31296
|
+
Reflect.deleteProperty(Request2, "getRequestState");
|
|
31297
|
+
Reflect.deleteProperty(Request2, "setRequestState");
|
|
31298
|
+
mixinBody(Request2, getRequestState);
|
|
31299
31299
|
function makeRequest(init) {
|
|
31300
31300
|
return {
|
|
31301
31301
|
method: init.method ?? "GET",
|
|
@@ -31348,7 +31348,7 @@ var require_request2 = __commonJS(function(exports, module) {
|
|
|
31348
31348
|
return newRequest;
|
|
31349
31349
|
}
|
|
31350
31350
|
function fromInnerRequest(innerRequest, dispatcher, signal, guard) {
|
|
31351
|
-
const request = new
|
|
31351
|
+
const request = new Request2(kConstruct);
|
|
31352
31352
|
setRequestState(request, innerRequest);
|
|
31353
31353
|
setRequestDispatcher(request, dispatcher);
|
|
31354
31354
|
setRequestSignal(request, signal);
|
|
@@ -31358,7 +31358,7 @@ var require_request2 = __commonJS(function(exports, module) {
|
|
|
31358
31358
|
setHeadersGuard(headers, guard);
|
|
31359
31359
|
return request;
|
|
31360
31360
|
}
|
|
31361
|
-
Object.defineProperties(
|
|
31361
|
+
Object.defineProperties(Request2.prototype, {
|
|
31362
31362
|
method: kEnumerableProperty,
|
|
31363
31363
|
url: kEnumerableProperty,
|
|
31364
31364
|
headers: kEnumerableProperty,
|
|
@@ -31384,7 +31384,7 @@ var require_request2 = __commonJS(function(exports, module) {
|
|
|
31384
31384
|
configurable: true
|
|
31385
31385
|
}
|
|
31386
31386
|
});
|
|
31387
|
-
webidl.is.Request = webidl.util.MakeTypeAssertion(
|
|
31387
|
+
webidl.is.Request = webidl.util.MakeTypeAssertion(Request2);
|
|
31388
31388
|
webidl.converters.RequestInfo = function(V) {
|
|
31389
31389
|
if (typeof V === "string") {
|
|
31390
31390
|
return webidl.converters.USVString(V);
|
|
@@ -31469,7 +31469,7 @@ var require_request2 = __commonJS(function(exports, module) {
|
|
|
31469
31469
|
}
|
|
31470
31470
|
]);
|
|
31471
31471
|
module.exports = {
|
|
31472
|
-
Request,
|
|
31472
|
+
Request: Request2,
|
|
31473
31473
|
makeRequest,
|
|
31474
31474
|
fromInnerRequest,
|
|
31475
31475
|
cloneRequest,
|
|
@@ -31614,7 +31614,7 @@ var require_fetch = __commonJS(function(exports, module) {
|
|
|
31614
31614
|
getResponseState
|
|
31615
31615
|
} = require_response();
|
|
31616
31616
|
var { HeadersList } = require_headers();
|
|
31617
|
-
var { Request, cloneRequest, getRequestDispatcher, getRequestState } = require_request2();
|
|
31617
|
+
var { Request: Request2, cloneRequest, getRequestDispatcher, getRequestState } = require_request2();
|
|
31618
31618
|
var zlib = __require("node:zlib");
|
|
31619
31619
|
var {
|
|
31620
31620
|
makePolicyContainer,
|
|
@@ -31712,7 +31712,7 @@ var require_fetch = __commonJS(function(exports, module) {
|
|
|
31712
31712
|
let p = createDeferredPromise();
|
|
31713
31713
|
let requestObject;
|
|
31714
31714
|
try {
|
|
31715
|
-
requestObject = new
|
|
31715
|
+
requestObject = new Request2(input, init);
|
|
31716
31716
|
} catch (e) {
|
|
31717
31717
|
p.reject(e);
|
|
31718
31718
|
return p.promise;
|
|
@@ -32705,7 +32705,7 @@ var require_cache3 = __commonJS(function(exports, module) {
|
|
|
32705
32705
|
var { kEnumerableProperty, isDisturbed } = require_util();
|
|
32706
32706
|
var { webidl } = require_webidl();
|
|
32707
32707
|
var { cloneResponse, fromInnerResponse, getResponseState } = require_response();
|
|
32708
|
-
var { Request, fromInnerRequest, getRequestState } = require_request2();
|
|
32708
|
+
var { Request: Request2, fromInnerRequest, getRequestState } = require_request2();
|
|
32709
32709
|
var { fetching } = require_fetch();
|
|
32710
32710
|
var { urlIsHttpHttpsScheme, readAllBytes } = require_util2();
|
|
32711
32711
|
var { createDeferredPromise } = require_promise();
|
|
@@ -32776,7 +32776,7 @@ var require_cache3 = __commonJS(function(exports, module) {
|
|
|
32776
32776
|
}
|
|
32777
32777
|
const fetchControllers = [];
|
|
32778
32778
|
for (const request of requests) {
|
|
32779
|
-
const r = getRequestState(new
|
|
32779
|
+
const r = getRequestState(new Request2(request));
|
|
32780
32780
|
if (!urlIsHttpHttpsScheme(r.url)) {
|
|
32781
32781
|
throw webidl.errors.exception({
|
|
32782
32782
|
header: prefix,
|
|
@@ -32860,7 +32860,7 @@ var require_cache3 = __commonJS(function(exports, module) {
|
|
|
32860
32860
|
if (webidl.is.Request(request)) {
|
|
32861
32861
|
innerRequest = getRequestState(request);
|
|
32862
32862
|
} else {
|
|
32863
|
-
innerRequest = getRequestState(new
|
|
32863
|
+
innerRequest = getRequestState(new Request2(request));
|
|
32864
32864
|
}
|
|
32865
32865
|
if (!urlIsHttpHttpsScheme(innerRequest.url) || innerRequest.method !== "GET") {
|
|
32866
32866
|
throw webidl.errors.exception({
|
|
@@ -32942,7 +32942,7 @@ var require_cache3 = __commonJS(function(exports, module) {
|
|
|
32942
32942
|
}
|
|
32943
32943
|
} else {
|
|
32944
32944
|
assert(typeof request === "string");
|
|
32945
|
-
r = getRequestState(new
|
|
32945
|
+
r = getRequestState(new Request2(request));
|
|
32946
32946
|
}
|
|
32947
32947
|
const operations = [];
|
|
32948
32948
|
const operation = {
|
|
@@ -32982,7 +32982,7 @@ var require_cache3 = __commonJS(function(exports, module) {
|
|
|
32982
32982
|
return [];
|
|
32983
32983
|
}
|
|
32984
32984
|
} else if (typeof request === "string") {
|
|
32985
|
-
r = getRequestState(new
|
|
32985
|
+
r = getRequestState(new Request2(request));
|
|
32986
32986
|
}
|
|
32987
32987
|
}
|
|
32988
32988
|
const promise = createDeferredPromise();
|
|
@@ -33130,7 +33130,7 @@ var require_cache3 = __commonJS(function(exports, module) {
|
|
|
33130
33130
|
return [];
|
|
33131
33131
|
}
|
|
33132
33132
|
} else if (typeof request === "string") {
|
|
33133
|
-
r = getRequestState(new
|
|
33133
|
+
r = getRequestState(new Request2(request));
|
|
33134
33134
|
}
|
|
33135
33135
|
}
|
|
33136
33136
|
const responses = [];
|
|
@@ -76815,8 +76815,396 @@ function normalizeUrl(rawUrl) {
|
|
|
76815
76815
|
}
|
|
76816
76816
|
}
|
|
76817
76817
|
|
|
76818
|
+
// src/checks/tolerances.ts
|
|
76819
|
+
var TOLERANCES = {
|
|
76820
|
+
visual: {
|
|
76821
|
+
highRegionPixels: {
|
|
76822
|
+
value: 50000,
|
|
76823
|
+
unit: "differing px",
|
|
76824
|
+
basis: "assumed",
|
|
76825
|
+
note: "A heatmap region at or above this is `high`: about a 250x200 block (banner, shelf, a section pushed down). A deliberately plain rule a reader can predict, not a calibrated one."
|
|
76826
|
+
},
|
|
76827
|
+
mediumRegionPixels: {
|
|
76828
|
+
value: 2500,
|
|
76829
|
+
unit: "differing px",
|
|
76830
|
+
basis: "assumed",
|
|
76831
|
+
note: "A heatmap region at or above this is `medium`: about a 50x50 button or a line of text. Smaller is `low`."
|
|
76832
|
+
},
|
|
76833
|
+
minRegionPixels: {
|
|
76834
|
+
value: 9,
|
|
76835
|
+
unit: "differing px",
|
|
76836
|
+
basis: "measured",
|
|
76837
|
+
note: "Fewer differing pixels than a 3x3 block is dropped as imperceptible by `run` (`parity heatmap` keeps them). Evidence: on live runs these were 2-7px anti-aliasing specks on a product thumbnail."
|
|
76838
|
+
},
|
|
76839
|
+
pixelmatchThreshold: {
|
|
76840
|
+
value: 0.1,
|
|
76841
|
+
unit: "sensitivity (0 strict - 1 loose)",
|
|
76842
|
+
basis: "assumed",
|
|
76843
|
+
note: "Per-pixel colour sensitivity passed to the pixel differ (diff/visual.ts default). Same value as pixelmatch's own default; no parity-specific measurement."
|
|
76844
|
+
},
|
|
76845
|
+
maxPctDiff: {
|
|
76846
|
+
value: 0.02,
|
|
76847
|
+
unit: "ratio (0-1)",
|
|
76848
|
+
basis: "assumed",
|
|
76849
|
+
note: "Fraction of differing pixels diff/visual.ts tolerates before failing a screenshot pair. Default only; no recorded justification."
|
|
76850
|
+
},
|
|
76851
|
+
maxMaskCoverage: {
|
|
76852
|
+
value: 0.2,
|
|
76853
|
+
unit: "ratio (0-1)",
|
|
76854
|
+
basis: "assumed",
|
|
76855
|
+
note: "Above this share of the frame in motion on prod's own, the remainder is not worth a verdict (saying `identical` about the other four fifths would be a pass produced by not looking). NEXT.md 16e calls it still a guess."
|
|
76856
|
+
},
|
|
76857
|
+
maskDilatePx: {
|
|
76858
|
+
value: 2,
|
|
76859
|
+
unit: "px",
|
|
76860
|
+
basis: "assumed",
|
|
76861
|
+
note: "Dilation of the noise mask: anti-aliasing puts the true edge of a moving element just outside the pixels that differed between two captures. More starts swallowing real defects next to a noisy region."
|
|
76862
|
+
},
|
|
76863
|
+
minComparablePixels: {
|
|
76864
|
+
value: 100,
|
|
76865
|
+
unit: "px",
|
|
76866
|
+
basis: "assumed",
|
|
76867
|
+
note: "Below this many pixels `parity heatmap` calls the crop inconclusive, not identical (a collapsed wrapper trivially matches). About a 10x10 icon."
|
|
76868
|
+
},
|
|
76869
|
+
maxHotspots: {
|
|
76870
|
+
value: 5,
|
|
76871
|
+
unit: "count",
|
|
76872
|
+
basis: "assumed",
|
|
76873
|
+
note: "Default cap on hotspot regions returned per heatmap. The comment says the first few cover >95% of the diff; that figure is not backed by a recorded measurement."
|
|
76874
|
+
},
|
|
76875
|
+
minHotspotComponentPixels: {
|
|
76876
|
+
value: 50,
|
|
76877
|
+
unit: "px",
|
|
76878
|
+
basis: "assumed",
|
|
76879
|
+
note: "Minimum connected-component size to count as a hotspot; drops 1-2px anti-aliasing specks. About a small icon."
|
|
76880
|
+
}
|
|
76881
|
+
},
|
|
76882
|
+
geometry: {
|
|
76883
|
+
subpixelPx: {
|
|
76884
|
+
value: 1,
|
|
76885
|
+
unit: "px",
|
|
76886
|
+
basis: "assumed",
|
|
76887
|
+
note: "A box-geometry delta at or below this is rasterisation, not layout (920.02px vs 920px). The same 1px line as boxTreeTolerancePx; lives separately because the heatmap explainer runs the box diff at zero tolerance."
|
|
76888
|
+
},
|
|
76889
|
+
boxTreeTolerancePx: {
|
|
76890
|
+
value: 1,
|
|
76891
|
+
unit: "px",
|
|
76892
|
+
basis: "assumed",
|
|
76893
|
+
note: "Default `diffBoxTrees` tolerance: subpixel rounding and font-metric noise between two engines. The claim 'a real spacing regression is never 1px' is not backed by a recorded measurement."
|
|
76894
|
+
},
|
|
76895
|
+
bannerWidthPx: {
|
|
76896
|
+
value: 600,
|
|
76897
|
+
unit: "px",
|
|
76898
|
+
basis: "assumed",
|
|
76899
|
+
note: "Images with a width attribute at or above this are treated as banners for aspect-ratio comparison; PDP images and shelf thumbnails fall well below it."
|
|
76900
|
+
},
|
|
76901
|
+
bannerAspectRatioDelta: {
|
|
76902
|
+
value: 0.15,
|
|
76903
|
+
unit: "ratio (0-1)",
|
|
76904
|
+
basis: "assumed",
|
|
76905
|
+
note: "Aspect-ratio delta at or above which banner-aspect-ratio reports a pair."
|
|
76906
|
+
},
|
|
76907
|
+
cookieModalClsHigh: {
|
|
76908
|
+
value: 0.1,
|
|
76909
|
+
unit: "CLS",
|
|
76910
|
+
basis: "spec",
|
|
76911
|
+
note: "Upper bound of the web.dev 'good' CLS band; a modal pushing cand above it while prod stays under is a regression."
|
|
76912
|
+
},
|
|
76913
|
+
cookieModalClsRatio: {
|
|
76914
|
+
value: 1.5,
|
|
76915
|
+
unit: "ratio (cand/prod)",
|
|
76916
|
+
basis: "assumed",
|
|
76917
|
+
note: "cand CLS more than this multiple of prod's (both nonzero) is flagged by cookie-cep-modal-cls."
|
|
76918
|
+
}
|
|
76919
|
+
},
|
|
76920
|
+
vitals: {
|
|
76921
|
+
lcpRatio: {
|
|
76922
|
+
value: 1.2,
|
|
76923
|
+
unit: "ratio (cand/prod)",
|
|
76924
|
+
basis: "assumed",
|
|
76925
|
+
note: "cand may be this much worse than prod before the ratio trips. The ratio alone was measured to be noise (see minDelta* notes), which is why it is never used alone."
|
|
76926
|
+
},
|
|
76927
|
+
fcpRatio: {
|
|
76928
|
+
value: 1.2,
|
|
76929
|
+
unit: "ratio (cand/prod)",
|
|
76930
|
+
basis: "assumed",
|
|
76931
|
+
note: "As lcpRatio, for FCP."
|
|
76932
|
+
},
|
|
76933
|
+
ttfbRatio: {
|
|
76934
|
+
value: 1.1,
|
|
76935
|
+
unit: "ratio (cand/prod)",
|
|
76936
|
+
basis: "assumed",
|
|
76937
|
+
note: "As lcpRatio, for TTFB (tighter: server time is the least noisy of the four)."
|
|
76938
|
+
},
|
|
76939
|
+
inpRatio: {
|
|
76940
|
+
value: 1.2,
|
|
76941
|
+
unit: "ratio (cand/prod)",
|
|
76942
|
+
basis: "assumed",
|
|
76943
|
+
note: "As lcpRatio, for INP."
|
|
76944
|
+
},
|
|
76945
|
+
clsAbsolute: {
|
|
76946
|
+
value: 0.05,
|
|
76947
|
+
unit: "CLS",
|
|
76948
|
+
basis: "assumed",
|
|
76949
|
+
note: "Absolute CLS increase tolerated (CLS has no meaningful ratio near zero)."
|
|
76950
|
+
},
|
|
76951
|
+
minDeltaLcpMs: {
|
|
76952
|
+
value: 200,
|
|
76953
|
+
unit: "ms",
|
|
76954
|
+
basis: "measured",
|
|
76955
|
+
note: "Smallest absolute LCP increase that can be a regression. Evidence: 43 mobile page pairs of one deployment over 13 runs, ratio-only flagged 24/43 as 'cand regressed' and 26/43 with sides swapped; with the floors and the good-band guard 7/43 vs 8/43 (scripts/vitals-swap.ts reproduces it). Same-page LCP |delta| p50 560ms / p90 2.8s."
|
|
76956
|
+
},
|
|
76957
|
+
minDeltaFcpMs: {
|
|
76958
|
+
value: 200,
|
|
76959
|
+
unit: "ms",
|
|
76960
|
+
basis: "measured",
|
|
76961
|
+
note: "As minDeltaLcpMs, for FCP. Same-page FCP |delta| p50 276ms / p90 2.4s on the same data."
|
|
76962
|
+
},
|
|
76963
|
+
minDeltaTtfbMs: {
|
|
76964
|
+
value: 100,
|
|
76965
|
+
unit: "ms",
|
|
76966
|
+
basis: "measured",
|
|
76967
|
+
note: "As minDeltaLcpMs, for TTFB: about 1/8 of the 800ms good budget; TTFB 17.8 -> 22.3ms is +25% and 4.5ms of network noise."
|
|
76968
|
+
},
|
|
76969
|
+
minDeltaInpMs: {
|
|
76970
|
+
value: 50,
|
|
76971
|
+
unit: "ms",
|
|
76972
|
+
basis: "measured",
|
|
76973
|
+
note: "As minDeltaLcpMs, for INP: 1/4 of the 200ms good budget."
|
|
76974
|
+
},
|
|
76975
|
+
goodLcpMs: {
|
|
76976
|
+
value: 2500,
|
|
76977
|
+
unit: "ms",
|
|
76978
|
+
basis: "spec",
|
|
76979
|
+
note: "web.dev 'good' LCP. A cand at or under it never regresses (in-band deltas were indistinguishable from noise on single samples)."
|
|
76980
|
+
},
|
|
76981
|
+
goodFcpMs: {
|
|
76982
|
+
value: 1800,
|
|
76983
|
+
unit: "ms",
|
|
76984
|
+
basis: "spec",
|
|
76985
|
+
note: "web.dev 'good' FCP."
|
|
76986
|
+
},
|
|
76987
|
+
goodTtfbMs: {
|
|
76988
|
+
value: 800,
|
|
76989
|
+
unit: "ms",
|
|
76990
|
+
basis: "spec",
|
|
76991
|
+
note: "web.dev 'good' TTFB."
|
|
76992
|
+
},
|
|
76993
|
+
goodInpMs: {
|
|
76994
|
+
value: 200,
|
|
76995
|
+
unit: "ms",
|
|
76996
|
+
basis: "spec",
|
|
76997
|
+
note: "web.dev 'good' INP."
|
|
76998
|
+
},
|
|
76999
|
+
goodCls: {
|
|
77000
|
+
value: 0.1,
|
|
77001
|
+
unit: "CLS",
|
|
77002
|
+
basis: "spec",
|
|
77003
|
+
note: "web.dev 'good' CLS."
|
|
77004
|
+
},
|
|
77005
|
+
lighthouseScoreDrop: {
|
|
77006
|
+
value: 3,
|
|
77007
|
+
unit: "score points (0-100)",
|
|
77008
|
+
basis: "assumed",
|
|
77009
|
+
note: "A Lighthouse category drop smaller than this is jitter (scores are integers)."
|
|
77010
|
+
},
|
|
77011
|
+
lighthouseScoreHighDrop: {
|
|
77012
|
+
value: 10,
|
|
77013
|
+
unit: "score points (0-100)",
|
|
77014
|
+
basis: "assumed",
|
|
77015
|
+
note: "A Lighthouse category drop of at least this is `high`, otherwise `medium`."
|
|
77016
|
+
},
|
|
77017
|
+
lighthouseHighSavingsMs: {
|
|
77018
|
+
value: 500,
|
|
77019
|
+
unit: "ms",
|
|
77020
|
+
basis: "assumed",
|
|
77021
|
+
note: "Opportunity worth at least this much time is `high` (thresholds chosen in issue #264; no measurement recorded)."
|
|
77022
|
+
},
|
|
77023
|
+
lighthouseMediumSavingsMs: {
|
|
77024
|
+
value: 200,
|
|
77025
|
+
unit: "ms",
|
|
77026
|
+
basis: "assumed",
|
|
77027
|
+
note: "Opportunity worth at least this much time is `medium`, below is `low`."
|
|
77028
|
+
},
|
|
77029
|
+
lighthouseRegressionMs: {
|
|
77030
|
+
value: 200,
|
|
77031
|
+
unit: "ms",
|
|
77032
|
+
basis: "assumed",
|
|
77033
|
+
note: "How much worse cand's savings must be than prod's for a shared opportunity to count as a regression."
|
|
77034
|
+
}
|
|
77035
|
+
},
|
|
77036
|
+
network: {
|
|
77037
|
+
maxTotalPct: {
|
|
77038
|
+
value: 0.3,
|
|
77039
|
+
unit: "ratio (0-1)",
|
|
77040
|
+
basis: "assumed",
|
|
77041
|
+
note: "Request-count delta between prod and cand beyond which network-summary-delta flags the page."
|
|
77042
|
+
},
|
|
77043
|
+
footerLatencyRatio: {
|
|
77044
|
+
value: 1.5,
|
|
77045
|
+
unit: "ratio (cand/prod)",
|
|
77046
|
+
basis: "assumed",
|
|
77047
|
+
note: "Average footer-link HEAD latency in cand above this multiple of prod's is a regression."
|
|
77048
|
+
},
|
|
77049
|
+
plpPage2CountDelta: {
|
|
77050
|
+
value: 0.3,
|
|
77051
|
+
unit: "ratio (0-1)",
|
|
77052
|
+
basis: "assumed",
|
|
77053
|
+
note: "PLP page=2 product-count divergence beyond which plp-pagination flags (wildly different counts mean the migrated index is not paginating the same list)."
|
|
77054
|
+
},
|
|
77055
|
+
searchResultsDelta: {
|
|
77056
|
+
value: 0.3,
|
|
77057
|
+
unit: "ratio (0-1)",
|
|
77058
|
+
basis: "assumed",
|
|
77059
|
+
note: "Search result-count divergence (relative to the larger side) at which search-results reports `high`."
|
|
77060
|
+
},
|
|
77061
|
+
searchMatchEverythingCount: {
|
|
77062
|
+
value: 10,
|
|
77063
|
+
unit: "count",
|
|
77064
|
+
basis: "assumed",
|
|
77065
|
+
note: "A no-results query that still lists more than this many products without an empty state is `matches everything` (critical); 1-10 is a fuzzy fallback (medium)."
|
|
77066
|
+
},
|
|
77067
|
+
sitemapCountDrop: {
|
|
77068
|
+
value: -0.05,
|
|
77069
|
+
unit: "ratio (signed)",
|
|
77070
|
+
basis: "assumed",
|
|
77071
|
+
note: "cand sitemap with a URL count more than 5% under prod's is flagged by seo-deep-audit."
|
|
77072
|
+
}
|
|
77073
|
+
},
|
|
77074
|
+
imagesDom: {
|
|
77075
|
+
domCountTolerance: {
|
|
77076
|
+
value: 2,
|
|
77077
|
+
unit: "count (+/- per element count)",
|
|
77078
|
+
basis: "assumed",
|
|
77079
|
+
note: "Per-count tolerance of `diffDom` (also passed explicitly by html-structural). Absorbs a stray wrapper or hidden node."
|
|
77080
|
+
},
|
|
77081
|
+
imageAltIncrease: {
|
|
77082
|
+
value: 1,
|
|
77083
|
+
unit: "count",
|
|
77084
|
+
basis: "assumed",
|
|
77085
|
+
note: "cand may have this many more images without alt than prod before image-loading-health flags it."
|
|
77086
|
+
},
|
|
77087
|
+
imageSrcsetLoss: {
|
|
77088
|
+
value: 2,
|
|
77089
|
+
unit: "count",
|
|
77090
|
+
basis: "assumed",
|
|
77091
|
+
note: "cand may lose this many srcset images vs prod before image-loading-health flags it."
|
|
77092
|
+
},
|
|
77093
|
+
contentStructureKeep: {
|
|
77094
|
+
value: 0.8,
|
|
77095
|
+
unit: "ratio (0-1)",
|
|
77096
|
+
basis: "assumed",
|
|
77097
|
+
note: "cand must keep at least this share of prod's text length, bold, line breaks, links and paragraphs on editorial pages."
|
|
77098
|
+
},
|
|
77099
|
+
contentStructureMinChars: {
|
|
77100
|
+
value: 500,
|
|
77101
|
+
unit: "chars",
|
|
77102
|
+
basis: "assumed",
|
|
77103
|
+
note: "A prod editorial page under this is a stub: nothing to compare against, so the candidate is not behind."
|
|
77104
|
+
},
|
|
77105
|
+
lazyOverlapMin: {
|
|
77106
|
+
value: 0.9,
|
|
77107
|
+
unit: "ratio (Jaccard)",
|
|
77108
|
+
basis: "assumed",
|
|
77109
|
+
note: "Lazy-section overlap between prod and cand under which lazy-section-presence reports a divergence."
|
|
77110
|
+
},
|
|
77111
|
+
lazyOverlapMinUnion: {
|
|
77112
|
+
value: 4,
|
|
77113
|
+
unit: "count",
|
|
77114
|
+
basis: "assumed",
|
|
77115
|
+
note: "The overlap check needs more than this many sections in the union; fewer makes the Jaccard ratio meaningless."
|
|
77116
|
+
},
|
|
77117
|
+
eagerProdBaseline: {
|
|
77118
|
+
value: 3,
|
|
77119
|
+
unit: "count",
|
|
77120
|
+
basis: "assumed",
|
|
77121
|
+
note: "Prod needs at least this many inline deco markers to be a useful baseline for detecting a cand that is eager by design."
|
|
77122
|
+
},
|
|
77123
|
+
eagerCandMinMarkers: {
|
|
77124
|
+
value: 4,
|
|
77125
|
+
unit: "count",
|
|
77126
|
+
basis: "assumed",
|
|
77127
|
+
note: "When prod's baseline is too small, cand needs at least this many deco markers to be read as eager-by-design rather than a generic fallback layout."
|
|
77128
|
+
},
|
|
77129
|
+
jsonldPriceDelta: {
|
|
77130
|
+
value: 0.01,
|
|
77131
|
+
unit: "ratio (0-1)",
|
|
77132
|
+
basis: "assumed",
|
|
77133
|
+
note: "offers.price relative change above which JSON-LD reports a price change (absorbs rounding)."
|
|
77134
|
+
}
|
|
77135
|
+
},
|
|
77136
|
+
cache: {
|
|
77137
|
+
cacheableMaxAgeSec: {
|
|
77138
|
+
value: 60,
|
|
77139
|
+
unit: "s",
|
|
77140
|
+
basis: "assumed",
|
|
77141
|
+
note: "Minimum max-age for a response to count as deliberately cacheable. Rationale recorded: VTEX edge defaults to 5min and Cloudflare to 4h for static, so >=60s is a deliberate config; no measurement."
|
|
77142
|
+
},
|
|
77143
|
+
coverageHighOpportunities: {
|
|
77144
|
+
value: 10,
|
|
77145
|
+
unit: "count",
|
|
77146
|
+
basis: "assumed",
|
|
77147
|
+
note: "At least this many uncached cacheable requests makes cache-coverage's summary `high`."
|
|
77148
|
+
},
|
|
77149
|
+
coverageHighBytes: {
|
|
77150
|
+
value: 1e6,
|
|
77151
|
+
unit: "bytes",
|
|
77152
|
+
basis: "assumed",
|
|
77153
|
+
note: "Uncached cacheable bytes above this makes cache-coverage's summary `high`."
|
|
77154
|
+
},
|
|
77155
|
+
hitRateRegression: {
|
|
77156
|
+
value: 0.15,
|
|
77157
|
+
unit: "ratio (0-1)",
|
|
77158
|
+
basis: "assumed",
|
|
77159
|
+
note: "cand hit rate this far under prod's (15 points) is a regression."
|
|
77160
|
+
},
|
|
77161
|
+
probeBaselineFloor: {
|
|
77162
|
+
value: 0.8,
|
|
77163
|
+
unit: "ratio (0-1)",
|
|
77164
|
+
basis: "assumed",
|
|
77165
|
+
note: "The undecorated baseline must hit at least this often before a decorated collapse means anything."
|
|
77166
|
+
},
|
|
77167
|
+
probeCollapseCeiling: {
|
|
77168
|
+
value: 0.34,
|
|
77169
|
+
unit: "ratio (0-1)",
|
|
77170
|
+
basis: "assumed",
|
|
77171
|
+
note: "A decorated variant at or below this hit rate is considered collapsed."
|
|
77172
|
+
},
|
|
77173
|
+
probeOkFloor: {
|
|
77174
|
+
value: 0.66,
|
|
77175
|
+
unit: "ratio (0-1)",
|
|
77176
|
+
basis: "assumed",
|
|
77177
|
+
note: "At or above this the decoration demonstrably shares the baseline entry. Between collapse and this is inconclusive."
|
|
77178
|
+
},
|
|
77179
|
+
probeMinSamples: {
|
|
77180
|
+
value: 3,
|
|
77181
|
+
unit: "count",
|
|
77182
|
+
basis: "assumed",
|
|
77183
|
+
note: "Fewer samples than this is inconclusive (a single-sample probe produced a false leak during the manual investigation)."
|
|
77184
|
+
},
|
|
77185
|
+
probeMinRoutes: {
|
|
77186
|
+
value: 2,
|
|
77187
|
+
unit: "count",
|
|
77188
|
+
basis: "assumed",
|
|
77189
|
+
note: "A collapse on fewer routes than this is inconclusive: one route is never enough to rule out a flaky route."
|
|
77190
|
+
},
|
|
77191
|
+
warmBandFactor: {
|
|
77192
|
+
value: 2,
|
|
77193
|
+
unit: "x fastest sample",
|
|
77194
|
+
basis: "assumed",
|
|
77195
|
+
note: "A sample is 'warm' if within this multiple of the fastest, plus warmBandOffsetMs. Fixed band, not a clustering algorithm; separates a ~100ms memory read from a ~2s upstream call."
|
|
77196
|
+
},
|
|
77197
|
+
warmBandOffsetMs: {
|
|
77198
|
+
value: 50,
|
|
77199
|
+
unit: "ms",
|
|
77200
|
+
basis: "assumed",
|
|
77201
|
+
note: "Added to the warm band so sub-100ms jitter does not split an all-warm set."
|
|
77202
|
+
}
|
|
77203
|
+
}
|
|
77204
|
+
};
|
|
77205
|
+
|
|
76818
77206
|
// src/diff/dom.ts
|
|
76819
|
-
var BANNER_WIDTH_THRESHOLD =
|
|
77207
|
+
var BANNER_WIDTH_THRESHOLD = TOLERANCES.geometry.bannerWidthPx.value;
|
|
76820
77208
|
var BANNER_SECTION_RE = /(carousel|slider|banner|hero)/i;
|
|
76821
77209
|
function parseDim(raw) {
|
|
76822
77210
|
if (!raw)
|
|
@@ -76938,7 +77326,7 @@ function snapshotDom(html) {
|
|
|
76938
77326
|
};
|
|
76939
77327
|
}
|
|
76940
77328
|
function diffDom(prod, cand, opts = {}) {
|
|
76941
|
-
const tol = opts.countTolerance ??
|
|
77329
|
+
const tol = opts.countTolerance ?? TOLERANCES.imagesDom.domCountTolerance.value;
|
|
76942
77330
|
const countsDelta = {};
|
|
76943
77331
|
let anyFailed = false;
|
|
76944
77332
|
for (const key of Object.keys(prod.counts)) {
|
|
@@ -77009,8 +77397,96 @@ function diffMeta(prod, cand) {
|
|
|
77009
77397
|
return out;
|
|
77010
77398
|
}
|
|
77011
77399
|
|
|
77400
|
+
// src/checks/lib/counts.ts
|
|
77401
|
+
function unitCounts(args) {
|
|
77402
|
+
const judged = new Set(args.judged);
|
|
77403
|
+
const unjudged = new Set([...args.unjudged ?? []].filter((k) => !judged.has(k)));
|
|
77404
|
+
const unitOf = args.unitOf ?? ((i) => i.page);
|
|
77405
|
+
const live = new Set;
|
|
77406
|
+
const inconclusiveOnly = new Set;
|
|
77407
|
+
const withInconclusive = new Set;
|
|
77408
|
+
for (const issue of args.issues) {
|
|
77409
|
+
const key = unitOf(issue);
|
|
77410
|
+
const known = key !== undefined && (judged.has(key) || unjudged.has(key));
|
|
77411
|
+
if (!issue.inconclusive && !issue.accepted) {
|
|
77412
|
+
if (!known)
|
|
77413
|
+
return {};
|
|
77414
|
+
live.add(key);
|
|
77415
|
+
} else if (issue.inconclusive && known && !args.informational?.(issue)) {
|
|
77416
|
+
withInconclusive.add(key);
|
|
77417
|
+
}
|
|
77418
|
+
}
|
|
77419
|
+
for (const key of live)
|
|
77420
|
+
if (unjudged.delete(key))
|
|
77421
|
+
judged.add(key);
|
|
77422
|
+
for (const key of withInconclusive)
|
|
77423
|
+
if (judged.has(key) && !live.has(key))
|
|
77424
|
+
inconclusiveOnly.add(key);
|
|
77425
|
+
const compared = judged.size - inconclusiveOnly.size;
|
|
77426
|
+
return {
|
|
77427
|
+
unit: args.unit,
|
|
77428
|
+
compared,
|
|
77429
|
+
passed: compared - live.size,
|
|
77430
|
+
inconclusive: inconclusiveOnly.size + [...unjudged].filter((k) => !inconclusiveOnly.has(k)).length
|
|
77431
|
+
};
|
|
77432
|
+
}
|
|
77433
|
+
function addWithheld(result, n) {
|
|
77434
|
+
if (result.compared === undefined || n === 0)
|
|
77435
|
+
return result;
|
|
77436
|
+
return { ...result, inconclusive: (result.inconclusive ?? 0) + n };
|
|
77437
|
+
}
|
|
77438
|
+
function recountPassed(check) {
|
|
77439
|
+
if (check.compared === undefined || check.passed === undefined)
|
|
77440
|
+
return;
|
|
77441
|
+
const key = (i) => i.page ?? i.id;
|
|
77442
|
+
const live = check.issues.filter((i) => !i.inconclusive);
|
|
77443
|
+
const before = new Set(live.map(key)).size;
|
|
77444
|
+
const after = new Set(live.filter((i) => !i.accepted).map(key)).size;
|
|
77445
|
+
check.passed = Math.min(check.compared, check.passed + (before - after));
|
|
77446
|
+
}
|
|
77447
|
+
function describeCounts(c, opts = {}) {
|
|
77448
|
+
if (c.compared === undefined)
|
|
77449
|
+
return null;
|
|
77450
|
+
const unit = opts.unitLabel === false || !c.unit ? "" : ` ${c.unit}s`;
|
|
77451
|
+
const base = c.compared === 0 ? "nothing compared" : `${c.passed ?? 0}/${c.compared}${unit}`;
|
|
77452
|
+
return c.inconclusive ? `${base} · ${c.inconclusive} inconclusive` : base;
|
|
77453
|
+
}
|
|
77454
|
+
function sumByUnit(checks) {
|
|
77455
|
+
const rows = new Map;
|
|
77456
|
+
let counting = 0;
|
|
77457
|
+
for (const c of checks) {
|
|
77458
|
+
if (c.compared === undefined || !c.unit)
|
|
77459
|
+
continue;
|
|
77460
|
+
counting++;
|
|
77461
|
+
const row = rows.get(c.unit) ?? {
|
|
77462
|
+
unit: c.unit,
|
|
77463
|
+
compared: 0,
|
|
77464
|
+
passed: 0,
|
|
77465
|
+
inconclusive: 0,
|
|
77466
|
+
checks: 0
|
|
77467
|
+
};
|
|
77468
|
+
row.compared += c.compared;
|
|
77469
|
+
row.passed += c.passed ?? 0;
|
|
77470
|
+
row.inconclusive += c.inconclusive ?? 0;
|
|
77471
|
+
row.checks++;
|
|
77472
|
+
rows.set(c.unit, row);
|
|
77473
|
+
}
|
|
77474
|
+
return { rows: [...rows.values()], counting };
|
|
77475
|
+
}
|
|
77476
|
+
function describeModuleCounts(rows, checksCounting, checksRun) {
|
|
77477
|
+
if (!rows || rows.length === 0)
|
|
77478
|
+
return null;
|
|
77479
|
+
const parts = rows.map((r) => {
|
|
77480
|
+
if (r.compared === 0)
|
|
77481
|
+
return r.inconclusive ? `nothing compared · ${r.inconclusive} inconclusive` : "nothing compared";
|
|
77482
|
+
const base = `${r.passed}/${r.compared} ${r.unit} ${r.compared === 1 ? "judgement" : "judgements"}`;
|
|
77483
|
+
return r.inconclusive ? `${base} · ${r.inconclusive} inconclusive` : base;
|
|
77484
|
+
});
|
|
77485
|
+
return `${parts.join("; ")} (${checksCounting ?? 0} of ${checksRun} checks count)`;
|
|
77486
|
+
}
|
|
77487
|
+
|
|
77012
77488
|
// src/checks/banner-aspect-ratio.ts
|
|
77013
|
-
var ASPECT_RATIO_TOLERANCE =
|
|
77489
|
+
var ASPECT_RATIO_TOLERANCE = TOLERANCES.geometry.bannerAspectRatioDelta.value;
|
|
77014
77490
|
function bannerAspectRatio(ctx) {
|
|
77015
77491
|
const start = Date.now();
|
|
77016
77492
|
const { pairs } = pairCaptures(ctx.prodPages, ctx.candPages);
|
|
@@ -77058,6 +77534,12 @@ function bannerAspectRatio(ctx) {
|
|
|
77058
77534
|
durationMs: Date.now() - start,
|
|
77059
77535
|
summary: `${pagesChecked} página(s) analisada(s), ${pagesWithIssues} com diferença de aspect ratio em banner`,
|
|
77060
77536
|
issues,
|
|
77537
|
+
...unitCounts({
|
|
77538
|
+
unit: "page-pair",
|
|
77539
|
+
judged: pairs.filter((p) => p.prod.html && p.cand.html).map((p) => p.key),
|
|
77540
|
+
unjudged: pairs.map((p) => p.key),
|
|
77541
|
+
issues
|
|
77542
|
+
}),
|
|
77061
77543
|
data: { pagesChecked, pagesWithIssues }
|
|
77062
77544
|
};
|
|
77063
77545
|
}
|
|
@@ -77104,7 +77586,7 @@ function describeBanner(b) {
|
|
|
77104
77586
|
}
|
|
77105
77587
|
|
|
77106
77588
|
// src/diff/cache.ts
|
|
77107
|
-
var CACHEABLE_MAX_AGE_MIN =
|
|
77589
|
+
var CACHEABLE_MAX_AGE_MIN = TOLERANCES.cache.cacheableMaxAgeSec.value;
|
|
77108
77590
|
function parseMaxAge(cc) {
|
|
77109
77591
|
const m = cc.match(/(?:^|[,\s;])s-maxage=(\d+)/i) ?? cc.match(/(?:^|[,\s;])max-age=(\d+)/i);
|
|
77110
77592
|
return m ? Number.parseInt(m[1], 10) : null;
|
|
@@ -77309,7 +77791,7 @@ function cacheCoverage(ctx) {
|
|
|
77309
77791
|
const oppCount = report.opportunities.length;
|
|
77310
77792
|
const oppBytes = report.opportunities.reduce((s, r) => s + (r.entry.bytes ?? 0), 0);
|
|
77311
77793
|
if (oppCount > 0) {
|
|
77312
|
-
const severity = oppCount >=
|
|
77794
|
+
const severity = oppCount >= TOLERANCES.cache.coverageHighOpportunities.value || oppBytes > TOLERANCES.cache.coverageHighBytes.value ? "high" : "medium";
|
|
77313
77795
|
const isSingleSite = ctx.prodPages.length === 0;
|
|
77314
77796
|
const target = isSingleSite ? "no site" : "em cand";
|
|
77315
77797
|
issues.push({
|
|
@@ -77321,7 +77803,7 @@ function cacheCoverage(ctx) {
|
|
|
77321
77803
|
details: buildOpportunityDetails(report, prodReport)
|
|
77322
77804
|
});
|
|
77323
77805
|
}
|
|
77324
|
-
if (prodReport && prodReport.hitRate - report.hitRate >
|
|
77806
|
+
if (prodReport && prodReport.hitRate - report.hitRate > TOLERANCES.cache.hitRateRegression.value) {
|
|
77325
77807
|
issues.push({
|
|
77326
77808
|
id: "cache:hit-rate-regression",
|
|
77327
77809
|
severity: "medium",
|
|
@@ -77946,7 +78428,7 @@ function hash(s) {
|
|
|
77946
78428
|
// src/checks/content-structure.ts
|
|
77947
78429
|
init_esm10();
|
|
77948
78430
|
var CONTENT_PATH = /(politica|policy|termos|terminos|terms|tyc|privacidad|privacy|sobre|about|garantia|warranty|institucional|institutional|contacta|contact)/i;
|
|
77949
|
-
var TOLERANCE =
|
|
78431
|
+
var TOLERANCE = TOLERANCES.imagesDom.contentStructureKeep.value;
|
|
77950
78432
|
function readStructure(html) {
|
|
77951
78433
|
const $ = load(html);
|
|
77952
78434
|
$("script, style, nav, header, footer").remove();
|
|
@@ -78004,7 +78486,7 @@ function contentStructureParity(ctx) {
|
|
|
78004
78486
|
const path = pathOf(prodPage.url);
|
|
78005
78487
|
const a = readStructure(prodPage.html ?? "");
|
|
78006
78488
|
const b = readStructure(candPage.html ?? "");
|
|
78007
|
-
if (a.chars <
|
|
78489
|
+
if (a.chars < TOLERANCES.imagesDom.contentStructureMinChars.value)
|
|
78008
78490
|
continue;
|
|
78009
78491
|
if (b.chars < a.chars * TOLERANCE) {
|
|
78010
78492
|
issues.push({
|
|
@@ -78050,8 +78532,8 @@ function contentStructureParity(ctx) {
|
|
|
78050
78532
|
}
|
|
78051
78533
|
|
|
78052
78534
|
// src/checks/cookie-cep-modal-cls.ts
|
|
78053
|
-
var CLS_HIGH_THRESHOLD =
|
|
78054
|
-
var CLS_REGRESSION_RATIO =
|
|
78535
|
+
var CLS_HIGH_THRESHOLD = TOLERANCES.geometry.cookieModalClsHigh.value;
|
|
78536
|
+
var CLS_REGRESSION_RATIO = TOLERANCES.geometry.cookieModalClsRatio.value;
|
|
78055
78537
|
function cookieCepModalCls(ctx) {
|
|
78056
78538
|
const start = Date.now();
|
|
78057
78539
|
const issues = [];
|
|
@@ -78367,7 +78849,7 @@ function pickHome2(pages) {
|
|
|
78367
78849
|
|
|
78368
78850
|
// src/checks/footer-links-health.ts
|
|
78369
78851
|
init_esm10();
|
|
78370
|
-
var FOOTER_LATENCY_REGRESSION_RATIO =
|
|
78852
|
+
var FOOTER_LATENCY_REGRESSION_RATIO = TOLERANCES.network.footerLatencyRatio.value;
|
|
78371
78853
|
async function footerLinksHealth(ctx) {
|
|
78372
78854
|
const start = Date.now();
|
|
78373
78855
|
const issues = [];
|
|
@@ -78529,7 +79011,7 @@ function average(nums) {
|
|
|
78529
79011
|
|
|
78530
79012
|
// src/checks/html-structural.ts
|
|
78531
79013
|
init_esm10();
|
|
78532
|
-
var COUNT_TOLERANCE =
|
|
79014
|
+
var COUNT_TOLERANCE = TOLERANCES.imagesDom.domCountTolerance.value;
|
|
78533
79015
|
function htmlStructuralDiff(ctx) {
|
|
78534
79016
|
const start = Date.now();
|
|
78535
79017
|
const { pairs } = pairCaptures(ctx.prodPages, ctx.candPages);
|
|
@@ -78629,7 +79111,13 @@ ${STAGING_NOTE}`
|
|
|
78629
79111
|
severity: "high",
|
|
78630
79112
|
durationMs: Date.now() - start,
|
|
78631
79113
|
summary: `${issues.length} divergência(s) estrutural(is) detectada(s)`,
|
|
78632
|
-
issues
|
|
79114
|
+
issues,
|
|
79115
|
+
...unitCounts({
|
|
79116
|
+
unit: "page-pair",
|
|
79117
|
+
judged: pairs.map((p) => p.key),
|
|
79118
|
+
issues,
|
|
79119
|
+
informational: (i) => i.id.startsWith("html-structural:counts-informational:") || i.id === "html-structural:staging-vendors"
|
|
79120
|
+
})
|
|
78633
79121
|
};
|
|
78634
79122
|
}
|
|
78635
79123
|
function hostDomain(url) {
|
|
@@ -78688,9 +79176,10 @@ function httpStatusParity(ctx) {
|
|
|
78688
79176
|
}
|
|
78689
79177
|
const { pairs, orphansProd, orphansCand } = pairCaptures(ctx.prodPages, ctx.candPages);
|
|
78690
79178
|
const issues = [];
|
|
79179
|
+
const pairIssues = [];
|
|
78691
79180
|
for (const pair of pairs) {
|
|
78692
79181
|
if (pair.prod.status !== pair.cand.status) {
|
|
78693
|
-
|
|
79182
|
+
pairIssues.push({
|
|
78694
79183
|
id: `http-status:${pair.key}`,
|
|
78695
79184
|
severity: "critical",
|
|
78696
79185
|
category: "functional",
|
|
@@ -78704,6 +79193,7 @@ function httpStatusParity(ctx) {
|
|
|
78704
79193
|
});
|
|
78705
79194
|
}
|
|
78706
79195
|
}
|
|
79196
|
+
issues.push(...pairIssues);
|
|
78707
79197
|
for (const p of orphansProd) {
|
|
78708
79198
|
issues.push({
|
|
78709
79199
|
id: `http-status:missing-cand:${p.url}`,
|
|
@@ -78733,6 +79223,11 @@ function httpStatusParity(ctx) {
|
|
|
78733
79223
|
durationMs: Date.now() - start,
|
|
78734
79224
|
summary: `${pairs.length} pares verificados, ${issues.length} divergência(s)`,
|
|
78735
79225
|
issues,
|
|
79226
|
+
...unitCounts({
|
|
79227
|
+
unit: "page-pair",
|
|
79228
|
+
judged: pairs.map((p) => p.key),
|
|
79229
|
+
issues: pairIssues
|
|
79230
|
+
}),
|
|
78736
79231
|
data: { pairs: pairs.length, orphansProd: orphansProd.length, orphansCand: orphansCand.length }
|
|
78737
79232
|
};
|
|
78738
79233
|
}
|
|
@@ -78756,7 +79251,7 @@ function imageLoadingHealth(ctx) {
|
|
|
78756
79251
|
summary: `${candFailedImgs} imagem(ns) com falha de carregamento em cand (${pair.key})`
|
|
78757
79252
|
});
|
|
78758
79253
|
}
|
|
78759
|
-
if (candSnap.imageStats.withoutAlt - prodSnap.imageStats.withoutAlt >
|
|
79254
|
+
if (candSnap.imageStats.withoutAlt - prodSnap.imageStats.withoutAlt > TOLERANCES.imagesDom.imageAltIncrease.value) {
|
|
78760
79255
|
issues.push({
|
|
78761
79256
|
id: `images:alt:${pair.key}`,
|
|
78762
79257
|
severity: "low",
|
|
@@ -78767,7 +79262,7 @@ function imageLoadingHealth(ctx) {
|
|
|
78767
79262
|
});
|
|
78768
79263
|
}
|
|
78769
79264
|
const srcsetLoss = prodSnap.imageStats.withSrcset - candSnap.imageStats.withSrcset;
|
|
78770
|
-
if (srcsetLoss >
|
|
79265
|
+
if (srcsetLoss > TOLERANCES.imagesDom.imageSrcsetLoss.value) {
|
|
78771
79266
|
issues.push({
|
|
78772
79267
|
id: `images:srcset:${pair.key}`,
|
|
78773
79268
|
severity: "medium",
|
|
@@ -78784,7 +79279,8 @@ function imageLoadingHealth(ctx) {
|
|
|
78784
79279
|
severity: "medium",
|
|
78785
79280
|
durationMs: Date.now() - start,
|
|
78786
79281
|
summary: `${issues.length} problema(s) de imagem detectado(s)`,
|
|
78787
|
-
issues
|
|
79282
|
+
issues,
|
|
79283
|
+
...unitCounts({ unit: "page-pair", judged: pairs.map((p) => p.key), issues })
|
|
78788
79284
|
};
|
|
78789
79285
|
}
|
|
78790
79286
|
function countFailedImageRequests(entries) {
|
|
@@ -78849,7 +79345,7 @@ Novos em cand: ${onlyCand.join(", ") || "—"}`
|
|
|
78849
79345
|
});
|
|
78850
79346
|
}
|
|
78851
79347
|
}
|
|
78852
|
-
if (jaccard <
|
|
79348
|
+
if (jaccard < TOLERANCES.imagesDom.lazyOverlapMin.value && union > TOLERANCES.imagesDom.lazyOverlapMinUnion.value && !candIsIntentionallyEager) {
|
|
78853
79349
|
issues.push({
|
|
78854
79350
|
id: `lazy:overlap:${pair.key}`,
|
|
78855
79351
|
severity: "medium",
|
|
@@ -78867,7 +79363,8 @@ Novos em cand: ${onlyCand.join(", ") || "—"}`
|
|
|
78867
79363
|
severity: "high",
|
|
78868
79364
|
durationMs: Date.now() - start,
|
|
78869
79365
|
summary: `${issues.length} divergência(s) de lazy sections`,
|
|
78870
|
-
issues
|
|
79366
|
+
issues,
|
|
79367
|
+
...unitCounts({ unit: "page-pair", judged: pairs.map((p) => p.key), issues })
|
|
78871
79368
|
};
|
|
78872
79369
|
}
|
|
78873
79370
|
function detectIntentionalEager(args) {
|
|
@@ -78877,11 +79374,11 @@ function detectIntentionalEager(args) {
|
|
|
78877
79374
|
return true;
|
|
78878
79375
|
const candDecoCount = countDecoMarkers(args.candHtml);
|
|
78879
79376
|
const prodDecoCount = countDecoMarkers(args.prodHtml);
|
|
78880
|
-
const meaningfulProdBaseline = prodDecoCount >=
|
|
79377
|
+
const meaningfulProdBaseline = prodDecoCount >= TOLERANCES.imagesDom.eagerProdBaseline.value;
|
|
78881
79378
|
if (meaningfulProdBaseline) {
|
|
78882
79379
|
return candDecoCount >= prodDecoCount;
|
|
78883
79380
|
}
|
|
78884
|
-
return candDecoCount >=
|
|
79381
|
+
return candDecoCount >= TOLERANCES.imagesDom.eagerCandMinMarkers.value;
|
|
78885
79382
|
}
|
|
78886
79383
|
function countDecoMarkers(html) {
|
|
78887
79384
|
if (!html)
|
|
@@ -78958,11 +79455,13 @@ function withHtmlSnapshot(check) {
|
|
|
78958
79455
|
details: "The page answered but its HTML snapshot came back empty (capture budget spent or the read failed), so this check had nothing to judge on that side. Not a finding: re-run the page, or capture it with `parity html --url`.",
|
|
78959
79456
|
evidence: page.screenshotPath ? [{ kind: "screenshot", path: page.screenshotPath }] : []
|
|
78960
79457
|
}));
|
|
78961
|
-
|
|
79458
|
+
const pairKeys = new Set(pairCaptures(ctx.prodPages, ctx.candPages).pairs.map((p) => p.key));
|
|
79459
|
+
const withheld = [...unread.keys()].filter((k) => pairKeys.has(k)).length;
|
|
79460
|
+
return addWithheld({
|
|
78962
79461
|
...result,
|
|
78963
79462
|
status: result.status === "pass" ? "warn" : result.status,
|
|
78964
79463
|
issues: [...result.issues, ...issues]
|
|
78965
|
-
};
|
|
79464
|
+
}, withheld);
|
|
78966
79465
|
};
|
|
78967
79466
|
Object.defineProperty(guarded, "name", { value: check.name });
|
|
78968
79467
|
return guarded;
|
|
@@ -79354,11 +79853,11 @@ function withSameVariant(check) {
|
|
|
79354
79853
|
summary: `${key}: prod and cand served by different builds (${stacks}) — not compared by ${result.name}`,
|
|
79355
79854
|
details: `${mismatch.mixed} — pin with --prod-cookie/--prod-header. Script counts, request volume and vitals of a pair served by two different stacks measure the A/B bucket, not the migration.`
|
|
79356
79855
|
}));
|
|
79357
|
-
return {
|
|
79856
|
+
return addWithheld({
|
|
79358
79857
|
...result,
|
|
79359
79858
|
status: result.status === "pass" ? "warn" : result.status,
|
|
79360
79859
|
issues: [...result.issues, ...issues]
|
|
79361
|
-
};
|
|
79860
|
+
}, mismatch.keys.size);
|
|
79362
79861
|
};
|
|
79363
79862
|
Object.defineProperty(guarded, "name", { value: check.name });
|
|
79364
79863
|
return guarded;
|
|
@@ -79414,7 +79913,7 @@ function diffUrls(prod, cand, options = {}) {
|
|
|
79414
79913
|
return { onlyProd, onlyCand, common };
|
|
79415
79914
|
}
|
|
79416
79915
|
function diffNetwork(prod, cand, opts = {}) {
|
|
79417
|
-
const maxPct = opts.maxTotalPct ??
|
|
79916
|
+
const maxPct = opts.maxTotalPct ?? TOLERANCES.network.maxTotalPct.value;
|
|
79418
79917
|
const pSum = summarizeNetwork(prod);
|
|
79419
79918
|
const cSum = summarizeNetwork(cand);
|
|
79420
79919
|
const totalPct = pSum.total > 0 ? (cSum.total - pSum.total) / pSum.total : 0;
|
|
@@ -79447,7 +79946,7 @@ function networkSummaryDelta(ctx) {
|
|
|
79447
79946
|
for (const pair of pairs) {
|
|
79448
79947
|
const diff = diffNetwork(pair.prod.network, pair.cand.network, {
|
|
79449
79948
|
ignorePatterns: ctx.ignore.ignoreRequestPatterns,
|
|
79450
|
-
maxTotalPct:
|
|
79949
|
+
maxTotalPct: TOLERANCES.network.maxTotalPct.value
|
|
79451
79950
|
});
|
|
79452
79951
|
if (diff.anyFailed) {
|
|
79453
79952
|
issues.push({
|
|
@@ -79486,7 +79985,8 @@ function networkSummaryDelta(ctx) {
|
|
|
79486
79985
|
severity: "medium",
|
|
79487
79986
|
durationMs: Date.now() - start,
|
|
79488
79987
|
summary: `${issues.length} divergência(s) de network`,
|
|
79489
|
-
issues
|
|
79988
|
+
issues,
|
|
79989
|
+
...unitCounts({ unit: "page-pair", judged: pairs.map((p) => p.key), issues })
|
|
79490
79990
|
};
|
|
79491
79991
|
}
|
|
79492
79992
|
|
|
@@ -79668,7 +80168,7 @@ function diffProductSchema(prodMap, candMap) {
|
|
|
79668
80168
|
if (path === "offers.price") {
|
|
79669
80169
|
const pNum = toNumber(prodValue);
|
|
79670
80170
|
const cNum = toNumber(candValue);
|
|
79671
|
-
if (pNum != null && cNum != null && Math.abs((cNum - pNum) / pNum) >
|
|
80171
|
+
if (pNum != null && cNum != null && Math.abs((cNum - pNum) / pNum) > TOLERANCES.imagesDom.jsonldPriceDelta.value) {
|
|
79672
80172
|
out.changedFields.push({ field: path, prod: pNum, cand: cNum });
|
|
79673
80173
|
}
|
|
79674
80174
|
} else if (typeof prodValue === "string" && typeof candValue === "string") {
|
|
@@ -80494,7 +80994,7 @@ Page 2 first product: ${page2.productPaths[0] ?? "(none)"}`
|
|
|
80494
80994
|
if (prodCounts && candCounts && "page2" in prodCounts && "page2" in candCounts) {
|
|
80495
80995
|
const p = prodCounts.page2.products;
|
|
80496
80996
|
const c = candCounts.page2.products;
|
|
80497
|
-
if (p > 0 && Math.abs(p - c) / p >
|
|
80997
|
+
if (p > 0 && Math.abs(p - c) / p > TOLERANCES.network.plpPage2CountDelta.value) {
|
|
80498
80998
|
issues.push({
|
|
80499
80999
|
id: "plp-pagination:cross-side-count-divergence",
|
|
80500
81000
|
severity: "medium",
|
|
@@ -80803,6 +81303,8 @@ function purchaseJourneyFlow(ctx) {
|
|
|
80803
81303
|
let failedSteps = 0;
|
|
80804
81304
|
let asymmetricSkips = 0;
|
|
80805
81305
|
let comparedSteps = 0;
|
|
81306
|
+
const judgedUnits = new Set;
|
|
81307
|
+
const unjudgedUnits = new Set;
|
|
80806
81308
|
const hasAnyPurchaseFlow = ctx.prodFlows.some((f) => f.flow === "purchase-journey") || ctx.candFlows.some((f) => f.flow === "purchase-journey");
|
|
80807
81309
|
if (!hasAnyPurchaseFlow) {
|
|
80808
81310
|
return {
|
|
@@ -80825,6 +81327,11 @@ function purchaseJourneyFlow(ctx) {
|
|
|
80825
81327
|
continue;
|
|
80826
81328
|
for (const step of flow.steps ?? []) {
|
|
80827
81329
|
totalSteps++;
|
|
81330
|
+
const unit = `${viewport}:${step.name}`;
|
|
81331
|
+
if (step.status === "skipped" && !PJ_CRITICAL_STEPS.has(step.name))
|
|
81332
|
+
unjudgedUnits.add(unit);
|
|
81333
|
+
else
|
|
81334
|
+
judgedUnits.add(unit);
|
|
80828
81335
|
const label = PJ_STEP_LABELS[step.name] ?? step.name;
|
|
80829
81336
|
const isCritical = PJ_CRITICAL_STEPS.has(step.name);
|
|
80830
81337
|
if (step.status === "failed") {
|
|
@@ -80907,8 +81414,11 @@ function purchaseJourneyFlow(ctx) {
|
|
|
80907
81414
|
const p = prodSteps.get(name);
|
|
80908
81415
|
const c = candSteps.get(name);
|
|
80909
81416
|
const label = PJ_STEP_LABELS[name] ?? name;
|
|
81417
|
+
const unit = `${viewport}:${name}`;
|
|
80910
81418
|
if (!p && c)
|
|
80911
81419
|
continue;
|
|
81420
|
+
if (p)
|
|
81421
|
+
(p.status === "ok" || !c ? judgedUnits : unjudgedUnits).add(unit);
|
|
80912
81422
|
if (p && !c) {
|
|
80913
81423
|
failedSteps++;
|
|
80914
81424
|
issues.push({
|
|
@@ -80965,6 +81475,13 @@ function purchaseJourneyFlow(ctx) {
|
|
|
80965
81475
|
durationMs: Date.now() - start,
|
|
80966
81476
|
summary: `${status === "warn" && issues.every((i) => i.inconclusive) ? "inconclusivo — " : ""}${totalSteps} step(s) avaliado(s), ${comparedSteps} comparado(s) com ok nos dois lados, ${failedSteps} falha(s), ${asymmetricSkips} skip(s) assimétrico(s)`,
|
|
80967
81477
|
issues,
|
|
81478
|
+
...unitCounts({
|
|
81479
|
+
unit: "flow-step",
|
|
81480
|
+
judged: judgedUnits,
|
|
81481
|
+
unjudged: unjudgedUnits,
|
|
81482
|
+
issues,
|
|
81483
|
+
unitOf: (i) => /^pj:([^:]+):(.+):(?:failed|skipped|missing-cand|failed-cand|skipped-cand)$/.exec(i.id)?.slice(1, 3).join(":")
|
|
81484
|
+
}),
|
|
80968
81485
|
data: { totalSteps, failedSteps, asymmetricSkips, comparedSteps }
|
|
80969
81486
|
};
|
|
80970
81487
|
}
|
|
@@ -81199,7 +81716,7 @@ function searchNoResults(ctx) {
|
|
|
81199
81716
|
const count = step?.searchValidation?.resultCount ?? 0;
|
|
81200
81717
|
const empty = step?.searchValidation?.hasEmptyState ?? false;
|
|
81201
81718
|
if (step?.status === "ok" && count > 0 && !empty) {
|
|
81202
|
-
const isMatchEverything = count >
|
|
81719
|
+
const isMatchEverything = count > TOLERANCES.network.searchMatchEverythingCount.value;
|
|
81203
81720
|
issues.push({
|
|
81204
81721
|
id: `search-no-results:${viewport}:${isMatchEverything ? "matches-everything" : "fuzzy-fallback"}`,
|
|
81205
81722
|
severity: isMatchEverything ? "critical" : "medium",
|
|
@@ -81220,7 +81737,7 @@ function searchNoResults(ctx) {
|
|
|
81220
81737
|
continue;
|
|
81221
81738
|
}
|
|
81222
81739
|
if (candCount > 0 && prodCount === 0 && !candEmpty) {
|
|
81223
|
-
const isMatchEverything = candCount >
|
|
81740
|
+
const isMatchEverything = candCount > TOLERANCES.network.searchMatchEverythingCount.value;
|
|
81224
81741
|
issues.push({
|
|
81225
81742
|
id: `search-no-results:${viewport}:${isMatchEverything ? "cand-matches" : "cand-fuzzy"}`,
|
|
81226
81743
|
severity: isMatchEverything ? "critical" : "medium",
|
|
@@ -81319,7 +81836,7 @@ function searchPresence(ctx) {
|
|
|
81319
81836
|
}
|
|
81320
81837
|
|
|
81321
81838
|
// src/checks/search-results.ts
|
|
81322
|
-
var RESULTS_DELTA_THRESHOLD =
|
|
81839
|
+
var RESULTS_DELTA_THRESHOLD = TOLERANCES.network.searchResultsDelta.value;
|
|
81323
81840
|
function searchResults(ctx) {
|
|
81324
81841
|
const start = Date.now();
|
|
81325
81842
|
const issues = [];
|
|
@@ -81976,7 +82493,7 @@ async function checkSitemap(state, candPages) {
|
|
|
81976
82493
|
if (prodUrls.length === 0)
|
|
81977
82494
|
return out;
|
|
81978
82495
|
const diff = diffSitemap(prodUrls, candUrls);
|
|
81979
|
-
if (diff.countPct <
|
|
82496
|
+
if (diff.countPct < TOLERANCES.network.sitemapCountDrop.value) {
|
|
81980
82497
|
out.push({
|
|
81981
82498
|
id: "seo:sitemap-url-count",
|
|
81982
82499
|
severity: "medium",
|
|
@@ -86073,7 +86590,7 @@ function rectProps(n) {
|
|
|
86073
86590
|
};
|
|
86074
86591
|
}
|
|
86075
86592
|
function diffBoxTrees(prod, cand, opts = {}) {
|
|
86076
|
-
const tolerancePx = opts.tolerancePx ??
|
|
86593
|
+
const tolerancePx = opts.tolerancePx ?? TOLERANCES.geometry.boxTreeTolerancePx.value;
|
|
86077
86594
|
const maxDeltas = opts.maxDeltas ?? 200;
|
|
86078
86595
|
const { pairs, onlyInProd, onlyInCand } = alignBoxTrees(prod, cand, opts.aliases);
|
|
86079
86596
|
const deltas = [];
|
|
@@ -86185,8 +86702,8 @@ function formatBoxTreeDiff(diff, opts = {}) {
|
|
|
86185
86702
|
// src/diff/heatmap-regions.ts
|
|
86186
86703
|
import { readFileSync as readFileSync4 } from "node:fs";
|
|
86187
86704
|
import { PNG } from "pngjs";
|
|
86188
|
-
var DEFAULT_MAX_HOTSPOTS =
|
|
86189
|
-
var DEFAULT_MIN_COMPONENT_PIXELS =
|
|
86705
|
+
var DEFAULT_MAX_HOTSPOTS = TOLERANCES.visual.maxHotspots.value;
|
|
86706
|
+
var DEFAULT_MIN_COMPONENT_PIXELS = TOLERANCES.visual.minHotspotComponentPixels.value;
|
|
86190
86707
|
function analyzeHeatmapRegions(pngPath, opts = {}) {
|
|
86191
86708
|
const png = PNG.sync.read(readFileSync4(pngPath));
|
|
86192
86709
|
return analyzeHeatmapBuffer(png.data, png.width, png.height, opts);
|
|
@@ -86306,7 +86823,7 @@ var COLOR_PROPS = /^(color|background-color|border-color|fill|stroke)$/;
|
|
|
86306
86823
|
var SPACING_PROPS = /^(margin|padding|gap|row-gap|column-gap)/;
|
|
86307
86824
|
var SIZE_PROPS = /^(rect\.(width|height)|width|height)$/;
|
|
86308
86825
|
var POSITION_PROPS = /^rect\.(offsetX|offsetY)$/;
|
|
86309
|
-
var SUBPIXEL_PX =
|
|
86826
|
+
var SUBPIXEL_PX = TOLERANCES.geometry.subpixelPx.value;
|
|
86310
86827
|
function isSubpixelGeometry(d) {
|
|
86311
86828
|
return !!d?.prop.startsWith("rect.") && d.deltaPx != null && Math.abs(d.deltaPx) < SUBPIXEL_PX;
|
|
86312
86829
|
}
|
|
@@ -86422,8 +86939,8 @@ function describe2(type, hotspot, nodes, imageHostDelta, because) {
|
|
|
86422
86939
|
// src/diff/noise-mask.ts
|
|
86423
86940
|
import { readFileSync as readFileSync5, writeFileSync as writeFileSync4 } from "node:fs";
|
|
86424
86941
|
import { PNG as PNG2 } from "pngjs";
|
|
86425
|
-
var DEFAULT_DILATE =
|
|
86426
|
-
var MAX_MASK_COVERAGE =
|
|
86942
|
+
var DEFAULT_DILATE = TOLERANCES.visual.maskDilatePx.value;
|
|
86943
|
+
var MAX_MASK_COVERAGE = TOLERANCES.visual.maxMaskCoverage.value;
|
|
86427
86944
|
function buildNoiseMask(firstPng, secondPng, dilate = DEFAULT_DILATE) {
|
|
86428
86945
|
const a = PNG2.sync.read(readFileSync5(firstPng));
|
|
86429
86946
|
const b = PNG2.sync.read(readFileSync5(secondPng));
|
|
@@ -86497,8 +87014,8 @@ import { readFileSync as readFileSync6, writeFileSync as writeFileSync5 } from "
|
|
|
86497
87014
|
import pixelmatch from "pixelmatch";
|
|
86498
87015
|
import { PNG as PNG3 } from "pngjs";
|
|
86499
87016
|
var DEFAULTS = {
|
|
86500
|
-
maxPctDiff:
|
|
86501
|
-
threshold:
|
|
87017
|
+
maxPctDiff: TOLERANCES.visual.maxPctDiff.value,
|
|
87018
|
+
threshold: TOLERANCES.visual.pixelmatchThreshold.value
|
|
86502
87019
|
};
|
|
86503
87020
|
function diffScreenshots(prodPath, candPath, heatmapPath, opts = {}) {
|
|
86504
87021
|
const cfg = { ...DEFAULTS, ...opts };
|
|
@@ -88117,7 +88634,7 @@ function aggregateVerdict(results) {
|
|
|
88117
88634
|
}
|
|
88118
88635
|
return { verdict: "identical" };
|
|
88119
88636
|
}
|
|
88120
|
-
var MIN_COMPARABLE_PIXELS =
|
|
88637
|
+
var MIN_COMPARABLE_PIXELS = TOLERANCES.visual.minComparablePixels.value;
|
|
88121
88638
|
var EXIT_IDENTICAL = 0;
|
|
88122
88639
|
var EXIT_DIFFERS = 1;
|
|
88123
88640
|
var EXIT_INCONCLUSIVE = 2;
|
|
@@ -88821,6 +89338,7 @@ function applyAcceptedFindings(checks, expected) {
|
|
|
88821
89338
|
const hits = new Set;
|
|
88822
89339
|
let accepted = 0;
|
|
88823
89340
|
for (const check of checks) {
|
|
89341
|
+
let acceptedHere = 0;
|
|
88824
89342
|
for (const issue of check.issues) {
|
|
88825
89343
|
const rule = rules.find((r) => ruleMatches(r, issue));
|
|
88826
89344
|
if (!rule)
|
|
@@ -88828,8 +89346,11 @@ function applyAcceptedFindings(checks, expected) {
|
|
|
88828
89346
|
hits.add(rule);
|
|
88829
89347
|
issue.accepted = { note: rule.note };
|
|
88830
89348
|
accepted++;
|
|
89349
|
+
acceptedHere++;
|
|
88831
89350
|
bySeverity[issue.severity]++;
|
|
88832
89351
|
}
|
|
89352
|
+
if (acceptedHere > 0)
|
|
89353
|
+
recountPassed(check);
|
|
88833
89354
|
}
|
|
88834
89355
|
const ran = checks.filter((c) => c.status !== "skipped").map((c) => c.name);
|
|
88835
89356
|
const scopeRan = (scope) => !Object.hasOwn(MODULES, scope) && !moduleOfCheck(scope) ? true : ran.some((name) => name === scope || moduleOfCheck(name) === scope);
|
|
@@ -88865,8 +89386,8 @@ function formatAcceptedSeverities(by) {
|
|
|
88865
89386
|
}
|
|
88866
89387
|
|
|
88867
89388
|
// src/checks/visual-regression.ts
|
|
88868
|
-
var HIGH_REGION_PIXELS =
|
|
88869
|
-
var MEDIUM_REGION_PIXELS =
|
|
89389
|
+
var HIGH_REGION_PIXELS = TOLERANCES.visual.highRegionPixels.value;
|
|
89390
|
+
var MEDIUM_REGION_PIXELS = TOLERANCES.visual.mediumRegionPixels.value;
|
|
88870
89391
|
function findingSeverity(f) {
|
|
88871
89392
|
if (f.type === "horizontal-overflow")
|
|
88872
89393
|
return "high";
|
|
@@ -88878,7 +89399,7 @@ function findingSeverity(f) {
|
|
|
88878
89399
|
return "medium";
|
|
88879
89400
|
return "low";
|
|
88880
89401
|
}
|
|
88881
|
-
var MIN_REGION_PIXELS =
|
|
89402
|
+
var MIN_REGION_PIXELS = TOLERANCES.visual.minRegionPixels.value;
|
|
88882
89403
|
function isImperceptible(f) {
|
|
88883
89404
|
if (f.type === "horizontal-overflow")
|
|
88884
89405
|
return false;
|
|
@@ -89145,20 +89666,38 @@ Usually missing from registerSections() in src/setup.ts, or the CMS is not resol
|
|
|
89145
89666
|
durationMs: Date.now() - start,
|
|
89146
89667
|
summary: `${results.length} page pair(s) compared (heatmap): ${pagesPassed} identical, ${pagesWithDiffs} differ, ${pagesFailed} inconclusive`,
|
|
89147
89668
|
issues,
|
|
89669
|
+
...unitCounts({
|
|
89670
|
+
unit: "page-pair",
|
|
89671
|
+
judged: results.filter((r) => r.verdict !== "failed").map((r) => r.pageKey),
|
|
89672
|
+
unjudged: results.filter((r) => r.verdict === "failed").map((r) => r.pageKey),
|
|
89673
|
+
issues,
|
|
89674
|
+
informational: (i) => i.id.startsWith("visual:heatmap:") || i.id.startsWith("visual:sections-expected:")
|
|
89675
|
+
}),
|
|
89148
89676
|
data: { visualDiff: summary }
|
|
89149
89677
|
};
|
|
89150
89678
|
}
|
|
89151
89679
|
|
|
89152
89680
|
// src/diff/vitals.ts
|
|
89153
|
-
var MIN_DELTA_MS = {
|
|
89681
|
+
var MIN_DELTA_MS = {
|
|
89682
|
+
lcp: TOLERANCES.vitals.minDeltaLcpMs.value,
|
|
89683
|
+
fcp: TOLERANCES.vitals.minDeltaFcpMs.value,
|
|
89684
|
+
ttfb: TOLERANCES.vitals.minDeltaTtfbMs.value,
|
|
89685
|
+
inp: TOLERANCES.vitals.minDeltaInpMs.value
|
|
89686
|
+
};
|
|
89154
89687
|
var DEFAULT_THRESHOLDS = {
|
|
89155
|
-
lcp:
|
|
89156
|
-
fcp:
|
|
89157
|
-
ttfb:
|
|
89158
|
-
inp:
|
|
89159
|
-
clsAbsolute:
|
|
89688
|
+
lcp: TOLERANCES.vitals.lcpRatio.value,
|
|
89689
|
+
fcp: TOLERANCES.vitals.fcpRatio.value,
|
|
89690
|
+
ttfb: TOLERANCES.vitals.ttfbRatio.value,
|
|
89691
|
+
inp: TOLERANCES.vitals.inpRatio.value,
|
|
89692
|
+
clsAbsolute: TOLERANCES.vitals.clsAbsolute.value,
|
|
89160
89693
|
minDeltaMs: MIN_DELTA_MS,
|
|
89161
|
-
good: {
|
|
89694
|
+
good: {
|
|
89695
|
+
lcp: TOLERANCES.vitals.goodLcpMs.value,
|
|
89696
|
+
fcp: TOLERANCES.vitals.goodFcpMs.value,
|
|
89697
|
+
ttfb: TOLERANCES.vitals.goodTtfbMs.value,
|
|
89698
|
+
inp: TOLERANCES.vitals.goodInpMs.value,
|
|
89699
|
+
cls: TOLERANCES.vitals.goodCls.value
|
|
89700
|
+
}
|
|
89162
89701
|
};
|
|
89163
89702
|
function diffVitals(prod, cand, thresholds = DEFAULT_THRESHOLDS) {
|
|
89164
89703
|
const ratio = (k) => compareRatio(prod[k], cand[k], thresholds[k], thresholds.minDeltaMs[k], thresholds.good[k], k);
|
|
@@ -89253,7 +89792,8 @@ function webVitalsMobile(ctx) {
|
|
|
89253
89792
|
severity: "high",
|
|
89254
89793
|
durationMs: Date.now() - start,
|
|
89255
89794
|
summary: `${mobilePairs.length} página(s) mobile, ${issues.length} regressão(ões)`,
|
|
89256
|
-
issues
|
|
89795
|
+
issues,
|
|
89796
|
+
...unitCounts({ unit: "page-pair", judged: mobilePairs.map((p) => p.key), issues })
|
|
89257
89797
|
};
|
|
89258
89798
|
}
|
|
89259
89799
|
function fmt(n) {
|
|
@@ -89809,7 +90349,11 @@ var CheckResult = z2.object({
|
|
|
89809
90349
|
durationMs: z2.number(),
|
|
89810
90350
|
summary: z2.string(),
|
|
89811
90351
|
data: z2.record(z2.string(), z2.unknown()).optional(),
|
|
89812
|
-
issues: z2.array(Issue)
|
|
90352
|
+
issues: z2.array(Issue),
|
|
90353
|
+
compared: z2.number().int().nonnegative().optional(),
|
|
90354
|
+
passed: z2.number().int().nonnegative().optional(),
|
|
90355
|
+
inconclusive: z2.number().int().nonnegative().optional(),
|
|
90356
|
+
unit: z2.string().optional()
|
|
89813
90357
|
});
|
|
89814
90358
|
var VisualDifferenceType = z2.enum([
|
|
89815
90359
|
"missing-component",
|
|
@@ -89961,7 +90505,15 @@ var ModuleVerdict = z2.object({
|
|
|
89961
90505
|
low: z2.number(),
|
|
89962
90506
|
checksRun: z2.number(),
|
|
89963
90507
|
pagesAnalyzed: z2.number(),
|
|
89964
|
-
uncappedScore: z2.number().optional()
|
|
90508
|
+
uncappedScore: z2.number().optional(),
|
|
90509
|
+
counts: z2.array(z2.object({
|
|
90510
|
+
unit: z2.string(),
|
|
90511
|
+
compared: z2.number(),
|
|
90512
|
+
passed: z2.number(),
|
|
90513
|
+
inconclusive: z2.number(),
|
|
90514
|
+
checks: z2.number()
|
|
90515
|
+
})).optional(),
|
|
90516
|
+
checksCounting: z2.number().optional()
|
|
89965
90517
|
});
|
|
89966
90518
|
var RunCaveat = z2.object({
|
|
89967
90519
|
id: z2.string(),
|
|
@@ -99002,11 +99554,11 @@ function hitRate(states) {
|
|
|
99002
99554
|
}
|
|
99003
99555
|
return counted === 0 ? null : hits / counted;
|
|
99004
99556
|
}
|
|
99005
|
-
var BASELINE_FLOOR =
|
|
99006
|
-
var COLLAPSE_CEILING =
|
|
99007
|
-
var OK_FLOOR =
|
|
99008
|
-
var MIN_SAMPLES =
|
|
99009
|
-
var MIN_ROUTES =
|
|
99557
|
+
var BASELINE_FLOOR = TOLERANCES.cache.probeBaselineFloor.value;
|
|
99558
|
+
var COLLAPSE_CEILING = TOLERANCES.cache.probeCollapseCeiling.value;
|
|
99559
|
+
var OK_FLOOR = TOLERANCES.cache.probeOkFloor.value;
|
|
99560
|
+
var MIN_SAMPLES = TOLERANCES.cache.probeMinSamples.value;
|
|
99561
|
+
var MIN_ROUTES = TOLERANCES.cache.probeMinRoutes.value;
|
|
99010
99562
|
function verdictForDecoration(input) {
|
|
99011
99563
|
const { baselineHitRate, decoratedHitRate, samples, routesAffected } = input;
|
|
99012
99564
|
if (baselineHitRate == null || decoratedHitRate == null) {
|
|
@@ -99056,7 +99608,7 @@ function estimateWarmFraction(durationsMs) {
|
|
|
99056
99608
|
if (valid.length === 0)
|
|
99057
99609
|
return null;
|
|
99058
99610
|
const min = Math.min(...valid);
|
|
99059
|
-
const threshold = min *
|
|
99611
|
+
const threshold = min * TOLERANCES.cache.warmBandFactor.value + TOLERANCES.cache.warmBandOffsetMs.value;
|
|
99060
99612
|
return valid.filter((d) => d <= threshold).length / valid.length;
|
|
99061
99613
|
}
|
|
99062
99614
|
function entriesUntilEviction(entryBytes, capBytes) {
|
|
@@ -99187,6 +99739,7 @@ function computeModuleVerdicts(checks, issues) {
|
|
|
99187
99739
|
counts[i.severity]++;
|
|
99188
99740
|
const checksFailed = modChecks.filter((c) => c.status === "fail").length;
|
|
99189
99741
|
const checksWarn = modChecks.filter((c) => c.status === "warn").length;
|
|
99742
|
+
const counted = sumByUnit(modChecks);
|
|
99190
99743
|
const pagesAnalyzed = derivePagesAnalyzed(modChecks, modIssues);
|
|
99191
99744
|
const uncappedScore = computeScore(modIssues, { pagesAnalyzed }).score;
|
|
99192
99745
|
let score = uncappedScore;
|
|
@@ -99203,7 +99756,8 @@ function computeModuleVerdicts(checks, issues) {
|
|
|
99203
99756
|
low: counts.low,
|
|
99204
99757
|
checksRun: modChecks.length,
|
|
99205
99758
|
pagesAnalyzed,
|
|
99206
|
-
uncappedScore
|
|
99759
|
+
uncappedScore,
|
|
99760
|
+
...counted.counting > 0 ? { counts: counted.rows, checksCounting: counted.counting } : {}
|
|
99207
99761
|
});
|
|
99208
99762
|
}
|
|
99209
99763
|
result.sort((a, b) => a.module.localeCompare(b.module));
|
|
@@ -99722,11 +100276,16 @@ function renderScoreBreakdown(run) {
|
|
|
99722
100276
|
const line = moduleWeighedBy(run, mod);
|
|
99723
100277
|
return line ? `<div class="sb-weighed">${escapeHtml(line)}</div>` : "";
|
|
99724
100278
|
};
|
|
100279
|
+
const countsFor = (mod) => {
|
|
100280
|
+
const mv = run.moduleVerdicts?.find((v) => v.module === mod);
|
|
100281
|
+
return (mv && describeModuleCounts(mv.counts, mv.checksCounting, mv.checksRun)) ?? "—";
|
|
100282
|
+
};
|
|
99725
100283
|
const rows = ex.modules.map((m) => `<tr>
|
|
99726
100284
|
<td><strong>${escapeHtml(m.module)}</strong>${weighed(m.module)}${capNote(m.cappedBy)}</td>
|
|
99727
100285
|
<td><span class="sb-status" style="color:${STATUS_COLOR[m.status]}">${m.status}</span></td>
|
|
99728
100286
|
<td class="num" style="color:${STATUS_COLOR[m.status]}">${m.score}</td>
|
|
99729
100287
|
<td class="num">${Math.round(m.weightShare * 100)}%<small> · ${m.weight} page${m.weight === 1 ? "" : "s"}</small></td>
|
|
100288
|
+
<td>${escapeHtml(countsFor(m.module))}</td>
|
|
99730
100289
|
<td><div class="sb-lost"><span class="sb-bar"><span style="width:${(m.pointsLost / maxLost * 100).toFixed(1)}%"></span></span><span class="num">−${m.pointsLost.toFixed(1)}</span></div></td>
|
|
99731
100290
|
</tr>`).join("");
|
|
99732
100291
|
const headline = ex.capped ? `<div class="sb-capped">Capped at ${FAIL_SCORE_CAP}: the modules average ${ex.uncappedScore}, but ${escapeHtml(ex.capBy.join(", "))} holds the score at ${FAIL_SCORE_CAP} or below.</div>` : "";
|
|
@@ -99737,7 +100296,7 @@ function renderScoreBreakdown(run) {
|
|
|
99737
100296
|
<div class="hint">${ex.uncappedScore} = 100 − ${totalLost.toFixed(1)} points lost, each module weighted by the pages it analyzed.</div>
|
|
99738
100297
|
${headline}
|
|
99739
100298
|
<table class="sb-table">
|
|
99740
|
-
<thead><tr><th>Module</th><th>Status</th><th class="num">Score</th><th class="num">Weight</th><th>Points lost</th></tr></thead>
|
|
100299
|
+
<thead><tr><th>Module</th><th>Status</th><th class="num">Score</th><th class="num">Weight</th><th title="Check x unit judgements summed over the module's counting checks, not distinct pages">Judgements</th><th>Points lost</th></tr></thead>
|
|
99741
100300
|
<tbody>${rows}</tbody>
|
|
99742
100301
|
</table>
|
|
99743
100302
|
</div>`;
|
|
@@ -100046,13 +100605,14 @@ function renderChecksTable(run) {
|
|
|
100046
100605
|
<div class="card">
|
|
100047
100606
|
<h2>Checks executed</h2>
|
|
100048
100607
|
<table>
|
|
100049
|
-
<thead><tr><th>Check</th><th>Status</th><th class="num">Issues</th><th class="num">Duration</th><th>Summary</th></tr></thead>
|
|
100608
|
+
<thead><tr><th>Check</th><th>Status</th><th class="num">Issues</th><th>Compared</th><th class="num">Duration</th><th>Summary</th></tr></thead>
|
|
100050
100609
|
<tbody>
|
|
100051
100610
|
${run.checks.map((c) => `
|
|
100052
100611
|
<tr>
|
|
100053
100612
|
<td><code>${escapeHtml(c.name)}</code></td>
|
|
100054
100613
|
<td><span class="status-pill status-${c.status}">${c.status}</span></td>
|
|
100055
100614
|
<td class="num">${c.issues.length}</td>
|
|
100615
|
+
<td title="passed / compared units; — = this check does not count">${escapeHtml(describeCounts(c) ?? "—")}</td>
|
|
100056
100616
|
<td class="num">${c.durationMs}ms</td>
|
|
100057
100617
|
<td>${escapeHtml(c.summary)}</td>
|
|
100058
100618
|
</tr>`).join("")}
|
|
@@ -115925,16 +116485,253 @@ function planTouchCommand(dir, page, opts) {
|
|
|
115925
116485
|
}
|
|
115926
116486
|
|
|
115927
116487
|
// src/commands/pr.ts
|
|
115928
|
-
import { existsSync as
|
|
115929
|
-
import { join as
|
|
116488
|
+
import { existsSync as existsSync31, readFileSync as readFileSync40, writeFileSync as writeFileSync33 } from "node:fs";
|
|
116489
|
+
import { join as join46 } from "node:path";
|
|
115930
116490
|
import chalk35 from "chalk";
|
|
115931
116491
|
|
|
115932
116492
|
// src/commands/run.ts
|
|
115933
|
-
import { existsSync as
|
|
115934
|
-
import { join as
|
|
116493
|
+
import { existsSync as existsSync30, readFileSync as readFileSync39, rmSync as rmSync5 } from "node:fs";
|
|
116494
|
+
import { join as join45 } from "node:path";
|
|
115935
116495
|
import chalk34 from "chalk";
|
|
115936
116496
|
import ora8 from "ora";
|
|
115937
116497
|
|
|
116498
|
+
// src/storage/capture-store.ts
|
|
116499
|
+
import {
|
|
116500
|
+
copyFileSync,
|
|
116501
|
+
existsSync as existsSync29,
|
|
116502
|
+
mkdirSync as mkdirSync23,
|
|
116503
|
+
readFileSync as readFileSync38,
|
|
116504
|
+
readdirSync as readdirSync10,
|
|
116505
|
+
writeFileSync as writeFileSync32
|
|
116506
|
+
} from "node:fs";
|
|
116507
|
+
import { basename as basename5, isAbsolute, join as join44, resolve as resolve20 } from "node:path";
|
|
116508
|
+
import { z as z4 } from "zod";
|
|
116509
|
+
var FORMAT_VERSION = 1;
|
|
116510
|
+
var Rect = z4.object({ x: z4.number(), y: z4.number(), width: z4.number(), height: z4.number() });
|
|
116511
|
+
var HorizontalOverflowSchema = z4.object({
|
|
116512
|
+
px: z4.number(),
|
|
116513
|
+
clientWidth: z4.number(),
|
|
116514
|
+
widest: z4.object({ selector: z4.string(), overflowPx: z4.number(), rect: Rect }).nullable()
|
|
116515
|
+
});
|
|
116516
|
+
var HeatmapSideSchema = z4.object({
|
|
116517
|
+
selector: z4.string().nullable(),
|
|
116518
|
+
matches: z4.number().nullable(),
|
|
116519
|
+
rect: Rect.nullable(),
|
|
116520
|
+
screenshot: z4.string().nullable(),
|
|
116521
|
+
imageHosts: z4.array(z4.string()),
|
|
116522
|
+
devicePixelRatio: z4.number(),
|
|
116523
|
+
fontsStatus: z4.string(),
|
|
116524
|
+
horizontalOverflow: HorizontalOverflowSchema.nullable().optional(),
|
|
116525
|
+
error: z4.string().optional()
|
|
116526
|
+
});
|
|
116527
|
+
var BoxNodeSchema = z4.object({
|
|
116528
|
+
key: z4.string(),
|
|
116529
|
+
tag: z4.string(),
|
|
116530
|
+
depth: z4.number(),
|
|
116531
|
+
label: z4.string().nullable(),
|
|
116532
|
+
rect: Rect,
|
|
116533
|
+
styles: z4.record(z4.string(), z4.string()),
|
|
116534
|
+
text: z4.string().nullable()
|
|
116535
|
+
});
|
|
116536
|
+
var BoxTreeSchema = z4.union([
|
|
116537
|
+
z4.object({ found: z4.literal(true), nodes: z4.array(BoxNodeSchema), truncated: z4.boolean() }),
|
|
116538
|
+
z4.object({ found: z4.literal(false), error: z4.string() })
|
|
116539
|
+
]);
|
|
116540
|
+
var CaptureResultSchema = z4.object({
|
|
116541
|
+
side: HeatmapSideSchema,
|
|
116542
|
+
repeatScreenshot: z4.string().nullable(),
|
|
116543
|
+
repeatError: z4.string().optional(),
|
|
116544
|
+
boxTree: BoxTreeSchema.optional()
|
|
116545
|
+
});
|
|
116546
|
+
var MissingFile = z4.object({
|
|
116547
|
+
path: z4.string(),
|
|
116548
|
+
original: z4.string()
|
|
116549
|
+
});
|
|
116550
|
+
var RecordedContext = z4.object({
|
|
116551
|
+
formatVersion: z4.literal(FORMAT_VERSION),
|
|
116552
|
+
recordedAt: z4.string(),
|
|
116553
|
+
parityVersion: z4.string().optional(),
|
|
116554
|
+
prodUrl: z4.string(),
|
|
116555
|
+
candUrl: z4.string(),
|
|
116556
|
+
prodPages: z4.array(PageCapture),
|
|
116557
|
+
candPages: z4.array(PageCapture),
|
|
116558
|
+
prodFlows: z4.array(FlowCapture),
|
|
116559
|
+
candFlows: z4.array(FlowCapture),
|
|
116560
|
+
rc: ParityRc,
|
|
116561
|
+
ignore: ParityIgnore,
|
|
116562
|
+
viewports: z4.array(Viewport),
|
|
116563
|
+
candIsProduction: z4.boolean().optional(),
|
|
116564
|
+
checkNames: z4.array(z4.string()).optional(),
|
|
116565
|
+
visualProbes: z4.array(z4.tuple([z4.string(), CaptureResultSchema])).optional(),
|
|
116566
|
+
missingFiles: z4.array(MissingFile),
|
|
116567
|
+
omittedArtifacts: z4.object({ har: z4.number(), trace: z4.number(), video: z4.number() })
|
|
116568
|
+
});
|
|
116569
|
+
var CONTEXT_FILE = "context.json";
|
|
116570
|
+
var FETCH_FILE = "fetch.json";
|
|
116571
|
+
function assertRecordDirFree(dir) {
|
|
116572
|
+
if (!existsSync29(dir))
|
|
116573
|
+
return;
|
|
116574
|
+
const entries = readdirSync10(dir);
|
|
116575
|
+
if (entries.length === 0)
|
|
116576
|
+
return;
|
|
116577
|
+
throw new Error(entries.includes(CONTEXT_FILE) ? `${dir} already holds a recording (${CONTEXT_FILE}); choose a new directory or empty this one` : `${dir} is not empty; --record needs an empty (or new) directory`);
|
|
116578
|
+
}
|
|
116579
|
+
function saveCheckContext(dir, ctx, meta) {
|
|
116580
|
+
assertRecordDirFree(dir);
|
|
116581
|
+
mkdirSync23(join44(dir, "files"), { recursive: true });
|
|
116582
|
+
const copied = new Map;
|
|
116583
|
+
const missing = [];
|
|
116584
|
+
const omitted = { har: 0, trace: 0, video: 0 };
|
|
116585
|
+
let n = 0;
|
|
116586
|
+
const rel = (p) => {
|
|
116587
|
+
if (p === "")
|
|
116588
|
+
return "";
|
|
116589
|
+
const hit = copied.get(p);
|
|
116590
|
+
if (hit !== undefined)
|
|
116591
|
+
return hit;
|
|
116592
|
+
const dest = `files/${String(++n).padStart(4, "0")}-${basename5(p)}`;
|
|
116593
|
+
if (existsSync29(p))
|
|
116594
|
+
copyFileSync(p, join44(dir, dest));
|
|
116595
|
+
else
|
|
116596
|
+
missing.push({ path: dest, original: p });
|
|
116597
|
+
copied.set(p, dest);
|
|
116598
|
+
return dest;
|
|
116599
|
+
};
|
|
116600
|
+
const relOpt = (p) => p == null ? p : rel(p);
|
|
116601
|
+
const page = (c) => {
|
|
116602
|
+
const { harPath, tracePath, ...rest } = c;
|
|
116603
|
+
if (harPath)
|
|
116604
|
+
omitted.har++;
|
|
116605
|
+
if (tracePath)
|
|
116606
|
+
omitted.trace++;
|
|
116607
|
+
return { ...rest, screenshotPath: rel(c.screenshotPath) };
|
|
116608
|
+
};
|
|
116609
|
+
const step = (s) => {
|
|
116610
|
+
const { tracePath, screenshotBeforePath, ...rest } = s;
|
|
116611
|
+
if (tracePath)
|
|
116612
|
+
omitted.trace++;
|
|
116613
|
+
return {
|
|
116614
|
+
...rest,
|
|
116615
|
+
screenshotPath: rel(s.screenshotPath),
|
|
116616
|
+
...screenshotBeforePath !== undefined ? { screenshotBeforePath: rel(screenshotBeforePath) } : {}
|
|
116617
|
+
};
|
|
116618
|
+
};
|
|
116619
|
+
const flow = (f) => {
|
|
116620
|
+
const { videoPaths, ...rest } = f;
|
|
116621
|
+
omitted.video += videoPaths?.length ?? 0;
|
|
116622
|
+
return { ...rest, pages: f.pages.map(page), ...f.steps ? { steps: f.steps.map(step) } : {} };
|
|
116623
|
+
};
|
|
116624
|
+
const { pin: _pin, ...rc } = ctx.rc;
|
|
116625
|
+
const recorded = {
|
|
116626
|
+
formatVersion: FORMAT_VERSION,
|
|
116627
|
+
recordedAt: new Date().toISOString(),
|
|
116628
|
+
...meta.parityVersion ? { parityVersion: meta.parityVersion } : {},
|
|
116629
|
+
prodUrl: meta.prodUrl,
|
|
116630
|
+
candUrl: meta.candUrl,
|
|
116631
|
+
...meta.checkNames ? { checkNames: meta.checkNames } : {},
|
|
116632
|
+
prodPages: ctx.prodPages.map(page),
|
|
116633
|
+
candPages: ctx.candPages.map(page),
|
|
116634
|
+
prodFlows: ctx.prodFlows.map(flow),
|
|
116635
|
+
candFlows: ctx.candFlows.map(flow),
|
|
116636
|
+
rc,
|
|
116637
|
+
ignore: ctx.ignore,
|
|
116638
|
+
viewports: ctx.viewports,
|
|
116639
|
+
...ctx.candIsProduction !== undefined ? { candIsProduction: ctx.candIsProduction } : {},
|
|
116640
|
+
...ctx.visualProbes ? {
|
|
116641
|
+
visualProbes: [...ctx.visualProbes].map(([k, v]) => [
|
|
116642
|
+
rel(k),
|
|
116643
|
+
{
|
|
116644
|
+
...v,
|
|
116645
|
+
side: { ...v.side, screenshot: relOpt(v.side.screenshot) ?? null },
|
|
116646
|
+
repeatScreenshot: relOpt(v.repeatScreenshot) ?? null
|
|
116647
|
+
}
|
|
116648
|
+
])
|
|
116649
|
+
} : {},
|
|
116650
|
+
missingFiles: missing,
|
|
116651
|
+
omittedArtifacts: omitted
|
|
116652
|
+
};
|
|
116653
|
+
RecordedContext.parse(recorded);
|
|
116654
|
+
writeFileSync32(join44(dir, CONTEXT_FILE), JSON.stringify(recorded), "utf8");
|
|
116655
|
+
}
|
|
116656
|
+
var FetchEntry = z4.object({
|
|
116657
|
+
method: z4.string(),
|
|
116658
|
+
url: z4.string(),
|
|
116659
|
+
error: z4.object({ name: z4.string(), message: z4.string(), cause: z4.string().optional() }).optional(),
|
|
116660
|
+
status: z4.number().optional(),
|
|
116661
|
+
statusText: z4.string().optional(),
|
|
116662
|
+
finalUrl: z4.string().optional(),
|
|
116663
|
+
redirected: z4.boolean().optional(),
|
|
116664
|
+
headers: z4.array(z4.tuple([z4.string(), z4.string()])).optional(),
|
|
116665
|
+
body: z4.union([z4.object({ text: z4.string() }), z4.object({ base64: z4.string() })]).nullable().optional(),
|
|
116666
|
+
bodyError: z4.string().optional()
|
|
116667
|
+
});
|
|
116668
|
+
var FetchLogSchema = z4.object({
|
|
116669
|
+
formatVersion: z4.literal(FORMAT_VERSION),
|
|
116670
|
+
entries: z4.array(FetchEntry)
|
|
116671
|
+
});
|
|
116672
|
+
var NULL_BODY = new Set([101, 204, 205, 304]);
|
|
116673
|
+
function reqParts(input, init) {
|
|
116674
|
+
const isReq = typeof Request !== "undefined" && input instanceof Request;
|
|
116675
|
+
const raw = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
116676
|
+
let url = raw;
|
|
116677
|
+
try {
|
|
116678
|
+
url = new URL(raw).href;
|
|
116679
|
+
} catch {}
|
|
116680
|
+
return { method: (init?.method ?? (isReq ? input.method : "GET")).toUpperCase(), url };
|
|
116681
|
+
}
|
|
116682
|
+
async function recordFetch(fn) {
|
|
116683
|
+
const orig = globalThis.fetch;
|
|
116684
|
+
const entries = [];
|
|
116685
|
+
globalThis.fetch = async (input, init) => {
|
|
116686
|
+
const { method, url } = reqParts(input, init);
|
|
116687
|
+
const entry = { method, url };
|
|
116688
|
+
entries.push(entry);
|
|
116689
|
+
let res;
|
|
116690
|
+
try {
|
|
116691
|
+
res = await orig(input, init);
|
|
116692
|
+
} catch (err) {
|
|
116693
|
+
const e = err;
|
|
116694
|
+
entry.error = {
|
|
116695
|
+
name: e?.name ?? "Error",
|
|
116696
|
+
message: e?.message ?? String(err),
|
|
116697
|
+
...e?.cause ? { cause: e.cause.code ?? e.cause.message } : {}
|
|
116698
|
+
};
|
|
116699
|
+
throw err;
|
|
116700
|
+
}
|
|
116701
|
+
entry.status = res.status;
|
|
116702
|
+
entry.statusText = res.statusText;
|
|
116703
|
+
entry.finalUrl = res.url;
|
|
116704
|
+
entry.redirected = res.redirected;
|
|
116705
|
+
entry.headers = [...res.headers].filter(([k]) => k.toLowerCase() !== "set-cookie");
|
|
116706
|
+
try {
|
|
116707
|
+
const buf = Buffer.from(await res.clone().arrayBuffer());
|
|
116708
|
+
if (buf.length === 0)
|
|
116709
|
+
entry.body = null;
|
|
116710
|
+
else {
|
|
116711
|
+
try {
|
|
116712
|
+
entry.body = {
|
|
116713
|
+
text: new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(buf)
|
|
116714
|
+
};
|
|
116715
|
+
} catch {
|
|
116716
|
+
entry.body = { base64: buf.toString("base64") };
|
|
116717
|
+
}
|
|
116718
|
+
}
|
|
116719
|
+
} catch (err) {
|
|
116720
|
+
entry.bodyError = err.message;
|
|
116721
|
+
}
|
|
116722
|
+
return res;
|
|
116723
|
+
};
|
|
116724
|
+
try {
|
|
116725
|
+
const result = await fn();
|
|
116726
|
+
return { result, log: { formatVersion: FORMAT_VERSION, entries } };
|
|
116727
|
+
} finally {
|
|
116728
|
+
globalThis.fetch = orig;
|
|
116729
|
+
}
|
|
116730
|
+
}
|
|
116731
|
+
function saveFetchLog(dir, log) {
|
|
116732
|
+
writeFileSync32(join44(dir, FETCH_FILE), JSON.stringify(log), "utf8");
|
|
116733
|
+
}
|
|
116734
|
+
|
|
115938
116735
|
// src/diff/score-band.ts
|
|
115939
116736
|
var uniq = (xs) => [...new Set(xs)];
|
|
115940
116737
|
function computeScoreBand(current, priors, opts = {}) {
|
|
@@ -116624,7 +117421,7 @@ function evaluateFailOnGate(allIssues, failOn, verdictStatus) {
|
|
|
116624
117421
|
var SCORE_BAND_RUNS = 4;
|
|
116625
117422
|
function readRunChecks(reportPath) {
|
|
116626
117423
|
try {
|
|
116627
|
-
const raw = JSON.parse(
|
|
117424
|
+
const raw = JSON.parse(readFileSync39(reportPath, "utf8"));
|
|
116628
117425
|
return (raw.checks ?? []).filter((c) => typeof c.name === "string" && typeof c.status === "string").map((c) => ({ name: c.name, status: c.status }));
|
|
116629
117426
|
} catch {
|
|
116630
117427
|
return [];
|
|
@@ -116639,6 +117436,14 @@ async function runCommand(rawOpts) {
|
|
|
116639
117436
|
return 2;
|
|
116640
117437
|
}
|
|
116641
117438
|
const opts = applyPreset(rawOpts);
|
|
117439
|
+
if (opts.record) {
|
|
117440
|
+
try {
|
|
117441
|
+
assertRecordDirFree(opts.record);
|
|
117442
|
+
} catch (err) {
|
|
117443
|
+
console.error(chalk34.red(` ${err.message}`));
|
|
117444
|
+
return 2;
|
|
117445
|
+
}
|
|
117446
|
+
}
|
|
116642
117447
|
if (rawOpts.preset) {
|
|
116643
117448
|
console.log(chalk34.dim(` preset: ${rawOpts.preset}`));
|
|
116644
117449
|
}
|
|
@@ -116937,8 +117742,8 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
116937
117742
|
const runOneSide = async (viewport, side) => {
|
|
116938
117743
|
const baseUrl = side === "prod" ? opts.prod : opts.cand;
|
|
116939
117744
|
const harEnabled = process.env.PARITY_HAR === "1";
|
|
116940
|
-
const harPath = harEnabled ?
|
|
116941
|
-
const tracePath = traceEnabled ?
|
|
117745
|
+
const harPath = harEnabled ? join45(paths.harDir, `${viewport}-${side}.har`) : undefined;
|
|
117746
|
+
const tracePath = traceEnabled ? join45(paths.tracesDir, `${viewport}-${side}.zip`) : null;
|
|
116942
117747
|
const ctx = await newContext(browser, {
|
|
116943
117748
|
viewport,
|
|
116944
117749
|
harPath,
|
|
@@ -117246,7 +118051,7 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
117246
118051
|
pairKey: task.pairKey
|
|
117247
118052
|
});
|
|
117248
118053
|
allPageCaptures.push(cap);
|
|
117249
|
-
if (
|
|
118054
|
+
if (existsSync30(screenshotPath)) {
|
|
117250
118055
|
visualProbes.set(screenshotPath, await probeFullPage(page, screenshotPath, task.side === "prod" ? screenshotPath.replace(/\.png$/, "-repeat.png") : null));
|
|
117251
118056
|
}
|
|
117252
118057
|
} finally {
|
|
@@ -117293,7 +118098,34 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
117293
118098
|
viewports,
|
|
117294
118099
|
candIsProduction: opts.candIsProduction
|
|
117295
118100
|
};
|
|
117296
|
-
|
|
118101
|
+
let recordedOk = false;
|
|
118102
|
+
if (opts.record) {
|
|
118103
|
+
try {
|
|
118104
|
+
saveCheckContext(opts.record, checkCtx, {
|
|
118105
|
+
prodUrl: opts.prod,
|
|
118106
|
+
candUrl: opts.cand,
|
|
118107
|
+
parityVersion: getPackageVersion(),
|
|
118108
|
+
checkNames: hasSelection ? [...selection.checkNames] : undefined
|
|
118109
|
+
});
|
|
118110
|
+
recordedOk = true;
|
|
118111
|
+
} catch (err) {
|
|
118112
|
+
console.error(chalk34.yellow(` --record: not saved (${err.message})`));
|
|
118113
|
+
}
|
|
118114
|
+
}
|
|
118115
|
+
const runChecks = () => runAllChecks(checkCtx, partialChecks, hasSelection ? selection.checkNames : undefined);
|
|
118116
|
+
let checks;
|
|
118117
|
+
if (recordedOk && opts.record) {
|
|
118118
|
+
const { result, log } = await recordFetch(runChecks);
|
|
118119
|
+
checks = result;
|
|
118120
|
+
try {
|
|
118121
|
+
saveFetchLog(opts.record, log);
|
|
118122
|
+
console.log(chalk34.dim(` recording saved: ${opts.record} (contains full page HTML — do not commit)`));
|
|
118123
|
+
} catch (err) {
|
|
118124
|
+
console.error(chalk34.yellow(` --record: fetch log not saved (${err.message})`));
|
|
118125
|
+
}
|
|
118126
|
+
} else {
|
|
118127
|
+
checks = await runChecks();
|
|
118128
|
+
}
|
|
117297
118129
|
checksHb.stop();
|
|
117298
118130
|
stampPhase("checks");
|
|
117299
118131
|
spinner.succeed(`Checks concluídos (${checks.length})`);
|
|
@@ -117486,7 +118318,7 @@ function pruneOldRuns(opts, runId) {
|
|
|
117486
118318
|
const protect = new Set([runId]);
|
|
117487
118319
|
for (const b of listBaselines()) {
|
|
117488
118320
|
try {
|
|
117489
|
-
protect.add(JSON.parse(
|
|
118321
|
+
protect.add(JSON.parse(readFileSync39(b.path, "utf8")).fromRunId);
|
|
117490
118322
|
} catch {}
|
|
117491
118323
|
}
|
|
117492
118324
|
try {
|
|
@@ -117538,10 +118370,10 @@ function parsePagePair(entry) {
|
|
|
117538
118370
|
}
|
|
117539
118371
|
function resolveExplicitPages(pagesFile, pagesList) {
|
|
117540
118372
|
if (pagesFile) {
|
|
117541
|
-
if (!
|
|
118373
|
+
if (!existsSync30(pagesFile)) {
|
|
117542
118374
|
throw new Error(`--pages-file não encontrado: ${pagesFile}`);
|
|
117543
118375
|
}
|
|
117544
|
-
const raw =
|
|
118376
|
+
const raw = readFileSync39(pagesFile, "utf-8");
|
|
117545
118377
|
const lines = raw.split(/\r?\n/).map((l) => l.trim()).filter((l) => l.length > 0 && !l.startsWith("#"));
|
|
117546
118378
|
for (const line of lines)
|
|
117547
118379
|
validatePageEntry(line, [], true);
|
|
@@ -117798,6 +118630,15 @@ function printSummary8(run, reportWhere, meta) {
|
|
|
117798
118630
|
return `${mv.module} ${colored}`;
|
|
117799
118631
|
}).join(" · ");
|
|
117800
118632
|
console.log(` modules: ${perModule} → composite ${score}`);
|
|
118633
|
+
const counted = run.moduleVerdicts.filter((mv) => mv.counts && mv.counts.length > 0);
|
|
118634
|
+
for (const mv of counted) {
|
|
118635
|
+
const line = describeModuleCounts(mv.counts, mv.checksCounting, mv.checksRun);
|
|
118636
|
+
console.log(` ${chalk34.dim(`${mv.module} ${line}`)}`);
|
|
118637
|
+
}
|
|
118638
|
+
const uncounted = run.moduleVerdicts.filter((mv) => !mv.counts || mv.counts.length === 0);
|
|
118639
|
+
if (uncounted.length > 0) {
|
|
118640
|
+
console.log(` ${chalk34.dim(`no counts yet: ${uncounted.map((mv) => mv.module).join(", ")}`)}`);
|
|
118641
|
+
}
|
|
117801
118642
|
}
|
|
117802
118643
|
if (run.visualDiff) {
|
|
117803
118644
|
const vd = run.visualDiff;
|
|
@@ -117864,15 +118705,15 @@ async function prCommand(opts) {
|
|
|
117864
118705
|
return runCode || 1;
|
|
117865
118706
|
}
|
|
117866
118707
|
const latest = runs[0];
|
|
117867
|
-
const reportJsonPath =
|
|
117868
|
-
if (!
|
|
118708
|
+
const reportJsonPath = join46(opts.output, "runs", latest.id, "report.json");
|
|
118709
|
+
if (!existsSync31(reportJsonPath)) {
|
|
117869
118710
|
console.error(chalk35.red(`report.json not found at ${reportJsonPath}`));
|
|
117870
118711
|
return runCode || 1;
|
|
117871
118712
|
}
|
|
117872
|
-
const run = JSON.parse(
|
|
118713
|
+
const run = JSON.parse(readFileSync40(reportJsonPath, "utf8"));
|
|
117873
118714
|
const markdown = buildPrComment(run, opts);
|
|
117874
118715
|
if (opts.out) {
|
|
117875
|
-
|
|
118716
|
+
writeFileSync33(opts.out, markdown, "utf8");
|
|
117876
118717
|
console.log(chalk35.dim(` wrote PR comment: ${opts.out}`));
|
|
117877
118718
|
} else {
|
|
117878
118719
|
process.stdout.write(`
|
|
@@ -117881,7 +118722,7 @@ ${markdown}
|
|
|
117881
118722
|
}
|
|
117882
118723
|
if (opts.github && process.env.GITHUB_STEP_SUMMARY) {
|
|
117883
118724
|
try {
|
|
117884
|
-
|
|
118725
|
+
writeFileSync33(process.env.GITHUB_STEP_SUMMARY, markdown, { flag: "a" });
|
|
117885
118726
|
} catch (err) {
|
|
117886
118727
|
console.error(chalk35.yellow(`failed to write GITHUB_STEP_SUMMARY: ${err.message}`));
|
|
117887
118728
|
}
|
|
@@ -117910,17 +118751,7 @@ function buildPrComment(run, opts) {
|
|
|
117910
118751
|
lines.push("| --- | --- | --- | --- | --- | --- |");
|
|
117911
118752
|
lines.push(`| ${v.critical} | ${v.high} | ${v.medium} | ${v.low} | ${v.checksPassed} | ${v.checksFailed} |`);
|
|
117912
118753
|
lines.push("");
|
|
117913
|
-
|
|
117914
|
-
lines.push("### Modules");
|
|
117915
|
-
lines.push("");
|
|
117916
|
-
lines.push("| Module | Score | Status |");
|
|
117917
|
-
lines.push("| --- | --- | --- |");
|
|
117918
|
-
for (const mv of run.moduleVerdicts) {
|
|
117919
|
-
const statusEmoji = mv.status === "pass" ? "✅" : mv.status === "warn" ? "⚠" : "❌";
|
|
117920
|
-
lines.push(`| ${mv.module} | ${mv.score}/100 | ${statusEmoji} ${mv.status} |`);
|
|
117921
|
-
}
|
|
117922
|
-
lines.push("");
|
|
117923
|
-
}
|
|
118754
|
+
lines.push(...moduleTableLines(run));
|
|
117924
118755
|
const topGroups = groupIssues(run.topIssues.length > 0 ? run.topIssues : run.issues).slice(0, 10);
|
|
117925
118756
|
if (topGroups.length === 0) {
|
|
117926
118757
|
lines.push("### Issues");
|
|
@@ -117941,9 +118772,25 @@ function buildPrComment(run, opts) {
|
|
|
117941
118772
|
return lines.join(`
|
|
117942
118773
|
`);
|
|
117943
118774
|
}
|
|
118775
|
+
function moduleTableLines(run) {
|
|
118776
|
+
const lines = [];
|
|
118777
|
+
if (run.moduleVerdicts && run.moduleVerdicts.length > 0) {
|
|
118778
|
+
lines.push("### Modules");
|
|
118779
|
+
lines.push("");
|
|
118780
|
+
lines.push("| Module | Score | Status | Judgements (checks × units) |");
|
|
118781
|
+
lines.push("| --- | --- | --- | --- |");
|
|
118782
|
+
for (const mv of run.moduleVerdicts) {
|
|
118783
|
+
const statusEmoji = mv.status === "pass" ? "✅" : mv.status === "warn" ? "⚠" : "❌";
|
|
118784
|
+
const compared = describeModuleCounts(mv.counts, mv.checksCounting, mv.checksRun) ?? "—";
|
|
118785
|
+
lines.push(`| ${mv.module} | ${mv.score}/100 | ${statusEmoji} ${mv.status} | ${compared} |`);
|
|
118786
|
+
}
|
|
118787
|
+
lines.push("");
|
|
118788
|
+
}
|
|
118789
|
+
return lines;
|
|
118790
|
+
}
|
|
117944
118791
|
|
|
117945
118792
|
// src/commands/prompt.ts
|
|
117946
|
-
import { existsSync as
|
|
118793
|
+
import { existsSync as existsSync32, writeFileSync as writeFileSync34 } from "node:fs";
|
|
117947
118794
|
import chalk36 from "chalk";
|
|
117948
118795
|
|
|
117949
118796
|
// src/report/prompt-builder.ts
|
|
@@ -118069,9 +118916,9 @@ function promptCommand(runId, opts) {
|
|
|
118069
118916
|
limit: opts.limit
|
|
118070
118917
|
});
|
|
118071
118918
|
if (opts.out) {
|
|
118072
|
-
|
|
118919
|
+
writeFileSync34(opts.out, md, "utf8");
|
|
118073
118920
|
console.log(chalk36.green(`✔ prompt salvo em ${opts.out}`));
|
|
118074
|
-
if (
|
|
118921
|
+
if (existsSync32(opts.out)) {
|
|
118075
118922
|
const sizeKb = (md.length / 1024).toFixed(1);
|
|
118076
118923
|
console.log(chalk36.dim(` ${md.length} chars (${sizeKb} KB)`));
|
|
118077
118924
|
}
|
|
@@ -118082,12 +118929,12 @@ function promptCommand(runId, opts) {
|
|
|
118082
118929
|
}
|
|
118083
118930
|
|
|
118084
118931
|
// src/commands/qa.ts
|
|
118085
|
-
import { existsSync as
|
|
118086
|
-
import { basename as
|
|
118932
|
+
import { existsSync as existsSync36, readFileSync as readFileSync43 } from "node:fs";
|
|
118933
|
+
import { basename as basename6, dirname as dirname10, join as join50 } from "node:path";
|
|
118087
118934
|
import chalk38 from "chalk";
|
|
118088
118935
|
|
|
118089
118936
|
// src/board/sweep-cards.ts
|
|
118090
|
-
import { existsSync as
|
|
118937
|
+
import { existsSync as existsSync33, readFileSync as readFileSync41 } from "node:fs";
|
|
118091
118938
|
var QA_PREFIX = "[QA]";
|
|
118092
118939
|
var CARD_BODY_MAX = 1200;
|
|
118093
118940
|
var CLOSED = new Set(["done", "archived", "merged"]);
|
|
@@ -118414,8 +119261,8 @@ function readSpecs(entries) {
|
|
|
118414
119261
|
const out = {};
|
|
118415
119262
|
for (const e of entries)
|
|
118416
119263
|
for (const ev of e.issue?.evidence ?? [])
|
|
118417
|
-
if (ev.kind === "spec" &&
|
|
118418
|
-
out[ev.path] =
|
|
119264
|
+
if (ev.kind === "spec" && existsSync33(ev.path))
|
|
119265
|
+
out[ev.path] = readFileSync41(ev.path, "utf8");
|
|
118419
119266
|
return out;
|
|
118420
119267
|
}
|
|
118421
119268
|
function evidenceLibraryPath(p, run) {
|
|
@@ -118439,7 +119286,7 @@ function plannedEvidenceUrls(entries, run, cfg) {
|
|
|
118439
119286
|
return {};
|
|
118440
119287
|
const out = {};
|
|
118441
119288
|
for (const p of cardEvidencePaths(entries))
|
|
118442
|
-
if (
|
|
119289
|
+
if (existsSync33(p))
|
|
118443
119290
|
out[p] = `${base}/fs/org/read?path=${encodeURIComponent(evidenceLibraryPath(p, run))}`;
|
|
118444
119291
|
return out;
|
|
118445
119292
|
}
|
|
@@ -118447,7 +119294,7 @@ async function uploadEvidence(entries, run, cfg, call, opts) {
|
|
|
118447
119294
|
const upload = opts.upload ?? ((local, lib) => uploadToLibrary(cfg, local, lib, call));
|
|
118448
119295
|
const out = {};
|
|
118449
119296
|
for (const p of cardEvidencePaths(entries)) {
|
|
118450
|
-
if (!
|
|
119297
|
+
if (!existsSync33(p))
|
|
118451
119298
|
continue;
|
|
118452
119299
|
const url = await upload(p, evidenceLibraryPath(p, run));
|
|
118453
119300
|
if (url)
|
|
@@ -118463,10 +119310,10 @@ function truncate6(s, n) {
|
|
|
118463
119310
|
}
|
|
118464
119311
|
|
|
118465
119312
|
// src/commands/sweep.ts
|
|
118466
|
-
import { existsSync as
|
|
118467
|
-
import { join as
|
|
119313
|
+
import { existsSync as existsSync35, readFileSync as readFileSync42, writeFileSync as writeFileSync35 } from "node:fs";
|
|
119314
|
+
import { join as join49 } from "node:path";
|
|
118468
119315
|
import chalk37 from "chalk";
|
|
118469
|
-
import { z as
|
|
119316
|
+
import { z as z5 } from "zod";
|
|
118470
119317
|
|
|
118471
119318
|
// ../../node_modules/.bun/@axe-core+playwright@4.14.0+61592b2670ac03c8/node_modules/@axe-core/playwright/dist/index.mjs
|
|
118472
119319
|
var import_axe_core = __toESM(require_axe(), 1);
|
|
@@ -118812,7 +119659,7 @@ function a11yIssues(results) {
|
|
|
118812
119659
|
}
|
|
118813
119660
|
|
|
118814
119661
|
// src/engine/menu-audit.ts
|
|
118815
|
-
import { join as
|
|
119662
|
+
import { join as join47 } from "node:path";
|
|
118816
119663
|
var MAX_LINKS = 40;
|
|
118817
119664
|
async function collectLinks(page, origin, scope) {
|
|
118818
119665
|
const raw = await page.evaluate((sel) => {
|
|
@@ -118941,7 +119788,7 @@ async function probeMenuLinks(url, opts = {}) {
|
|
|
118941
119788
|
try {
|
|
118942
119789
|
for (const link of [...links.values()].slice(0, MAX_LINKS)) {
|
|
118943
119790
|
const slug = new URL(link.href).pathname.replace(/[^a-z0-9]+/gi, "-").replace(/^-|-$/g, "");
|
|
118944
|
-
const shot = opts.screenshotsDir ?
|
|
119791
|
+
const shot = opts.screenshotsDir ? join47(opts.screenshotsDir, `menu-${slug || "root"}.jpg`) : undefined;
|
|
118945
119792
|
out.push(await visit(page, link, shot));
|
|
118946
119793
|
}
|
|
118947
119794
|
} finally {
|
|
@@ -119028,21 +119875,21 @@ function menuLinkIssues(visits) {
|
|
|
119028
119875
|
|
|
119029
119876
|
// src/engine/regression-specs.ts
|
|
119030
119877
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
119031
|
-
import { existsSync as
|
|
119032
|
-
import { join as
|
|
119878
|
+
import { existsSync as existsSync34 } from "node:fs";
|
|
119879
|
+
import { join as join48, resolve as resolve21 } from "node:path";
|
|
119033
119880
|
import { stripVTControlCharacters } from "node:util";
|
|
119034
119881
|
function runRegressionSpecs(repoDirArg, baseUrl) {
|
|
119035
|
-
const repoDir =
|
|
119036
|
-
const dir =
|
|
119037
|
-
if (!
|
|
119882
|
+
const repoDir = resolve21(repoDirArg);
|
|
119883
|
+
const dir = join48(repoDir, "tests", "qa");
|
|
119884
|
+
if (!existsSync34(dir))
|
|
119038
119885
|
return null;
|
|
119039
119886
|
spawnSync2("npx", ["playwright", "install", "chromium"], {
|
|
119040
119887
|
cwd: repoDir,
|
|
119041
119888
|
encoding: "utf8",
|
|
119042
119889
|
timeout: 10 * 60000
|
|
119043
119890
|
});
|
|
119044
|
-
const config =
|
|
119045
|
-
const args =
|
|
119891
|
+
const config = join48(dir, "playwright.config.ts");
|
|
119892
|
+
const args = existsSync34(config) ? ["playwright", "test", "-c", config, "--reporter=json"] : ["playwright", "test", "tests/qa", "--reporter=json"];
|
|
119046
119893
|
const res = spawnSync2("npx", args, {
|
|
119047
119894
|
cwd: repoDir,
|
|
119048
119895
|
env: { ...process.env, BASE_URL: baseUrl, CI: "1" },
|
|
@@ -119221,7 +120068,7 @@ async function sweepCommand(opts) {
|
|
|
119221
120068
|
}
|
|
119222
120069
|
function readReport(path) {
|
|
119223
120070
|
try {
|
|
119224
|
-
return JSON.parse(
|
|
120071
|
+
return JSON.parse(readFileSync42(path, "utf8"));
|
|
119225
120072
|
} catch {
|
|
119226
120073
|
return null;
|
|
119227
120074
|
}
|
|
@@ -119255,7 +120102,7 @@ function annotateTrend(outputDir, runId) {
|
|
|
119255
120102
|
const prev = findPreviousSweep(outputDir, hostOf5(report.url), runId);
|
|
119256
120103
|
if (!prev) {
|
|
119257
120104
|
report.trend = null;
|
|
119258
|
-
|
|
120105
|
+
writeFileSync35(paths.reportJson, `${JSON.stringify(report, null, 2)}
|
|
119259
120106
|
`, "utf8");
|
|
119260
120107
|
return null;
|
|
119261
120108
|
}
|
|
@@ -119270,7 +120117,7 @@ function annotateTrend(outputDir, runId) {
|
|
|
119270
120117
|
resolved: d.resolved,
|
|
119271
120118
|
new: d.new
|
|
119272
120119
|
};
|
|
119273
|
-
|
|
120120
|
+
writeFileSync35(paths.reportJson, `${JSON.stringify(report, null, 2)}
|
|
119274
120121
|
`, "utf8");
|
|
119275
120122
|
return report.trend;
|
|
119276
120123
|
}
|
|
@@ -119280,8 +120127,8 @@ async function addProbeFindings(url, runDir, reportJson, rc, json, specsRepo) {
|
|
|
119280
120127
|
{ label: "busca", selectors: selectorsFor("searchTrigger", { rc }) },
|
|
119281
120128
|
{ label: "menu", selectors: HAMBURGER_SELECTORS }
|
|
119282
120129
|
]).catch(() => []);
|
|
119283
|
-
const menu = await probeMenuLinks(url, { screenshotsDir:
|
|
119284
|
-
|
|
120130
|
+
const menu = await probeMenuLinks(url, { screenshotsDir: join49(runDir, "screenshots") }).catch(() => []);
|
|
120131
|
+
writeFileSync35(join49(runDir, "menu-links.json"), `${JSON.stringify(menu, null, 2)}
|
|
119285
120132
|
`, "utf8");
|
|
119286
120133
|
const listing = menu.find((v) => v.listingUi && v.products > 0);
|
|
119287
120134
|
const a11y = await probeA11y(url, listing ? new URL(listing.link.href).pathname : undefined).catch(() => []);
|
|
@@ -119303,7 +120150,7 @@ async function addProbeFindings(url, runDir, reportJson, rc, json, specsRepo) {
|
|
|
119303
120150
|
t[i.severity] = (t[i.severity] ?? 0) + 1;
|
|
119304
120151
|
}
|
|
119305
120152
|
}
|
|
119306
|
-
|
|
120153
|
+
writeFileSync35(reportJson, `${JSON.stringify(report, null, 2)}
|
|
119307
120154
|
`, "utf8");
|
|
119308
120155
|
if (!json) {
|
|
119309
120156
|
for (const i of issues)
|
|
@@ -119339,13 +120186,13 @@ function readUnverified(reportJson) {
|
|
|
119339
120186
|
var SEVERITIES = ["critical", "high", "medium", "low"];
|
|
119340
120187
|
var SWEEPER_ISSUES_FILE = "sweeper-issues.json";
|
|
119341
120188
|
function readSweeperIssues(runDir) {
|
|
119342
|
-
const path =
|
|
119343
|
-
if (!
|
|
120189
|
+
const path = join49(runDir, SWEEPER_ISSUES_FILE);
|
|
120190
|
+
if (!existsSync35(path))
|
|
119344
120191
|
return { issues: [], dropped: new Set };
|
|
119345
|
-
const parsed =
|
|
120192
|
+
const parsed = z5.object({
|
|
119346
120193
|
issues: agentIssues,
|
|
119347
|
-
dropped:
|
|
119348
|
-
}).safeParse(JSON.parse(
|
|
120194
|
+
dropped: z5.array(z5.string()).default([])
|
|
120195
|
+
}).safeParse(JSON.parse(readFileSync42(path, "utf8")));
|
|
119349
120196
|
if (!parsed.success)
|
|
119350
120197
|
throw new Error(`${path}: ${parsed.error.message}`);
|
|
119351
120198
|
return { issues: parsed.data.issues, dropped: new Set(parsed.data.dropped) };
|
|
@@ -119365,15 +120212,15 @@ function normalizeAgentIssue(raw) {
|
|
|
119365
120212
|
} : e);
|
|
119366
120213
|
return i;
|
|
119367
120214
|
}
|
|
119368
|
-
var agentIssues =
|
|
120215
|
+
var agentIssues = z5.preprocess((v) => Array.isArray(v) ? v.map(normalizeAgentIssue) : v, z5.array(Issue).default([]));
|
|
119369
120216
|
function readCardReview(runDir) {
|
|
119370
|
-
const path =
|
|
119371
|
-
if (!
|
|
120217
|
+
const path = join49(runDir, CARD_REVIEW_FILE);
|
|
120218
|
+
if (!existsSync35(path))
|
|
119372
120219
|
return { issues: [], hold: new Map };
|
|
119373
|
-
const parsed =
|
|
120220
|
+
const parsed = z5.object({
|
|
119374
120221
|
issues: agentIssues,
|
|
119375
|
-
hold:
|
|
119376
|
-
}).safeParse(JSON.parse(
|
|
120222
|
+
hold: z5.array(z5.object({ id: z5.string(), reason: z5.string() })).default([])
|
|
120223
|
+
}).safeParse(JSON.parse(readFileSync42(path, "utf8")));
|
|
119377
120224
|
if (!parsed.success)
|
|
119378
120225
|
throw new Error(`${path}: ${parsed.error.message}`);
|
|
119379
120226
|
return {
|
|
@@ -119430,12 +120277,12 @@ async function sweepFileCommand(opts) {
|
|
|
119430
120277
|
for (const i of agent.issues)
|
|
119431
120278
|
for (const e of i.evidence ?? [])
|
|
119432
120279
|
if (!e.path.startsWith("/"))
|
|
119433
|
-
e.path =
|
|
120280
|
+
e.path = join49(paths.runDir, e.path);
|
|
119434
120281
|
const review = readCardReview(paths.runDir);
|
|
119435
120282
|
for (const i of review.issues)
|
|
119436
120283
|
for (const e of i.evidence ?? [])
|
|
119437
120284
|
if (!e.path.startsWith("/"))
|
|
119438
|
-
e.path =
|
|
120285
|
+
e.path = join49(paths.runDir, e.path);
|
|
119439
120286
|
const { issues, held } = applyCardReview(mergeIssues(report.allIssues ?? [], agent.issues, agent.dropped), review);
|
|
119440
120287
|
const info = {
|
|
119441
120288
|
runId,
|
|
@@ -119574,11 +120421,11 @@ async function qaFileCommand(opts) {
|
|
|
119574
120421
|
console.error(chalk38.red(`--min-severity ${opts.minSeverity}: use ${SEVERITIES2.join("|")}`));
|
|
119575
120422
|
return 2;
|
|
119576
120423
|
}
|
|
119577
|
-
if (!
|
|
120424
|
+
if (!existsSync36(opts.issues)) {
|
|
119578
120425
|
console.error(chalk38.red(`${opts.issues}: not found`));
|
|
119579
120426
|
return 2;
|
|
119580
120427
|
}
|
|
119581
|
-
const raw = JSON.parse(
|
|
120428
|
+
const raw = JSON.parse(readFileSync43(opts.issues, "utf8"));
|
|
119582
120429
|
const parsed = agentIssues.safeParse(Array.isArray(raw) ? raw : raw?.issues);
|
|
119583
120430
|
if (!parsed.success) {
|
|
119584
120431
|
console.error(chalk38.red(`${opts.issues}: ${parsed.error.message}`));
|
|
@@ -119589,7 +120436,7 @@ async function qaFileCommand(opts) {
|
|
|
119589
120436
|
for (const i of [...parsed.data, ...review.issues])
|
|
119590
120437
|
for (const e of i.evidence ?? [])
|
|
119591
120438
|
if (!e.path.startsWith("/"))
|
|
119592
|
-
e.path =
|
|
120439
|
+
e.path = join50(dir, e.path);
|
|
119593
120440
|
const { issues, held } = applyCardReview(parsed.data, review);
|
|
119594
120441
|
const cfg = studioConfigFromEnv();
|
|
119595
120442
|
if (!cfg) {
|
|
@@ -119597,7 +120444,7 @@ async function qaFileCommand(opts) {
|
|
|
119597
120444
|
return 2;
|
|
119598
120445
|
}
|
|
119599
120446
|
const info = {
|
|
119600
|
-
runId:
|
|
120447
|
+
runId: basename6(opts.issues).replace(/\.json$/, ""),
|
|
119601
120448
|
source: "parity qa",
|
|
119602
120449
|
url: opts.url,
|
|
119603
120450
|
timestamp: new Date().toISOString(),
|
|
@@ -119644,8 +120491,8 @@ async function qaFileCommand(opts) {
|
|
|
119644
120491
|
}
|
|
119645
120492
|
|
|
119646
120493
|
// src/commands/report.ts
|
|
119647
|
-
import { existsSync as
|
|
119648
|
-
import { join as
|
|
120494
|
+
import { existsSync as existsSync37, readFileSync as readFileSync44, writeFileSync as writeFileSync36 } from "node:fs";
|
|
120495
|
+
import { join as join51, resolve as resolve22 } from "node:path";
|
|
119649
120496
|
import chalk39 from "chalk";
|
|
119650
120497
|
import open3 from "open";
|
|
119651
120498
|
|
|
@@ -120296,12 +121143,12 @@ var REMOVED_SECTIONS = {
|
|
|
120296
121143
|
prompt: "use `parity prompt <runId>` for the LLM-ready Markdown."
|
|
120297
121144
|
};
|
|
120298
121145
|
function resolveRunPaths(output, runIdOrDir) {
|
|
120299
|
-
if (
|
|
120300
|
-
return runPathsFor(
|
|
121146
|
+
if (existsSync37(join51(runIdOrDir, "report.json")))
|
|
121147
|
+
return runPathsFor(resolve22(runIdOrDir));
|
|
120301
121148
|
return getRunPaths(output, runIdOrDir);
|
|
120302
121149
|
}
|
|
120303
121150
|
function ensureReportHtml(paths) {
|
|
120304
|
-
if (
|
|
121151
|
+
if (existsSync37(paths.reportHtml))
|
|
120305
121152
|
return { path: paths.reportHtml, rendered: false };
|
|
120306
121153
|
const run = loadRunDir(paths.runDir);
|
|
120307
121154
|
writeRunReportHtml(paths.runDir, renderHtmlReport(run, paths.runDir));
|
|
@@ -120331,8 +121178,8 @@ async function reportCommand(runId, opts) {
|
|
|
120331
121178
|
}
|
|
120332
121179
|
}
|
|
120333
121180
|
const html = renderDeckHtml(buildDeckModel(run, plan), opts.lang ?? "en");
|
|
120334
|
-
const dest = opts.out ??
|
|
120335
|
-
|
|
121181
|
+
const dest = opts.out ?? join51(paths.runDir, "deck.html");
|
|
121182
|
+
writeFileSync36(dest, html, "utf8");
|
|
120336
121183
|
console.log(`${chalk39.green("✓")} deck → ${dest}`);
|
|
120337
121184
|
if (opts.open) {
|
|
120338
121185
|
await open3(dest).catch((err) => {
|
|
@@ -120374,7 +121221,7 @@ async function reportCommand(runId, opts) {
|
|
|
120374
121221
|
console.error(chalk39.red(`failed to render report.html: ${err.message}`));
|
|
120375
121222
|
return 1;
|
|
120376
121223
|
}
|
|
120377
|
-
const html =
|
|
121224
|
+
const html = readFileSync44(paths.reportHtml, "utf8");
|
|
120378
121225
|
const slice = extractReportSection({ kind: "html", section: opts.section, html });
|
|
120379
121226
|
if (slice === null) {
|
|
120380
121227
|
console.error(chalk39.red(`section "${opts.section}" not present in this report`));
|
|
@@ -120397,7 +121244,7 @@ async function reportCommand(runId, opts) {
|
|
|
120397
121244
|
}
|
|
120398
121245
|
|
|
120399
121246
|
// src/commands/rerender.ts
|
|
120400
|
-
import { writeFileSync as
|
|
121247
|
+
import { writeFileSync as writeFileSync37 } from "node:fs";
|
|
120401
121248
|
import chalk40 from "chalk";
|
|
120402
121249
|
function analyzeFrames(before, frames, opts = {}) {
|
|
120403
121250
|
const threshold = opts.flashWhite ?? Math.min(97, before.white + 20);
|
|
@@ -120642,7 +121489,7 @@ async function rerenderCommand(opts) {
|
|
|
120642
121489
|
});
|
|
120643
121490
|
return c.toDataURL("image/png").split(",")[1];
|
|
120644
121491
|
}, chosen.map((f) => ({ data: f.data, t: Math.max(0, f.t) })));
|
|
120645
|
-
|
|
121492
|
+
writeFileSync37(opts.sheet, Buffer.from(png, "base64"));
|
|
120646
121493
|
}
|
|
120647
121494
|
if (opts.json) {
|
|
120648
121495
|
console.log(JSON.stringify({ url: opts.url, action: opts.selector ?? opts.text, ...report }));
|
|
@@ -120671,7 +121518,7 @@ async function rerenderCommand(opts) {
|
|
|
120671
121518
|
}
|
|
120672
121519
|
|
|
120673
121520
|
// src/commands/serve.ts
|
|
120674
|
-
import { existsSync as
|
|
121521
|
+
import { existsSync as existsSync38 } from "node:fs";
|
|
120675
121522
|
import chalk41 from "chalk";
|
|
120676
121523
|
async function serveRunAndBlock(runDir, opts = {}) {
|
|
120677
121524
|
let handle;
|
|
@@ -120719,7 +121566,7 @@ async function serveRunAndBlock(runDir, opts = {}) {
|
|
|
120719
121566
|
}
|
|
120720
121567
|
async function serveCommand(runId, opts) {
|
|
120721
121568
|
const paths = getRunPaths(opts.output, runId);
|
|
120722
|
-
if (!
|
|
121569
|
+
if (!existsSync38(paths.runDir)) {
|
|
120723
121570
|
console.error(chalk41.red(`✖ Run não encontrado: ${runId} (em ${opts.output})`));
|
|
120724
121571
|
return 1;
|
|
120725
121572
|
}
|
|
@@ -121592,8 +122439,8 @@ async function studioCommentCommand(opts, call = callTool2) {
|
|
|
121592
122439
|
|
|
121593
122440
|
// src/commands/drift.ts
|
|
121594
122441
|
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
121595
|
-
import { existsSync as
|
|
121596
|
-
import { resolve as
|
|
122442
|
+
import { existsSync as existsSync39, readFileSync as readFileSync45 } from "node:fs";
|
|
122443
|
+
import { resolve as resolve23 } from "node:path";
|
|
121597
122444
|
import chalk45 from "chalk";
|
|
121598
122445
|
var DRIFT_EXCLUDES = [":!.deco"];
|
|
121599
122446
|
var SHA_RE = /^[0-9a-f]{7,64}$/i;
|
|
@@ -121712,7 +122559,7 @@ function computeDrift(inputs, opts) {
|
|
|
121712
122559
|
const fail = (code, message) => ({ error: { code, message } });
|
|
121713
122560
|
if (headRef.startsWith("-"))
|
|
121714
122561
|
return fail("bad_head", `head "${headRef}" looks like a flag`);
|
|
121715
|
-
if (!
|
|
122562
|
+
if (!existsSync39(source))
|
|
121716
122563
|
return fail("not_a_repo", `${source} does not exist`);
|
|
121717
122564
|
const inside = git(source, ["rev-parse", "--is-inside-work-tree"]);
|
|
121718
122565
|
if (!inside.ok || inside.stdout.trim() !== "true") {
|
|
@@ -121780,10 +122627,10 @@ function computeDrift(inputs, opts) {
|
|
|
121780
122627
|
};
|
|
121781
122628
|
}
|
|
121782
122629
|
function loadState(path) {
|
|
121783
|
-
if (!
|
|
122630
|
+
if (!existsSync39(path))
|
|
121784
122631
|
return null;
|
|
121785
122632
|
try {
|
|
121786
|
-
return JSON.parse(
|
|
122633
|
+
return JSON.parse(readFileSync45(path, "utf8"));
|
|
121787
122634
|
} catch (err) {
|
|
121788
122635
|
return { error: { code: "state_unreadable", message: `${path}: ${err.message}` } };
|
|
121789
122636
|
}
|
|
@@ -121791,7 +122638,7 @@ function loadState(path) {
|
|
|
121791
122638
|
function runDrift(flags) {
|
|
121792
122639
|
let state = null;
|
|
121793
122640
|
if (!(flags.source && flags.base)) {
|
|
121794
|
-
const loaded = loadState(
|
|
122641
|
+
const loaded = loadState(resolve23(flags.state ?? ".parity/migration.json"));
|
|
121795
122642
|
if (loaded && "error" in loaded)
|
|
121796
122643
|
return loaded;
|
|
121797
122644
|
state = loaded;
|
|
@@ -121960,9 +122807,9 @@ function varianceCommand(opts) {
|
|
|
121960
122807
|
}
|
|
121961
122808
|
|
|
121962
122809
|
// src/commands/vitals.ts
|
|
121963
|
-
import { existsSync as
|
|
122810
|
+
import { existsSync as existsSync40, readFileSync as readFileSync46, writeFileSync as writeFileSync38 } from "node:fs";
|
|
121964
122811
|
import { availableParallelism } from "node:os";
|
|
121965
|
-
import { join as
|
|
122812
|
+
import { join as join52 } from "node:path";
|
|
121966
122813
|
import chalk47 from "chalk";
|
|
121967
122814
|
import ora9 from "ora";
|
|
121968
122815
|
|
|
@@ -122102,8 +122949,8 @@ function assessLlmsTxt(body) {
|
|
|
122102
122949
|
}
|
|
122103
122950
|
|
|
122104
122951
|
// src/diff/lighthouse.ts
|
|
122105
|
-
var HIGH_SAVINGS_MS =
|
|
122106
|
-
var MEDIUM_SAVINGS_MS =
|
|
122952
|
+
var HIGH_SAVINGS_MS = TOLERANCES.vitals.lighthouseHighSavingsMs.value;
|
|
122953
|
+
var MEDIUM_SAVINGS_MS = TOLERANCES.vitals.lighthouseMediumSavingsMs.value;
|
|
122107
122954
|
function opportunitySeverity(savingsMs) {
|
|
122108
122955
|
if (savingsMs >= HIGH_SAVINGS_MS)
|
|
122109
122956
|
return "high";
|
|
@@ -122122,7 +122969,7 @@ function aggregateOpportunities(pages) {
|
|
|
122122
122969
|
}
|
|
122123
122970
|
return [...byId.values()].sort((a, b) => b.savingsMs - a.savingsMs || b.savingsBytes - a.savingsBytes);
|
|
122124
122971
|
}
|
|
122125
|
-
var REGRESSION_DELTA_MS =
|
|
122972
|
+
var REGRESSION_DELTA_MS = TOLERANCES.vitals.lighthouseRegressionMs.value;
|
|
122126
122973
|
function diffOpportunities(prodPages, candPages) {
|
|
122127
122974
|
const prodById = new Map(aggregateOpportunities(prodPages).map((o) => [o.id, o]));
|
|
122128
122975
|
const singleSite = prodPages.length === 0;
|
|
@@ -122214,7 +123061,7 @@ var CATEGORIES = [
|
|
|
122214
123061
|
{ key: "bestPractices", label: "Práticas recomendadas" },
|
|
122215
123062
|
{ key: "seo", label: "SEO" }
|
|
122216
123063
|
];
|
|
122217
|
-
var REGRESSION_DELTA =
|
|
123064
|
+
var REGRESSION_DELTA = TOLERANCES.vitals.lighthouseScoreDrop.value;
|
|
122218
123065
|
function lighthouseScores(ctx) {
|
|
122219
123066
|
const start = Date.now();
|
|
122220
123067
|
const { pairs } = pairCaptures(ctx.prodPages, ctx.candPages);
|
|
@@ -122234,7 +123081,7 @@ function lighthouseScores(ctx) {
|
|
|
122234
123081
|
continue;
|
|
122235
123082
|
issues.push({
|
|
122236
123083
|
id: `lh-score:${key}:${pair.key}`,
|
|
122237
|
-
severity: -delta >=
|
|
123084
|
+
severity: -delta >= TOLERANCES.vitals.lighthouseScoreHighDrop.value ? "high" : "medium",
|
|
122238
123085
|
category: key === "seo" ? "seo" : key === "accessibility" ? "a11y" : "performance",
|
|
122239
123086
|
page: pair.key,
|
|
122240
123087
|
check: "lighthouse-scores",
|
|
@@ -122250,7 +123097,13 @@ function lighthouseScores(ctx) {
|
|
|
122250
123097
|
severity: "medium",
|
|
122251
123098
|
durationMs: Date.now() - start,
|
|
122252
123099
|
summary: !hasScores ? "Sem scores Lighthouse (rode sem --no-lighthouse)" : `${pairs.length} página(s), ${issues.length} regressão(ões) de categoria`,
|
|
122253
|
-
issues
|
|
123100
|
+
issues,
|
|
123101
|
+
...hasScores ? unitCounts({
|
|
123102
|
+
unit: "page-pair",
|
|
123103
|
+
judged: pairs.filter((p) => p.prod.lhScores && p.cand.lhScores).map((p) => p.key),
|
|
123104
|
+
unjudged: pairs.map((p) => p.key),
|
|
123105
|
+
issues
|
|
123106
|
+
}) : {}
|
|
122254
123107
|
};
|
|
122255
123108
|
}
|
|
122256
123109
|
|
|
@@ -122301,7 +123154,7 @@ async function vitalsCommand(opts) {
|
|
|
122301
123154
|
});
|
|
122302
123155
|
progress.succeed(`${total} capture(s) em ${((Date.now() - t0) / 1000).toFixed(1)}s`);
|
|
122303
123156
|
if (opts.lighthouse !== false) {
|
|
122304
|
-
const lhDir =
|
|
123157
|
+
const lhDir = join52(paths.runDir, "lighthouse");
|
|
122305
123158
|
const lhCap = opts.lighthouseConcurrency ?? Math.max(1, Math.min(2, Math.floor(availableParallelism() / 2)));
|
|
122306
123159
|
const done = tasks.filter((t) => !!t.capture);
|
|
122307
123160
|
const lhT0 = Date.now();
|
|
@@ -122390,7 +123243,7 @@ async function vitalsCommand(opts) {
|
|
|
122390
123243
|
writeRunReportJson(paths.runDir, run);
|
|
122391
123244
|
const html = renderHtmlReport(run, paths.runDir);
|
|
122392
123245
|
writeRunReportHtml(paths.runDir, html);
|
|
122393
|
-
|
|
123246
|
+
writeFileSync38(join52(paths.runDir, "vitals.json"), `${JSON.stringify({
|
|
122394
123247
|
schemaVersion: "0.1",
|
|
122395
123248
|
prodUrl: opts.prod,
|
|
122396
123249
|
candUrl: opts.cand,
|
|
@@ -122496,8 +123349,8 @@ async function discoverPagePaths2(prodUrl, opts) {
|
|
|
122496
123349
|
function parseUrlList(input) {
|
|
122497
123350
|
if (input.startsWith("file:") || input.endsWith(".txt") || input.endsWith(".list")) {
|
|
122498
123351
|
const path = input.replace(/^file:\/\//, "");
|
|
122499
|
-
if (
|
|
122500
|
-
return
|
|
123352
|
+
if (existsSync40(path)) {
|
|
123353
|
+
return readFileSync46(path, "utf8").split(/\r?\n/).map((s) => s.trim()).filter((s) => s && !s.startsWith("#")).map((s) => s.startsWith("/") ? s : `/${s}`);
|
|
122501
123354
|
}
|
|
122502
123355
|
}
|
|
122503
123356
|
return input.split(",").map((s) => s.trim()).filter(Boolean).map((s) => s.startsWith("/") || s.startsWith("http") ? s : `/${s}`);
|
|
@@ -122533,7 +123386,7 @@ program.command("run").description([
|
|
|
122533
123386
|
" visual-pages=5, auto-selectors=ON (if LLM), learn=ON, visual-diff=ON,",
|
|
122534
123387
|
" warmup=OFF, vitals warm=ON, bypass-cache=OFF, fail-on=critical (exit 1 if hit)."
|
|
122535
123388
|
].join(`
|
|
122536
|
-
`)).option("--prod <url>", "Production URL (source of truth, e.g. Fresh site). Omit for a single site — the run will point you to `parity e2e` (issue #141).").requiredOption("--cand <url>", "Candidate URL (migrated site, e.g. TanStack)").option("--preset <name>", "Bundle of defaults: smoke (fast, ~30s, no LLM) | full (deep audit) | ci (CI-tuned)").option("--flows <list>", "Comma-separated flows: homepage,plp,pdp,purchase-journey", "purchase-journey").option("--viewports <list>", "Comma-separated viewports: mobile,desktop", "mobile,desktop").option("--cep <cep>", "CEP for shipping calculation", "01310-100").option("--prod-cookie <name=value>", "Cookie set on every prod browser context and plain request; repeatable. Pins prod to one A/B variant (e.g. a Fresh-vs-TanStack bucket cookie) so the run does not compare whichever build each fresh context drew. Values are redacted in logs and report.json.", collectCookie, []).option("--cand-cookie <name=value>", "Same as --prod-cookie, for the candidate side", collectCookie, []).option("--prod-header <Name: value>", "Request header sent on every prod request (all origins — no credentials); repeatable. The header twin of --prod-cookie. Values are redacted in logs and report.json.", collectHeader, []).option("--cand-header <Name: value>", "Same as --prod-header, for the candidate side", collectHeader, []).option("--add-to-cart-timeout <ms>", "How long (ms) the add-to-cart step polls for a success signal before failing. Default 3000. Raise/lower to match your site's success-toast lifetime (issue #143).", (v) => Number(v)).option("--runs <n>", "Repeat each measurement N times (median)", "1").option("--baseline <name>", "Compare against a saved baseline").option("--output <dir>", "Output directory", "./parity-output").option("--fail-on <severities>", "Comma-separated severities that cause exit 1 (default: critical)", "critical").option("--html", "Also write report.html (off by default: render it later with `parity report <runId>`)", false).option("--open", "Write report.html and open it after the run completes (implies --html)", false).option("--no-auto-selectors", "Disable LLM-based selector discovery (uses defaults instead)").option("--refresh-selectors", "Bypass selector cache and re-run discovery", false).option("--no-learn", "Don't write to learned-selectors.json (read-only mode)").option("--vitals-pages <n>", "Extra pages from sitemap to crawl for Vitals coverage, beyond what --flows/--pages already cover (default 10). These are auto-sampled and can add significant unrelated noise to findings — pass 0 to scope the run to only the pages you explicitly requested.", (v) => Number(v), 10).option("--max-viewport-concurrency <n>", "How many viewports run concurrently during collect (default 2: mobile+desktop together). Set to 1 if you hit OOM with many viewports.", (v) => Number(v), 2).option("--visual-pages <n>", "Pages to compare visually with the heatmap engine — pixel diff + box-tree diff, no LLM (home + sampled PLPs/PDPs from sitemap, default 5)", (v) => Number(v), 5).option("--pages <list>", 'Comma-separated paths to compare visually (overrides sitemap discovery). E.g. "/,/account,/p/some-product". Use "prod->cand" for a page that lives at DIFFERENT paths on each side (partial migration), e.g. "/encimera-gc60/p->/ar-condicionado-12k/p". Use this when you want deterministic coverage instead of sampled. Scopes the visual-diff + vitals-extra-pages passes ONLY — the flows crawl (--flows, default purchase-journey) discovers its own target pages independently and ignores this flag. To scope which page(s) a flow visits, use --flows to pick a lighter flow and/or set the matching *UrlHint (e.g. plpUrlHint) in .parityrc.json. Issue #178.').option("--pages-file <path>", `Read paths to compare visually from a text file (one entry per line). Lines starting with # are ignored. Accepts the same "prod->cand" pair syntax as --pages. Overrides --pages when both are present. Same visual-diff/vitals-only scope as --pages — see that flag's help. Issue #178.`).option("--no-visual-diff", "Skip the visual diff capture pass entirely").option("--no-cache", "Deprecated, no effect (the visual verdict cache is gone).").option("--clear-cache", "Deprecated, no effect (the visual verdict cache is gone).", false).option("--bypass-cache", "Bypass CDN/edge caches AND the browser's own HTTP cache (CDP cache-disable), forcing a cold-visit fetch. Use right after a deploy to avoid false failures from stale CF edge content, or to approximate Lighthouse/CrUX-comparable TTFB/FCP/LCP numbers — without this flag, parity's vitals are a warm-connection/cache-enabled ('repeat visit') measurement, not a cold first-visit one, so they aren't directly comparable 1:1 to Lighthouse.", false).option("--warmup", "Before measurement, hit each target URL once (per viewport) with a cache-buster so the Worker serves a fresh response. Recommended after deploys.", false).option("--no-warm", "Don't warm each side's URL before measuring vitals. By default every vitals-measured page is loaded once on BOTH sides first, in a throwaway page (same device + cookies), so a cold edge/loader cache on whichever side hit the route first isn't reported as a Web Vitals or CLS regression. Ignored under --bypass-cache, which measures cold on purpose. Distinct from --warmup (a cache-busted homepage hit after a deploy).").option("--accept-prod-quirks", "Demote prod-side cart-empty journey failures (VTEX session quirk) from failed to skipped. The cart-reveal-mode-divergence check still emits critical if prod/cand markup intents differ, so this flag never masks a real regression. See issue #12.", false).option("--cand-is-production", "Cand is the final production domain, not a staging host. Disables staging detection (cand on another host with noindex everywhere), so noindex/nofollow on cand is critical and third-party origins missing on cand are high again.", false).option("--llm-timeout <seconds>", "Deprecated, no effect: topIssues is ranked deterministically now, there is no LLM aggregation call to time out.").option("--keep-runs <n>", "After the run, delete all but the n newest runs of this prod/cand host pair under --output (other host pairs, runs without a readable report.json and baseline-referenced runs are never touched). 0 keeps everything. Default: 10.", (v) => Number(v), 10).option("--timeout <minutes>", "Hard wall-clock cap for the whole run (minutes). On expiry, parity writes a partial report and exits 130. Default: 30. Issue #56.", (v) => Number(v), 30).option("--flow <name>", "Alias for --flows when running a single flow (e.g. --flow cart). Issue #53.").option("--json <path|->", "Emit JSON-Lines (one line per check) to the given file path, or '-' for stdout. Schema versioned via leading metadata line. Issue #53.").option("--pt", "Tell the LLM to respond in Brazilian Portuguese. Only affects LLM-generated content (issues, explain, prompts) — the static HTML report stays in English. Issue #67.").option("--llm <provider>", "Force LLM provider: anthropic | openrouter | claude-code | none. Default: auto-detect (anthropic key → openrouter key → local claude CLI → none). Issue #66.").option("--llm-model <overrides>", "Per-feature model override, e.g. visual-diff=claude-opus-5,explain=claude-opus-5. Features: selector-discovery, step-recovery, search-terms, plp-matching, pdp-matching, section-understanding, visual-diff, explain, component-detection. Issue #66.").option("--llm-tier-default <tier>", "Override the default tier (haiku | sonnet | opus) for every feature that doesn't have a per-feature override. Issue #66.").option("--llm-model-default <model>", "Force every LLM call to use this exact model ID, ignoring per-feature defaults. Issue #66.").option("--llm-premium", "Bump the reasoning-heavy features (explain/visual-diff) to opus. Defaults are sonnet-first for cost/latency (opus blew the 60s timeout on most runs); opt into opus for hard fixes. Issue #256.").option("--no-interactive", "Disable the interactive selector prompt that auto-fires in a TTY without an LLM provider. Use in scripts and CI where stdin is technically a TTY but you don't want to pause. Issue #72.").option("--only <modules>", "Scope the run to these modules and/or single checks (comma-separated). Module names: e2e, seo, visual, vitals, cache, console, html, network. Single-check granularity via `check:<name>`, e.g. `--only e2e,check:cache-coverage`. Run `parity list modules` for the full check/flow mapping. Default: all modules. M3 module selection.").option("--skip <modules>", "Subtract these modules and/or single checks (comma-separated, same syntax as --only) from whatever base set was chosen (all modules, or --only's set if both are given). M3 module selection.").option("--why <text>", "Free-text reason for this run's scope, stored in report.json as `selectionReason`. Purely informational. M3 module selection.").option("--profile <type>", "Site profile: commerce | content. Scopes modules/flows/CEP. `content` (blog/custom site with no storefront) drops the e2e purchase journey, scopes flows to the homepage, and skips CEP. Auto-detected from the platform when omitted. Issues #254/#255.").action(async (opts) => {
|
|
123389
|
+
`)).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("--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) => {
|
|
122537
123390
|
if (opts.flow) {
|
|
122538
123391
|
opts.flows = opts.flow;
|
|
122539
123392
|
}
|