@reticlehq/engine 3.6.0 → 3.7.0
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/dist/disagreement/contradiction-evidence.d.ts +66 -1
- package/dist/disagreement/contradiction-evidence.js +141 -2
- package/dist/disagreement/contradiction-types.d.ts +8 -1
- package/dist/disagreement/contradictions.d.ts +12 -0
- package/dist/disagreement/contradictions.js +37 -70
- package/dist/disagreement/stale-response.js +7 -2
- package/dist/evidence/already-true.d.ts +5 -0
- package/dist/evidence/already-true.js +27 -6
- package/dist/evidence/baseline.js +2 -6
- package/dist/evidence/blind-spots.d.ts +14 -3
- package/dist/evidence/blind-spots.js +48 -10
- package/dist/evidence/instrumentation-gaps.js +3 -1
- package/dist/evidence/state-bookkeeping.d.ts +2 -0
- package/dist/evidence/state-bookkeeping.js +2 -0
- package/dist/evidence/superseded-checks.d.ts +29 -0
- package/dist/evidence/superseded-checks.js +30 -0
- package/dist/evidence/unsettled.js +4 -2
- package/dist/evidence/verified.d.ts +6 -1
- package/dist/evidence/verified.js +32 -4
- package/dist/question/declared.d.ts +20 -0
- package/dist/question/declared.js +20 -1
- package/dist/question/predicate/net-blind-spots.d.ts +49 -0
- package/dist/question/predicate/net-blind-spots.js +153 -0
- package/dist/question/predicate/predicate-element.d.ts +14 -0
- package/dist/question/predicate/predicate-element.js +76 -5
- package/dist/question/predicate/predicate-eval-kit.d.ts +25 -0
- package/dist/question/predicate/predicate-eval-kit.js +31 -0
- package/dist/question/predicate/predicate-eval.d.ts +1 -1
- package/dist/question/predicate/predicate-eval.js +47 -167
- package/dist/question/predicate/predicate-parse.js +34 -0
- package/dist/question/predicate/predicate-request-body.d.ts +6 -1
- package/dist/question/predicate/predicate-request-body.js +7 -2
- package/dist/question/predicate/predicate-route.d.ts +2 -0
- package/dist/question/predicate/predicate-route.js +30 -0
- package/dist/question/predicate/predicate-schema.d.ts +11 -0
- package/dist/question/predicate/predicate-schema.js +52 -1
- package/dist/question/predicate/predicate-state.js +7 -0
- package/dist/question/predicate/predicate.js +5 -11
- package/dist/question/predicate/split-text-miss.d.ts +6 -0
- package/dist/question/predicate/split-text-miss.js +10 -0
- package/dist/state-bookkeeping.d.ts +25 -0
- package/dist/state-bookkeeping.js +70 -0
- package/package.json +2 -2
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
* ever enrich a failure. Nothing else in the predicate layer talks to `ReticleCommand.MATCH`.
|
|
8
8
|
*/
|
|
9
9
|
import { QueryBy, ReticleCommand, ElementState, } from '@reticlehq/core';
|
|
10
|
-
import { describeUnusableElementQuery, residualQueryChecks, satisfiesResiduals, describeResidual, } from './predicate-eval.js';
|
|
10
|
+
import { describeAltOnNonImage, describeUnusableElementQuery, residualQueryChecks, withAltProjected, satisfiesResiduals, describeResidual, } from './predicate-eval.js';
|
|
11
11
|
import { describeTestidMiss } from './testid-near-miss.js';
|
|
12
|
-
import { describeSplitTextMiss } from './split-text-miss.js';
|
|
12
|
+
import { describeCaseMiss, describeSplitTextMiss } from './split-text-miss.js';
|
|
13
13
|
import { satisfiesProperty } from './property.js';
|
|
14
14
|
import { describeNameNearMiss } from './name-near-miss.js';
|
|
15
15
|
/**
|
|
@@ -140,7 +140,7 @@ export async function evalElement(session, query, state, absent, diagnose) {
|
|
|
140
140
|
const reason = describeUnusableElementQuery(query, residual.unusable);
|
|
141
141
|
return { pass: false, failureReason: reason, inconclusive: reason };
|
|
142
142
|
}
|
|
143
|
-
let match = await matchOnce(session, query, state);
|
|
143
|
+
let match = await matchOnce(session, withAltProjected(query, residual.checks), state);
|
|
144
144
|
const subject = JSON.stringify(query);
|
|
145
145
|
// A residual narrows the SET; `count` is every match while `elements` is only the described prefix,
|
|
146
146
|
// so a locator broad enough to be truncated cannot be narrowed honestly. Say so instead of guessing.
|
|
@@ -148,6 +148,13 @@ export async function evalElement(session, query, state, absent, diagnose) {
|
|
|
148
148
|
const reason = `${String(match.count)} elements matched ${subject} and only ${String(match.elements.length)} were described, so ${residual.checks.map(([f]) => `\`${f}\``).join(', ')} could not be checked against all of them — narrow the locator`;
|
|
149
149
|
return { pass: false, failureReason: reason, inconclusive: reason };
|
|
150
150
|
}
|
|
151
|
+
// `alt` is only meaningful on an image, and the role that says so is on the matched descriptor, so
|
|
152
|
+
// this cannot be refused before the round-trip the way an uncheckable field is. It runs AFTER the
|
|
153
|
+
// truncation check: judged on a cut-off prefix, "none of these is an image" would be a guess.
|
|
154
|
+
const altRefusal = describeAltOnNonImage(residual.checks, match.elements);
|
|
155
|
+
if (altRefusal !== undefined) {
|
|
156
|
+
return { pass: false, failureReason: altRefusal, inconclusive: altRefusal };
|
|
157
|
+
}
|
|
151
158
|
const kept = match.elements.filter((element) => satisfiesResiduals(element, residual.checks));
|
|
152
159
|
// The locator found something and the dropped fields disagree with it. Reported separately from a
|
|
153
160
|
// plain miss because the fixes are opposite: the element IS there, its value is not what was claimed.
|
|
@@ -266,6 +273,22 @@ export async function evalElement(session, query, state, absent, diagnose) {
|
|
|
266
273
|
evidence: { nearMiss: roleOnly.elements },
|
|
267
274
|
};
|
|
268
275
|
}
|
|
276
|
+
// Nothing on the page has that role at all. The control is often there under ANOTHER role — a
|
|
277
|
+
// contenteditable composer is not a `textbox`, a styled div is not a `button` — and the name is
|
|
278
|
+
// the part the agent got right. Name the controls carrying it, with their real roles, so the
|
|
279
|
+
// retry targets what exists instead of guessing again. A diagnosis only: `pass` stays false.
|
|
280
|
+
const byName = await nearestByName(session, query.name, state);
|
|
281
|
+
if (byName.length > 0) {
|
|
282
|
+
const seen = byName.map((e) => `${'' === e.role ? 'no role' : e.role} "${'' === e.name ? (e.text ?? '') : e.name}" (${e.ref})`);
|
|
283
|
+
return {
|
|
284
|
+
pass: false,
|
|
285
|
+
failureReason: `no '${query.role}' named '${query.name}'; that name is on: ${seen.join(', ')}`,
|
|
286
|
+
observed: `no element has role '${query.role}'; elements named '${query.name}': ${seen.join(', ')}`,
|
|
287
|
+
expected: `a '${query.role}' named '${query.name}'`,
|
|
288
|
+
assertion: 'element.role+name',
|
|
289
|
+
evidence: { nearestByName: byName },
|
|
290
|
+
};
|
|
291
|
+
}
|
|
269
292
|
}
|
|
270
293
|
// The testid near-miss: name what IS here, so a typo is one step from fixed rather than a dead
|
|
271
294
|
// end. reticle_query has always done this; the predicate path had no equivalent. See
|
|
@@ -284,7 +307,11 @@ export async function evalElement(session, query, state, absent, diagnose) {
|
|
|
284
307
|
// already limited to that role.
|
|
285
308
|
const nearMissRole = QueryBy.ROLE === query.by ? query.value : query.role;
|
|
286
309
|
const nearMiss = describeNameNearMiss(match.hint?.nameNearMiss, query.name, nearMissRole);
|
|
287
|
-
const
|
|
310
|
+
const caseMiss = describeCaseMiss(match.hint?.caseMiss);
|
|
311
|
+
const clause = caseMiss ??
|
|
312
|
+
splitText ??
|
|
313
|
+
nearMiss ??
|
|
314
|
+
(alsoHere === undefined || '' === alsoHere ? undefined : alsoHere);
|
|
288
315
|
const suffix = clause === undefined ? '' : ` — ${clause}`;
|
|
289
316
|
// The evidence list is capped in document order, so a region low on the page is exactly what it
|
|
290
317
|
// drops. Handed back with no marker it reads as the whole page, and the field report this came
|
|
@@ -293,6 +320,13 @@ export async function evalElement(session, query, state, absent, diagnose) {
|
|
|
293
320
|
const cut = describePresentTestidsCut(present.length, total);
|
|
294
321
|
return {
|
|
295
322
|
pass: false,
|
|
323
|
+
// The page shows the text in another case. Still a failure — see EvalResult.caseOnlyMiss.
|
|
324
|
+
...(caseMiss === undefined
|
|
325
|
+
? {}
|
|
326
|
+
: {
|
|
327
|
+
caseOnlyMiss: true,
|
|
328
|
+
wouldHold: `the same check with ignoreCase: true (the page shows "${match.hint?.caseMiss ?? ''}")`,
|
|
329
|
+
}),
|
|
296
330
|
failureReason: `no element matched ${subject}${state === undefined ? '' : ` in state '${state}'`}${suffix}${cut}`,
|
|
297
331
|
observed: `no matching element on the page${suffix}`,
|
|
298
332
|
expected: `an element matching ${subject}${state === undefined ? '' : ` in state '${state}'`}`,
|
|
@@ -300,12 +334,14 @@ export async function evalElement(session, query, state, absent, diagnose) {
|
|
|
300
334
|
// `splitText` rides on the evidence because it is a POSITIVE observation: the browser found the
|
|
301
335
|
// string in the rendered page. `annotateThrottledMiss` reads it so a miss on a backgrounded tab
|
|
302
336
|
// is not blamed on a render that demonstrably happened.
|
|
303
|
-
...(present.length > 0 || splitText !== undefined
|
|
337
|
+
...(present.length > 0 || splitText !== undefined || caseMiss !== undefined
|
|
304
338
|
? {
|
|
305
339
|
evidence: {
|
|
306
340
|
...(present.length > 0 ? { presentTestids: present } : {}),
|
|
307
341
|
...(total === undefined || 0 === present.length ? {} : { presentTestidsTotal: total }),
|
|
308
342
|
...(splitText === undefined ? {} : { splitText: match.hint?.splitText }),
|
|
343
|
+
// Positive too: the page rendered the text, in another case.
|
|
344
|
+
...(caseMiss === undefined ? {} : { caseMiss: match.hint?.caseMiss }),
|
|
309
345
|
},
|
|
310
346
|
}
|
|
311
347
|
: {}),
|
|
@@ -356,3 +392,38 @@ export function withTextProperty(base, assertion, subject, baseline) {
|
|
|
356
392
|
evidence: described,
|
|
357
393
|
};
|
|
358
394
|
}
|
|
395
|
+
/** How many same-name controls a role miss names. */
|
|
396
|
+
const MAX_BY_NAME = 3;
|
|
397
|
+
/**
|
|
398
|
+
* Elements carrying an accessible name, whatever their role: by label (aria-label, <label>), then by
|
|
399
|
+
* placeholder. The first locator that finds any wins; at most MAX_BY_NAME are named.
|
|
400
|
+
*/
|
|
401
|
+
async function nearestByName(session, name, state) {
|
|
402
|
+
for (const query of [{ label: name }, { placeholder: name }]) {
|
|
403
|
+
const found = await matchOnce(session, query, state);
|
|
404
|
+
if (found.matched)
|
|
405
|
+
return found.elements.slice(0, MAX_BY_NAME);
|
|
406
|
+
}
|
|
407
|
+
return [];
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* The element query a text predicate is evaluated through — one builder for the verdict and its
|
|
411
|
+
* baseline, so the two cannot disagree about what text was asked for.
|
|
412
|
+
*
|
|
413
|
+
* `matchCase` unless the predicate opts out: a check that matched "Saved Priya" against "Saved
|
|
414
|
+
* priya" could never catch a capitalisation defect. An undefined `contains` must not reach the query
|
|
415
|
+
* as `text: undefined` — that is a locator asking for the empty string.
|
|
416
|
+
*/
|
|
417
|
+
export function textPredicateQuery(predicate) {
|
|
418
|
+
return {
|
|
419
|
+
...(undefined === predicate.contains
|
|
420
|
+
? {}
|
|
421
|
+
: {
|
|
422
|
+
text: predicate.contains,
|
|
423
|
+
...(true === predicate.ignoreCase ? {} : { matchCase: true }),
|
|
424
|
+
}),
|
|
425
|
+
...(undefined === predicate.scope
|
|
426
|
+
? {}
|
|
427
|
+
: { scope: predicate.scope, ...(true === predicate.self ? { self: true } : {}) }),
|
|
428
|
+
};
|
|
429
|
+
}
|
|
@@ -66,6 +66,13 @@ export interface EvalResult {
|
|
|
66
66
|
observed?: string;
|
|
67
67
|
expected?: string;
|
|
68
68
|
assertion?: string;
|
|
69
|
+
/**
|
|
70
|
+
* The text IS on the page, in another case. `pass` stays false — a capitalisation defect is a
|
|
71
|
+
* defect — and `wouldHold` names the check that would have held, so the retry is one decision
|
|
72
|
+
* (does case matter here?) rather than a hunt.
|
|
73
|
+
*/
|
|
74
|
+
caseOnlyMiss?: boolean;
|
|
75
|
+
wouldHold?: string;
|
|
69
76
|
}
|
|
70
77
|
export declare function str(value: unknown): string | undefined;
|
|
71
78
|
export declare function num(value: unknown): number | undefined;
|
|
@@ -74,6 +81,24 @@ export declare function num(value: unknown): number | undefined;
|
|
|
74
81
|
* `{$gte,$lte,$gt,$lt}` (numbers), `{$contains}` (array membership or substring), `{$length}`.
|
|
75
82
|
*/
|
|
76
83
|
export declare function matchValue(got: unknown, want: unknown): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Detects the #1117 pattern: an MCP client stringified a primitive before sending it, so
|
|
86
|
+
* `false` arrived as `"false"`, `42` as `"42"`, `null` as `"null"`. The store holds the real
|
|
87
|
+
* type and the comparison is a type mismatch, not a value mismatch — inconclusive, not `no`.
|
|
88
|
+
*/
|
|
89
|
+
export declare function isStringifiedPrimitiveMismatch(got: unknown, want: unknown): boolean;
|
|
90
|
+
/**
|
|
91
|
+
* The inconclusive result for a stringified-primitive mismatch on a state `equals` check.
|
|
92
|
+
* Shared by both `evalStateNamed` and `evalState` so the reason and evidence shape stay in one
|
|
93
|
+
* place.
|
|
94
|
+
*/
|
|
95
|
+
export declare function stringifiedPrimitiveResult(storeName: string, path: string, got: unknown, want: unknown, capDepth: (v: unknown, d: number) => unknown): {
|
|
96
|
+
pass: false;
|
|
97
|
+
failureReason: string;
|
|
98
|
+
inconclusive: string;
|
|
99
|
+
assertion: string;
|
|
100
|
+
evidence: Record<string, unknown>;
|
|
101
|
+
};
|
|
77
102
|
/** One pattern key read out of a payload: its value, or where the walk stopped. */
|
|
78
103
|
export interface FieldReading {
|
|
79
104
|
found: boolean;
|
|
@@ -66,6 +66,37 @@ export function matchValue(got, want) {
|
|
|
66
66
|
}
|
|
67
67
|
return structurallyEqual(got, want);
|
|
68
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Detects the #1117 pattern: an MCP client stringified a primitive before sending it, so
|
|
71
|
+
* `false` arrived as `"false"`, `42` as `"42"`, `null` as `"null"`. The store holds the real
|
|
72
|
+
* type and the comparison is a type mismatch, not a value mismatch — inconclusive, not `no`.
|
|
73
|
+
*/
|
|
74
|
+
export function isStringifiedPrimitiveMismatch(got, want) {
|
|
75
|
+
if ('string' !== typeof want)
|
|
76
|
+
return false;
|
|
77
|
+
if ('boolean' === typeof got || 'number' === typeof got || null === got) {
|
|
78
|
+
return String(got) === want;
|
|
79
|
+
}
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* The inconclusive result for a stringified-primitive mismatch on a state `equals` check.
|
|
84
|
+
* Shared by both `evalStateNamed` and `evalState` so the reason and evidence shape stay in one
|
|
85
|
+
* place.
|
|
86
|
+
*/
|
|
87
|
+
export function stringifiedPrimitiveResult(storeName, path, got, want, capDepth) {
|
|
88
|
+
const gotType = null === got ? 'null' : typeof got;
|
|
89
|
+
const reason = `state '${path}' is ${JSON.stringify(got)} (${gotType}), ` +
|
|
90
|
+
`but the expected value ${JSON.stringify(want)} is a string that looks like its stringified form — ` +
|
|
91
|
+
`use the ${gotType} literal ${JSON.stringify(got)} instead`;
|
|
92
|
+
return {
|
|
93
|
+
pass: false,
|
|
94
|
+
failureReason: reason,
|
|
95
|
+
inconclusive: reason,
|
|
96
|
+
assertion: 'state.equals',
|
|
97
|
+
evidence: { store: storeName, path, value: capDepth(got, 1) },
|
|
98
|
+
};
|
|
99
|
+
}
|
|
69
100
|
/**
|
|
70
101
|
* Value equality for the leaf comparison, because `===` could never match a literal.
|
|
71
102
|
*
|
|
@@ -37,7 +37,7 @@ export interface SettleScope {
|
|
|
37
37
|
/**
|
|
38
38
|
* "The page has gone quiet": no network/DOM/animation activity for at least `quietMs`. Needs the
|
|
39
39
|
* wall-clock `now` (in the buffer's time base) because "no activity in the last N ms" is relative to
|
|
40
|
-
* now, not to any buffered event — so `now` is injected (
|
|
40
|
+
* now, not to any buffered event — so `now` is injected (AGENTS.md rule 7), and the wait loop's
|
|
41
41
|
* poll interval is what eventually flips this to pass once activity stops.
|
|
42
42
|
*/
|
|
43
43
|
export declare function evalSettled(allEvents: ReticleEvent[], p: Extract<Predicate, {
|
|
@@ -5,7 +5,20 @@ import { checkRequestBody, newRequestBodyState, requestBodyVerdict, } from './pr
|
|
|
5
5
|
export { evalConsole } from './predicate-console.js';
|
|
6
6
|
import { clipBody, dataMatches, describeBodyFieldMiss, describeFieldMiss, describeNetFilter, matchJsonBody, num, redactedOnPath, str, } from './predicate-eval-kit.js';
|
|
7
7
|
import { keyFragmentOnly } from './body-key-fragment.js';
|
|
8
|
+
import { PRE_ATTACH_CAVEAT, nativeDownloadReason, targetsNativeDownload, targetsUnobservedChannel, unobservedChannelReason, } from './net-blind-spots.js';
|
|
8
9
|
export { clipBody, dataMatches, describeNetFilter, matchValue, str, } from './predicate-eval-kit.js';
|
|
10
|
+
/** The oracle a net body clause reports, so an agent can branch on which one decided. */
|
|
11
|
+
const NetBodyAssertion = {
|
|
12
|
+
CONTAINS: 'net.bodyContains',
|
|
13
|
+
MATCHES: 'net.bodyMatches',
|
|
14
|
+
};
|
|
15
|
+
/** A truncated body missed a `bodyContains`: the kept prefix can still answer a substring. */
|
|
16
|
+
const TRUNCATED_PREFIX_REMEDY = "Raise it past this response's size and re-run, or assert on something inside the recorded prefix";
|
|
17
|
+
/**
|
|
18
|
+
* A truncated body missed a `bodyMatches`. That clause parses the whole body and a JSON prefix never
|
|
19
|
+
* parses, so "assert inside the prefix" changes nothing for it (#1417): name what can work instead.
|
|
20
|
+
*/
|
|
21
|
+
const TRUNCATED_MATCHES_REMEDY = "Raise it past this response's size and re-run. `bodyMatches` parses the whole body, and a JSON prefix never parses, so it cannot be judged on the kept part: to assert on what was kept, use `bodyContains` with a substring from it";
|
|
9
22
|
// The predicate SHAPE — the discriminated union, its aliases and its zod schema — lives in
|
|
10
23
|
// predicate-schema.ts, and is re-exported here: the two halves are ONE public surface.
|
|
11
24
|
export * from './predicate-schema.js';
|
|
@@ -86,116 +99,10 @@ function evalExactCount(args) {
|
|
|
86
99
|
assertion,
|
|
87
100
|
};
|
|
88
101
|
}
|
|
89
|
-
/**
|
|
90
|
-
* URL suffixes only the DOCUMENT fetches, which the network observer therefore never records.
|
|
91
|
-
*
|
|
92
|
-
* `network.ts` patches `fetch` and `XMLHttpRequest` and nothing else, so `<link rel=icon>`,
|
|
93
|
-
* `<link rel=manifest>`, stylesheets, fonts and `<img src>` are invisible to it. "No matching call"
|
|
94
|
-
* and "that class of call is not observed" are then indistinguishable, and the miss graded
|
|
95
|
-
* `assertion_failed` — a false RED. Reported from the field: an assert over `/favicon.ico`,
|
|
96
|
-
* `/site.webmanifest` and `/apple-touch-icon.png` returned `verified:"no"` while curl showed all
|
|
97
|
-
* three answering 200. A false negative here is worse than an unknown, because an agent that trusts
|
|
98
|
-
* it goes and "fixes" working code.
|
|
99
|
-
*
|
|
100
|
-
* Deliberately NOT here: `.js` and `.json`. Both are routinely fetched via `fetch`/XHR — a module
|
|
101
|
-
* preload and an API call can share a suffix — so downgrading them would hide real misses. This list
|
|
102
|
-
* is only the suffixes for which the document is the sole plausible initiator.
|
|
103
|
-
*
|
|
104
|
-
* This began as the smaller half of #447: it did not make these requests observable, it stopped
|
|
105
|
-
* Reticle claiming they did not happen. The other half, observing them via resource timing, has
|
|
106
|
-
* since landed in the browser SDK, so the two halves are no longer independent and this downgrade is
|
|
107
|
-
* now GATED: when the event stream carries at least one document-initiated record, the observer is
|
|
108
|
-
* demonstrably live and a miss over these suffixes is real evidence, graded a plain failure. Only a
|
|
109
|
-
* page whose stream holds no resource entry at all keeps the honest "cannot tell apart" answer,
|
|
110
|
-
* because there the observer may simply not exist.
|
|
111
|
-
*/
|
|
112
|
-
const DOCUMENT_ONLY_SUFFIXES = [
|
|
113
|
-
'.ico',
|
|
114
|
-
'.png',
|
|
115
|
-
'.jpg',
|
|
116
|
-
'.jpeg',
|
|
117
|
-
'.gif',
|
|
118
|
-
'.svg',
|
|
119
|
-
'.webp',
|
|
120
|
-
'.avif',
|
|
121
|
-
'.bmp',
|
|
122
|
-
'.css',
|
|
123
|
-
'.woff',
|
|
124
|
-
'.woff2',
|
|
125
|
-
'.ttf',
|
|
126
|
-
'.otf',
|
|
127
|
-
'.eot',
|
|
128
|
-
'.webmanifest',
|
|
129
|
-
];
|
|
130
|
-
/**
|
|
131
|
-
* File suffixes a click typically downloads or navigates to as a document, never as fetch/XHR.
|
|
132
|
-
*
|
|
133
|
-
* Sibling of DOCUMENT_ONLY_SUFFIXES, not a member of it. Those are subresources: once resource
|
|
134
|
-
* timing is live, a miss is evidence. A click on `<a href="/export.pdf">` is a navigation (or a
|
|
135
|
-
* Content-Disposition attachment). Resource timing of stylesheets does not make it visible, so
|
|
136
|
-
* grading the miss as "0 network calls" / a 404 is the lie #805 exists to stop — even on a page
|
|
137
|
-
* whose observer is running. `.js` / `.json` stay off this list for the same reason they stay off
|
|
138
|
-
* the other: they are routinely fetched.
|
|
139
|
-
*/
|
|
140
|
-
const NATIVE_DOWNLOAD_SUFFIXES = [
|
|
141
|
-
'.pdf',
|
|
142
|
-
'.csv',
|
|
143
|
-
'.tsv',
|
|
144
|
-
'.zip',
|
|
145
|
-
'.gz',
|
|
146
|
-
'.tar',
|
|
147
|
-
'.xlsx',
|
|
148
|
-
'.xls',
|
|
149
|
-
'.docx',
|
|
150
|
-
'.doc',
|
|
151
|
-
'.pptx',
|
|
152
|
-
'.ppt',
|
|
153
|
-
'.ods',
|
|
154
|
-
'.odt',
|
|
155
|
-
'.rtf',
|
|
156
|
-
'.7z',
|
|
157
|
-
'.rar',
|
|
158
|
-
];
|
|
159
|
-
/**
|
|
160
|
-
* Does this filter target a class of request the observer cannot see?
|
|
161
|
-
*
|
|
162
|
-
* Read off `urlContains` only, and only when the pattern ENDS in one of the suffixes — a filter of
|
|
163
|
-
* `/api/` that happens to contain `.css` somewhere in a query string is still an ordinary XHR
|
|
164
|
-
* target. Query strings and fragments are stripped first, since `favicon.ico?v=2` is the same asset.
|
|
165
|
-
*/
|
|
166
|
-
function filterPath(urlContains) {
|
|
167
|
-
return (urlContains.split('#')[0] ?? '').split('?')[0]?.toLowerCase() ?? '';
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Does this filter target a class of request the observer cannot see?
|
|
171
|
-
*
|
|
172
|
-
* Read off `urlContains` only, and only when the pattern ENDS in one of the suffixes — a filter of
|
|
173
|
-
* `/api/` that happens to contain `.css` somewhere in a query string is still an ordinary XHR
|
|
174
|
-
* target. Query strings and fragments are stripped first, since `favicon.ico?v=2` is the same asset.
|
|
175
|
-
*/
|
|
176
|
-
function targetsUnobservedChannel(p) {
|
|
177
|
-
const url = p.urlContains;
|
|
178
|
-
if (undefined === url)
|
|
179
|
-
return false;
|
|
180
|
-
return DOCUMENT_ONLY_SUFFIXES.some((suffix) => filterPath(url).endsWith(suffix));
|
|
181
|
-
}
|
|
182
|
-
function targetsNativeDownload(p) {
|
|
183
|
-
const url = p.urlContains;
|
|
184
|
-
if (undefined === url)
|
|
185
|
-
return false;
|
|
186
|
-
return NATIVE_DOWNLOAD_SUFFIXES.some((suffix) => filterPath(url).endsWith(suffix));
|
|
187
|
-
}
|
|
188
|
-
function nativeDownloadReason(p) {
|
|
189
|
-
return (`no fetch or XHR matched ${describeNetFilter(p)}. A native download or document navigation ` +
|
|
190
|
-
`(an <a href> to a file, a Content-Disposition attachment, <a download>) never goes through ` +
|
|
191
|
-
`fetch or XMLHttpRequest, so an empty net window is not a 404 and is not evidence the export ` +
|
|
192
|
-
`failed. This is unobservable on the net channel. Assert the link href, or check the file ` +
|
|
193
|
-
`outside the browser — Reticle cannot see the bytes land`);
|
|
194
|
-
}
|
|
195
102
|
function nativeDownloadMiss(events, p) {
|
|
196
|
-
if (!targetsNativeDownload(p))
|
|
103
|
+
if (!targetsNativeDownload(p.urlContains))
|
|
197
104
|
return undefined;
|
|
198
|
-
const reason = nativeDownloadReason(p);
|
|
105
|
+
const reason = nativeDownloadReason(describeNetFilter(p));
|
|
199
106
|
return {
|
|
200
107
|
pass: false,
|
|
201
108
|
failureReason: reason,
|
|
@@ -245,44 +152,6 @@ export function isDocumentInitiated(event) {
|
|
|
245
152
|
function observerSawSubresources(events) {
|
|
246
153
|
return events.some(isDocumentInitiated);
|
|
247
154
|
}
|
|
248
|
-
/** The sentence both zero-match branches hand to `inconclusive`. */
|
|
249
|
-
function unobservedChannelReason(p) {
|
|
250
|
-
return (`no call matched ${describeNetFilter(p)}, and no document-initiated load was recorded either, ` +
|
|
251
|
-
`so this page exposed no resource timing to read: Reticle observes fetch and XMLHttpRequest ` +
|
|
252
|
-
`directly, while a request the document initiates (<link rel=icon|manifest|preload>, a ` +
|
|
253
|
-
`stylesheet, a font, <img src>) leaves no record, and that state cannot be told apart from the ` +
|
|
254
|
-
`request having been made. ` +
|
|
255
|
-
`Nothing here says the app is wrong. Check it outside the browser, or assert something the ` +
|
|
256
|
-
`document does not fetch on its own`);
|
|
257
|
-
}
|
|
258
|
-
/**
|
|
259
|
-
* Appended to a zero-match `net` negative whose window starts at SDK attach.
|
|
260
|
-
*
|
|
261
|
-
* Every event's `t` is stamped `performance.now() - #start`, where `#start` is taken when the SDK
|
|
262
|
-
* is constructed, so `t` is never negative and a window with `since === 0` begins AT attach — never
|
|
263
|
-
* before it. Whatever the page did between navigation start and attach left no event at all, so
|
|
264
|
-
* "no matching call" over such a window cannot be told apart from "the call was made while nothing
|
|
265
|
-
* was watching yet".
|
|
266
|
-
*
|
|
267
|
-
* The gap is routine rather than exotic: a `fetch` from an effect in a root provider, or a classic
|
|
268
|
-
* `<script>` at the end of `<body>`, fires before a deferred module script has run. Read as proof
|
|
269
|
-
* the request was never made, that sends a reader looking for a defect in code that works —
|
|
270
|
-
* restarting dev servers and re-reading providers to establish that the request was invisible rather
|
|
271
|
-
* than absent.
|
|
272
|
-
*
|
|
273
|
-
* Same argument as DOCUMENT_ONLY_SUFFIXES one axis over: that one is a channel Reticle does not
|
|
274
|
-
* watch, this is a stretch of TIME it was not yet watching.
|
|
275
|
-
*
|
|
276
|
-
* The grade is deliberately NOT downgraded to `inconclusive`. A missing API call is the finding this
|
|
277
|
-
* oracle exists to make, and it is the strongest grade available for the startup class — session
|
|
278
|
-
* restore, feature flags, bootstrap config — which is exactly the class that silently breaks on
|
|
279
|
-
* reload. Every window an action opens carries `since > 0` and is untouched. What changes is only
|
|
280
|
-
* what the negative CLAIMS: it stops asserting the request never happened, and names the assertion
|
|
281
|
-
* that can settle it, because the state such a request produces IS observable after attach.
|
|
282
|
-
*/
|
|
283
|
-
const PRE_ATTACH_CAVEAT = ' — note that this window starts where the SDK attached, and requests made before that are never ' +
|
|
284
|
-
'captured, so a miss here cannot tell a call that was never made apart from one made before the ' +
|
|
285
|
-
'page connected; if the call is expected during startup, assert on the state it produces instead';
|
|
286
155
|
/**
|
|
287
156
|
* The response-body clause as the caller wrote it, for a verdict that has to quote it.
|
|
288
157
|
*
|
|
@@ -326,6 +195,8 @@ export function evalNet(events, p) {
|
|
|
326
195
|
* a truncated one cannot (#614).
|
|
327
196
|
*/
|
|
328
197
|
let truncatedBody;
|
|
198
|
+
// Which clause the truncated body missed: a predicate can carry both, and the remedy for each differs.
|
|
199
|
+
let truncatedClause;
|
|
329
200
|
/**
|
|
330
201
|
* A `bodyContains` needle that was FOUND, and found only inside a key name (#987).
|
|
331
202
|
*
|
|
@@ -361,6 +232,8 @@ export function evalNet(events, p) {
|
|
|
361
232
|
}
|
|
362
233
|
if (p.ok !== undefined && callSucceeded(d) !== p.ok)
|
|
363
234
|
return false;
|
|
235
|
+
if (!checkRequestBody(d, p, requestState))
|
|
236
|
+
return false;
|
|
364
237
|
if (p.bodyContains !== undefined || p.bodyMatches !== undefined) {
|
|
365
238
|
// The RESPONSE body only, and this is the whole point of these fields. Searching the request
|
|
366
239
|
// too would let `bodyContains: "1187.01"` pass on the very defect it exists to catch: the app
|
|
@@ -376,16 +249,18 @@ export function evalNet(events, p) {
|
|
|
376
249
|
// there (#614). Grading it `pass: false` with "the response value is what differed" is the
|
|
377
250
|
// inversion the honesty rules exist to prevent — an unknown reported as decided, against a
|
|
378
251
|
// response that was very likely correct.
|
|
379
|
-
const missed = () => {
|
|
380
|
-
if (true === d['responseBodyTruncated'])
|
|
252
|
+
const missed = (clause) => {
|
|
253
|
+
if (true === d['responseBodyTruncated']) {
|
|
381
254
|
truncatedBody ??= response;
|
|
255
|
+
truncatedClause ??= clause;
|
|
256
|
+
}
|
|
382
257
|
else
|
|
383
258
|
bodyMismatch ??= response;
|
|
384
259
|
return false;
|
|
385
260
|
};
|
|
386
261
|
if (p.bodyContains !== undefined) {
|
|
387
262
|
if (!response.includes(p.bodyContains))
|
|
388
|
-
return missed();
|
|
263
|
+
return missed(NetBodyAssertion.CONTAINS);
|
|
389
264
|
const fragment = keyFragmentOnly(response, p.bodyContains);
|
|
390
265
|
if (fragment !== undefined) {
|
|
391
266
|
keyFragment ??= { key: fragment, body: response };
|
|
@@ -395,15 +270,13 @@ export function evalNet(events, p) {
|
|
|
395
270
|
if (p.bodyMatches !== undefined) {
|
|
396
271
|
const verdict = matchJsonBody(response, p.bodyMatches);
|
|
397
272
|
if ('mismatch' === verdict)
|
|
398
|
-
return missed();
|
|
273
|
+
return missed(NetBodyAssertion.MATCHES);
|
|
399
274
|
if ('match' !== verdict) {
|
|
400
275
|
redactedResponseField ??= verdict.redacted;
|
|
401
276
|
return false;
|
|
402
277
|
}
|
|
403
278
|
}
|
|
404
279
|
}
|
|
405
|
-
if (!checkRequestBody(d, p, requestState))
|
|
406
|
-
return false;
|
|
407
280
|
return true;
|
|
408
281
|
});
|
|
409
282
|
if (unobservableStatus && 0 === matches.length) {
|
|
@@ -424,7 +297,7 @@ export function evalNet(events, p) {
|
|
|
424
297
|
failureReason: `a call matched but its body was not recorded, so \`bodyContains\` could not be checked — enable it where the app calls connect(): reticle({ captureNetworkBodies: true })`,
|
|
425
298
|
observed: 'a matching call with no recorded body',
|
|
426
299
|
expected: `a body carrying ${wantedBody(p)}`,
|
|
427
|
-
assertion:
|
|
300
|
+
assertion: NetBodyAssertion.CONTAINS,
|
|
428
301
|
};
|
|
429
302
|
}
|
|
430
303
|
if (keyFragment !== undefined && 0 === matches.length) {
|
|
@@ -434,7 +307,7 @@ export function evalNet(events, p) {
|
|
|
434
307
|
inconclusive: `a call matching ${describeNetFilter(p)} was answered with a body where ${JSON.stringify(p.bodyContains)} appears ONLY inside the key name ${JSON.stringify(keyFragment.key)} — no value in the response contains it, so this substring proves nothing about what any field holds. Assert the field itself: \`bodyMatches: { "<field>": <value> }\``,
|
|
435
308
|
observed: `response body ${JSON.stringify(clipBody(keyFragment.body))}`,
|
|
436
309
|
expected: `a response body carrying ${JSON.stringify(p.bodyContains)} as a value, or as a whole key`,
|
|
437
|
-
assertion:
|
|
310
|
+
assertion: NetBodyAssertion.CONTAINS,
|
|
438
311
|
};
|
|
439
312
|
}
|
|
440
313
|
if (redactedResponseField !== undefined && 0 === matches.length) {
|
|
@@ -444,24 +317,31 @@ export function evalNet(events, p) {
|
|
|
444
317
|
inconclusive: `a call matching ${describeNetFilter(p)} was answered, but its ${field} was REDACTED before the body was recorded, so this clause cannot be judged — a redacted field is unknown, not different. Assert on a non-sensitive key, or on the effect the value had`,
|
|
445
318
|
observed: `a matching response whose ${field} is ${REDACTED_VALUE}`,
|
|
446
319
|
expected: `a response body matching ${JSON.stringify(p.bodyMatches)}`,
|
|
447
|
-
assertion:
|
|
320
|
+
assertion: NetBodyAssertion.MATCHES,
|
|
448
321
|
};
|
|
449
322
|
}
|
|
450
|
-
const requestVerdict = requestBodyVerdict(requestState, p, matches.length);
|
|
451
|
-
if (requestVerdict !== undefined)
|
|
452
|
-
return requestVerdict;
|
|
453
323
|
// Ranked ABOVE the mismatch branch: when both a truncated and a full body missed the needle,
|
|
454
324
|
// the honest verdict is the undecidable one. Deciding on the full body would report a failure
|
|
455
325
|
// the truncated call may well contradict.
|
|
456
326
|
if (truncatedBody !== undefined && 0 === matches.length) {
|
|
327
|
+
// `bodyMatches` parses the whole body, and a JSON prefix never parses, so "assert on something
|
|
328
|
+
// inside the recorded prefix" changes nothing for it: the same clause on the same prefix is the
|
|
329
|
+
// same unknown. Name what can work for the clause that was actually asked (#1417). The grade
|
|
330
|
+
// stays inconclusive either way: a partial parse must not decide it, since a later duplicate key
|
|
331
|
+
// could overturn whatever the prefix seemed to say.
|
|
332
|
+
const missedMatch = NetBodyAssertion.MATCHES === truncatedClause;
|
|
333
|
+
const remedy = missedMatch ? TRUNCATED_MATCHES_REMEDY : TRUNCATED_PREFIX_REMEDY;
|
|
457
334
|
return {
|
|
458
335
|
pass: false,
|
|
459
|
-
inconclusive: `a call matching ${describeNetFilter(p)} was answered with a body that was TRUNCATED before it was recorded, and ${wantedBody(p)} is not in the part that was kept — so this is undecidable, not a failure. The cap is per-body and set where the app calls connect(): \`reticle.connect({ captureNetworkBodies: true, networkBodyMaxChars: 65536 })\`, or for the Vite plugin \`reticle({ networkBodyMaxChars: 65536 })\` / VITE_RETICLE_BODY_MAX_CHARS=65536 (default 8192, max 262144). An SDK older than this daemon ignores the option; a version skew on the session says so.
|
|
336
|
+
inconclusive: `a call matching ${describeNetFilter(p)} was answered with a body that was TRUNCATED before it was recorded, and ${wantedBody(p)} is not in the part that was kept — so this is undecidable, not a failure. The cap is per-body and set where the app calls connect(): \`reticle.connect({ captureNetworkBodies: true, networkBodyMaxChars: 65536 })\`, or for the Vite plugin \`reticle({ networkBodyMaxChars: 65536 })\` / VITE_RETICLE_BODY_MAX_CHARS=65536 (default 8192, max 262144). An SDK older than this daemon ignores the option; a version skew on the session says so. ${remedy}`,
|
|
460
337
|
observed: `the first ${String(truncatedBody.length)} characters of a truncated response body ${JSON.stringify(clipBody(truncatedBody))}`,
|
|
461
338
|
expected: `a response body carrying ${wantedBody(p)}`,
|
|
462
|
-
assertion:
|
|
339
|
+
assertion: truncatedClause ?? NetBodyAssertion.CONTAINS,
|
|
463
340
|
};
|
|
464
341
|
}
|
|
342
|
+
const requestVerdict = requestBodyVerdict(requestState, p, matches.length, bodyMismatch);
|
|
343
|
+
if (requestVerdict !== undefined)
|
|
344
|
+
return requestVerdict;
|
|
465
345
|
if (bodyMismatch !== undefined && 0 === matches.length) {
|
|
466
346
|
// The call is there and its body is there; only the VALUE differs. Counting it as zero matches
|
|
467
347
|
// points at the wiring, which is the one place the defect is not. A field clause also names the
|
|
@@ -473,7 +353,7 @@ export function evalNet(events, p) {
|
|
|
473
353
|
failureReason: `a call matching ${describeNetFilter(p)} was made and answered ${JSON.stringify(clipBody(bodyMismatch))}, which does not carry ${wantedBody(p)}${because} — the request fired, the response value is what differed`,
|
|
474
354
|
observed: `response body ${JSON.stringify(clipBody(bodyMismatch))}${because}`,
|
|
475
355
|
expected: `a response body carrying ${wantedBody(p)}`,
|
|
476
|
-
assertion:
|
|
356
|
+
assertion: NetBodyAssertion.CONTAINS,
|
|
477
357
|
};
|
|
478
358
|
}
|
|
479
359
|
// `count` (exact) turns presence into a cardinality assertion — catches the double-submit /
|
|
@@ -487,12 +367,12 @@ export function evalNet(events, p) {
|
|
|
487
367
|
}
|
|
488
368
|
if (matches.length !== p.count &&
|
|
489
369
|
0 === matches.length &&
|
|
490
|
-
targetsUnobservedChannel(p) &&
|
|
370
|
+
targetsUnobservedChannel(p.urlContains) &&
|
|
491
371
|
!sawSubresources) {
|
|
492
372
|
return {
|
|
493
373
|
pass: false,
|
|
494
|
-
failureReason: unobservedChannelReason(p),
|
|
495
|
-
inconclusive: unobservedChannelReason(p),
|
|
374
|
+
failureReason: unobservedChannelReason(describeNetFilter(p)),
|
|
375
|
+
inconclusive: unobservedChannelReason(describeNetFilter(p)),
|
|
496
376
|
assertion: 'net.count',
|
|
497
377
|
};
|
|
498
378
|
}
|
|
@@ -517,8 +397,8 @@ export function evalNet(events, p) {
|
|
|
517
397
|
if (download !== undefined)
|
|
518
398
|
return download;
|
|
519
399
|
}
|
|
520
|
-
if (hit === undefined && targetsUnobservedChannel(p) && !sawSubresources) {
|
|
521
|
-
const reason = unobservedChannelReason(p);
|
|
400
|
+
if (hit === undefined && targetsUnobservedChannel(p.urlContains) && !sawSubresources) {
|
|
401
|
+
const reason = unobservedChannelReason(describeNetFilter(p));
|
|
522
402
|
return {
|
|
523
403
|
pass: false,
|
|
524
404
|
failureReason: reason,
|
|
@@ -702,7 +582,7 @@ const isDeparture = (data) => data['initiator'] === NetInitiator.NAVIGATION;
|
|
|
702
582
|
/**
|
|
703
583
|
* "The page has gone quiet": no network/DOM/animation activity for at least `quietMs`. Needs the
|
|
704
584
|
* wall-clock `now` (in the buffer's time base) because "no activity in the last N ms" is relative to
|
|
705
|
-
* now, not to any buffered event — so `now` is injected (
|
|
585
|
+
* now, not to any buffered event — so `now` is injected (AGENTS.md rule 7), and the wait loop's
|
|
706
586
|
* poll interval is what eventually flips this to pass once activity stops.
|
|
707
587
|
*/
|
|
708
588
|
export function evalSettled(allEvents, p, now, scope) {
|
|
@@ -86,6 +86,30 @@ function placeholderValue(input) {
|
|
|
86
86
|
const value = input['value'];
|
|
87
87
|
return 'string' === typeof value && UNFILLED_PLACEHOLDER.test(value) ? value : undefined;
|
|
88
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* The one member of an `allOf`/`anyOf`/`not` every issue points into, when there is exactly one.
|
|
91
|
+
*
|
|
92
|
+
* Read at the outer level, a member's mistake was reported as the combinator's: "allOf accepts:
|
|
93
|
+
* predicates … unknown field satisfies" for a `satisfies` on a nested `element`, which sends the
|
|
94
|
+
* agent to fix the wrong level. Re-parsing that member names its own kind, fields and example.
|
|
95
|
+
*/
|
|
96
|
+
function onlyChildBlamed(input, issues) {
|
|
97
|
+
if ('object' !== typeof input || null === input)
|
|
98
|
+
return undefined;
|
|
99
|
+
const heads = new Set(issues.map((issue) => 'predicates' === issue.path[0] && 'number' === typeof issue.path[1]
|
|
100
|
+
? `predicates.${issue.path[1]}`
|
|
101
|
+
: 'predicate' === issue.path[0] && 1 < issue.path.length
|
|
102
|
+
? 'predicate'
|
|
103
|
+
: ''));
|
|
104
|
+
const [head] = heads;
|
|
105
|
+
if (1 !== heads.size || undefined === head || '' === head)
|
|
106
|
+
return undefined;
|
|
107
|
+
const [field, index] = head.split('.');
|
|
108
|
+
const record = input;
|
|
109
|
+
const container = record[field ?? ''];
|
|
110
|
+
const value = undefined === index ? container : container?.[Number(index)];
|
|
111
|
+
return undefined === value ? undefined : { path: head, value };
|
|
112
|
+
}
|
|
89
113
|
export function parsePredicate(input) {
|
|
90
114
|
const unfilled = placeholderValue(input);
|
|
91
115
|
if (unfilled !== undefined) {
|
|
@@ -98,6 +122,16 @@ export function parsePredicate(input) {
|
|
|
98
122
|
const parsed = PredicateSchema.safeParse(input);
|
|
99
123
|
if (parsed.success)
|
|
100
124
|
return parsed.data;
|
|
125
|
+
const child = onlyChildBlamed(input, parsed.error.issues);
|
|
126
|
+
if (child !== undefined) {
|
|
127
|
+
try {
|
|
128
|
+
parsePredicate(child.value);
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
if (error instanceof Error)
|
|
132
|
+
throw new Error(`${child.path}: ${error.message}`);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
101
135
|
const asWritten = kindAsWritten(input);
|
|
102
136
|
const kind = 'string' === typeof asWritten ? asWritten : 'unknown';
|
|
103
137
|
// Bounded on purpose: a union rejection can produce one issue per member, and pasting all of them
|
|
@@ -45,6 +45,11 @@ export declare function checkRequestBody(data: Record<string, unknown>, predicat
|
|
|
45
45
|
*
|
|
46
46
|
* Ranked the way the response side ranks its own: the two nobody could have answered (redacted,
|
|
47
47
|
* unrecorded, truncated) come before the one that WAS answered and came out false.
|
|
48
|
+
*
|
|
49
|
+
* `responseMismatch` is the response body of a call whose request DID satisfy the clause and whose
|
|
50
|
+
* response did not. When it is set, a definite request mismatch on some OTHER call is not the
|
|
51
|
+
* explanation and yields to it; the unknowns above still win, because the call they describe may
|
|
52
|
+
* be the one that would have satisfied the whole predicate.
|
|
48
53
|
*/
|
|
49
|
-
export declare function requestBodyVerdict(state: RequestBodyState, predicate: NetPredicate, matchCount: number): EvalResult | undefined;
|
|
54
|
+
export declare function requestBodyVerdict(state: RequestBodyState, predicate: NetPredicate, matchCount: number, responseMismatch?: string): EvalResult | undefined;
|
|
50
55
|
export {};
|
|
@@ -62,8 +62,13 @@ export function checkRequestBody(data, predicate, state) {
|
|
|
62
62
|
*
|
|
63
63
|
* Ranked the way the response side ranks its own: the two nobody could have answered (redacted,
|
|
64
64
|
* unrecorded, truncated) come before the one that WAS answered and came out false.
|
|
65
|
+
*
|
|
66
|
+
* `responseMismatch` is the response body of a call whose request DID satisfy the clause and whose
|
|
67
|
+
* response did not. When it is set, a definite request mismatch on some OTHER call is not the
|
|
68
|
+
* explanation and yields to it; the unknowns above still win, because the call they describe may
|
|
69
|
+
* be the one that would have satisfied the whole predicate.
|
|
65
70
|
*/
|
|
66
|
-
export function requestBodyVerdict(state, predicate, matchCount) {
|
|
71
|
+
export function requestBodyVerdict(state, predicate, matchCount, responseMismatch) {
|
|
67
72
|
if (matchCount > 0)
|
|
68
73
|
return undefined;
|
|
69
74
|
const wanted = JSON.stringify(predicate.requestBodyContains ?? predicate.requestBodyMatches);
|
|
@@ -95,7 +100,7 @@ export function requestBodyVerdict(state, predicate, matchCount) {
|
|
|
95
100
|
assertion: 'net.requestBody',
|
|
96
101
|
};
|
|
97
102
|
}
|
|
98
|
-
if (state.mismatch !== undefined) {
|
|
103
|
+
if (state.mismatch !== undefined && responseMismatch === undefined) {
|
|
99
104
|
// Named separately from "no call matched", for the reason the response side already learned: the
|
|
100
105
|
// request DID fire, and reporting zero matches sends the caller to check the url and the method,
|
|
101
106
|
// which are both fine, instead of to the value the UI actually sent.
|