@reticlehq/engine 3.8.2 → 3.10.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/body-failures.js +16 -2
- package/dist/disagreement/contradiction-evidence.d.ts +119 -0
- package/dist/disagreement/contradiction-evidence.js +360 -48
- package/dist/disagreement/contradiction-types.d.ts +25 -0
- package/dist/disagreement/contradictions.d.ts +17 -1
- package/dist/disagreement/contradictions.js +146 -78
- package/dist/disagreement/echo-mismatch.js +205 -32
- package/dist/disagreement/stale-response.d.ts +10 -1
- package/dist/disagreement/stale-response.js +122 -47
- package/dist/evidence/already-true.d.ts +1 -1
- package/dist/evidence/already-true.js +13 -7
- package/dist/evidence/baseline.d.ts +1 -0
- package/dist/evidence/baseline.js +28 -12
- package/dist/evidence/blind-spots.d.ts +20 -3
- package/dist/evidence/blind-spots.js +127 -21
- package/dist/evidence/step-effect.d.ts +5 -0
- package/dist/evidence/step-effect.js +5 -2
- package/dist/evidence/verified.d.ts +23 -0
- package/dist/evidence/verified.js +53 -2
- package/dist/question/declared.d.ts +27 -0
- package/dist/question/declared.js +64 -13
- package/dist/question/predicate/net-blind-spots.d.ts +40 -1
- package/dist/question/predicate/net-blind-spots.js +110 -1
- package/dist/question/predicate/predicate-animation.d.ts +52 -0
- package/dist/question/predicate/predicate-animation.js +258 -0
- package/dist/question/predicate/predicate-compare.js +53 -26
- package/dist/question/predicate/predicate-element.d.ts +20 -2
- package/dist/question/predicate/predicate-element.js +207 -45
- package/dist/question/predicate/predicate-eval-kit.d.ts +2 -0
- package/dist/question/predicate/predicate-eval-kit.js +19 -0
- package/dist/question/predicate/predicate-eval.d.ts +1 -4
- package/dist/question/predicate/predicate-eval.js +41 -47
- package/dist/question/predicate/predicate-parse.js +132 -4
- package/dist/question/predicate/predicate-route.js +81 -27
- package/dist/question/predicate/predicate-schema.js +84 -34
- package/dist/question/predicate/predicate-session.d.ts +5 -0
- package/dist/question/predicate/predicate.js +119 -50
- package/dist/question/predicate/truncated-body-advice.d.ts +5 -0
- package/dist/question/predicate/truncated-body-advice.js +25 -0
- package/dist/state-bookkeeping.d.ts +24 -0
- package/dist/state-bookkeeping.js +31 -0
- package/dist/window/event-filters.d.ts +64 -0
- package/dist/window/event-filters.js +149 -20
- package/dist/window/network-detail-merge.d.ts +6 -0
- package/dist/window/network-detail-merge.js +43 -2
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ContradictionKind, EventType } from '@reticlehq/core';
|
|
1
|
+
import { ContradictionKind, EventType, MUTATING_METHODS } from '@reticlehq/core';
|
|
2
2
|
/**
|
|
3
3
|
* A request that returned 2xx and reported failure INSIDE its body.
|
|
4
4
|
*
|
|
@@ -72,6 +72,19 @@ function reportsFailure(item) {
|
|
|
72
72
|
}
|
|
73
73
|
return false;
|
|
74
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* Whether a call can carry per-item outcomes: a write, or a call whose method was not recorded.
|
|
77
|
+
*
|
|
78
|
+
* A read returns stored records, and an `error` field on one of them is history, not the outcome of
|
|
79
|
+
* this request. Field report: an assert whose predicate held came back `no`, citing three
|
|
80
|
+
* GETs of a job list that held old, deliberately failed jobs.
|
|
81
|
+
*
|
|
82
|
+
* KNOWN LIMIT: a batch whose per-item results are read back by polling a GET is no longer counted
|
|
83
|
+
* here. Its write is, when the write's own body carries the results.
|
|
84
|
+
*/
|
|
85
|
+
function canCarryItemOutcomes(method) {
|
|
86
|
+
return 0 === method.length || MUTATING_METHODS.includes(method.toUpperCase());
|
|
87
|
+
}
|
|
75
88
|
/** Failed / total across the first item array found. Zero total when the body is not a batch. */
|
|
76
89
|
function itemOutcomes(body) {
|
|
77
90
|
for (const key of ITEM_KEYS) {
|
|
@@ -94,6 +107,7 @@ function parse(raw) {
|
|
|
94
107
|
return undefined; // not JSON — nothing to read, and guessing at prose would invent findings
|
|
95
108
|
}
|
|
96
109
|
}
|
|
110
|
+
const NO_ITEMS = { failed: 0, total: 0 };
|
|
97
111
|
const OK_MIN = 200;
|
|
98
112
|
const OK_MAX = 300;
|
|
99
113
|
/** Contradictions for 2xx responses whose bodies report failure. One per offending call. */
|
|
@@ -111,7 +125,7 @@ export function findBodyFailures(events) {
|
|
|
111
125
|
const url = 'string' === typeof event.data['url'] ? event.data['url'] : '';
|
|
112
126
|
const method = 'string' === typeof event.data['method'] ? event.data['method'] : '';
|
|
113
127
|
const where = `${method} ${url} → ${String(status)}`;
|
|
114
|
-
const { failed, total } = itemOutcomes(body);
|
|
128
|
+
const { failed, total } = canCarryItemOutcomes(method) ? itemOutcomes(body) : NO_ITEMS;
|
|
115
129
|
if (failed > 0) {
|
|
116
130
|
found.push({
|
|
117
131
|
kind: ContradictionKind.PARTIAL_FAILURE_IN_OK_RESPONSE,
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
* rules end up disagreeing about the same window.
|
|
14
14
|
*/
|
|
15
15
|
import { EventType, type ReticleEvent } from '@reticlehq/core';
|
|
16
|
+
import type { ContradictionOptions } from './contradiction-types.js';
|
|
17
|
+
import { type DeclaredNetFailure } from '../question/declared.js';
|
|
16
18
|
export interface NetCall {
|
|
17
19
|
/** When the call settled, on the session clock. */
|
|
18
20
|
t: number;
|
|
@@ -31,6 +33,12 @@ export interface NetCall {
|
|
|
31
33
|
* raised `ui-advanced-request-failed` against a UI that had done nothing wrong.
|
|
32
34
|
*/
|
|
33
35
|
ok: boolean | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* The document before this one made the call, and that document then unloaded (#1944). Its
|
|
38
|
+
* client reaction happened there, or was the unload itself, so no rule may read this window's
|
|
39
|
+
* quiet as "the client ignored the response".
|
|
40
|
+
*/
|
|
41
|
+
departed?: true;
|
|
34
42
|
}
|
|
35
43
|
export declare function netCall(e: ReticleEvent): NetCall;
|
|
36
44
|
/**
|
|
@@ -98,6 +106,51 @@ export declare function settledFieldRendered(event: ReticleEvent): boolean;
|
|
|
98
106
|
* keystroke or the browser's own toggle, true of a component that never re-rendered.
|
|
99
107
|
*/
|
|
100
108
|
export declare function screenMoved(event: ReticleEvent): boolean;
|
|
109
|
+
/**
|
|
110
|
+
* What the canvases on the page show about a window (#1525). A canvas renders as pixels, so a
|
|
111
|
+
* repaint makes no DOM mutation. The SDK sends a `CANVAS_DIGEST` for each canvas on its poll when the
|
|
112
|
+
* digest changed, and at the end of every act.
|
|
113
|
+
*/
|
|
114
|
+
export declare const CanvasPaint: {
|
|
115
|
+
/** No digest of a visible canvas in the window. */
|
|
116
|
+
readonly NONE: "none";
|
|
117
|
+
/** A visible canvas that was steady before the action showed something different: a render. */
|
|
118
|
+
readonly PAINTED: "painted";
|
|
119
|
+
/**
|
|
120
|
+
* A visible canvas was on screen and no change the action caused was seen. Not proof that it did
|
|
121
|
+
* not paint: the digest is a 16x16 sample, a canvas can paint after the act's own sample was taken,
|
|
122
|
+
* and a canvas that was already changing (a spinner, a live chart) cannot show what the action drew.
|
|
123
|
+
*/
|
|
124
|
+
readonly UNOBSERVED: "unobserved";
|
|
125
|
+
};
|
|
126
|
+
export type CanvasPaint = (typeof CanvasPaint)[keyof typeof CanvasPaint];
|
|
127
|
+
/**
|
|
128
|
+
* How long a canvas must have held its digest before the action for a change to count as the
|
|
129
|
+
* action's render: two of the SDK's 500 ms poll periods. The poll reports only a change, so a canvas
|
|
130
|
+
* that animates reports one every period, and its last change is always closer than this.
|
|
131
|
+
*/
|
|
132
|
+
export declare const CANVAS_STEADY_MS = 1000;
|
|
133
|
+
/**
|
|
134
|
+
* How far back a canvas that changed on its own disqualifies it. A dashboard chart, a clock or a
|
|
135
|
+
* ticker refreshes on a timer slower than `CANVAS_STEADY_MS`, so its last change can be seconds old
|
|
136
|
+
* and its next tick can land in the window. A change the poll found, not just after an act, is
|
|
137
|
+
* such a tick. A timer slower than this can still read as the render.
|
|
138
|
+
*/
|
|
139
|
+
export declare const CANVAS_QUIET_MS = 10000;
|
|
140
|
+
/**
|
|
141
|
+
* Did a canvas paint in this window, because of the action at `since`?
|
|
142
|
+
*
|
|
143
|
+
* A digest is a paint when it differs from the last digest of the same canvas (from `prior` or from
|
|
144
|
+
* earlier in the window), that canvas held its digest for `CANVAS_STEADY_MS` before the action, and
|
|
145
|
+
* it did not change on its own in the `CANVAS_QUIET_MS` before it. A change on its own is one the
|
|
146
|
+
* SDK's poll found more than `CANVAS_STEADY_MS` after the last act's digest: no act drew it. A
|
|
147
|
+
* canvas with no earlier digest is not a paint: nothing says what it showed before. A digest that
|
|
148
|
+
* says `visible: false` (no size, or outside the viewport) is never the paint, nor a canvas seen in
|
|
149
|
+
* the window: a hidden canvas cannot carry a render the user sees. It still counts as what the canvas
|
|
150
|
+
* showed before, since a click may scroll a canvas into view. An SDK older than the field sends no
|
|
151
|
+
* `visible`, and is read as visible.
|
|
152
|
+
*/
|
|
153
|
+
export declare function canvasPaint(events: readonly ReticleEvent[], prior: readonly ReticleEvent[], since: number): CanvasPaint;
|
|
101
154
|
/**
|
|
102
155
|
* Split the window into the app's traffic and the dev toolchain's own (see `DevToolingChannel`).
|
|
103
156
|
*
|
|
@@ -208,6 +261,13 @@ export declare function declareFailureHint(calls: readonly {
|
|
|
208
261
|
matchUrl?: string;
|
|
209
262
|
status: number | undefined;
|
|
210
263
|
}[]): string;
|
|
264
|
+
/**
|
|
265
|
+
* The page number a label shows, or undefined when the text is not a page label.
|
|
266
|
+
*
|
|
267
|
+
* A bare "N of M" with N = 0 is a count, not a page: no pager shows page 0, and a progress label
|
|
268
|
+
* such as "0 of 4 generated" does. Reading it as a page made a list that refetched its first page
|
|
269
|
+
* look like stalled pagination, and the verdict read `no` with no paging action at all.
|
|
270
|
+
*/
|
|
211
271
|
export declare function pageNumber(text: unknown): number | undefined;
|
|
212
272
|
/** The endpoint, page parameter and remaining query, for a GET that carries a page parameter. */
|
|
213
273
|
export declare function pageRequest(event: ReticleEvent): {
|
|
@@ -259,3 +319,62 @@ export declare const TargetFate: {
|
|
|
259
319
|
};
|
|
260
320
|
export type TargetFate = (typeof TargetFate)[keyof typeof TargetFate];
|
|
261
321
|
export declare function targetFate(events: readonly ReticleEvent[], ref: string | undefined, failedAt: number): TargetFate | undefined;
|
|
322
|
+
/** The name a signal is reported under when the app gave it none. */
|
|
323
|
+
export declare const UNNAMED_SIGNAL = "signal";
|
|
324
|
+
/**
|
|
325
|
+
* The success signals that can claim the failed writes in this window landed.
|
|
326
|
+
*
|
|
327
|
+
* A caller that declared the failure (`net { status: 409 }`) tests the failure path. A signal that the
|
|
328
|
+
* app fired BEFORE it sent the failed write cannot report the outcome of that write, so it is not a
|
|
329
|
+
* claim about it (#2172). A `form:submit` on the click, or an analytics beacon, is that kind of signal.
|
|
330
|
+
*
|
|
331
|
+
* The limit is when the write was SENT, not when its answer was recorded. The browser observer reads
|
|
332
|
+
* a failed response's body before it records the answer, so the app's own handler can fire its
|
|
333
|
+
* signal first. A limit on the answer would then hide the false green this rule exists for.
|
|
334
|
+
*
|
|
335
|
+
* Every failed write must be declared, and the window must hold when each one was sent. Otherwise
|
|
336
|
+
* every success signal stays a claim, as before.
|
|
337
|
+
*/
|
|
338
|
+
export declare function successClaims(events: readonly ReticleEvent[], failedWrites: readonly NetCall[], successSignals: readonly string[], declared?: readonly DeclaredNetFailure[]): readonly string[];
|
|
339
|
+
/**
|
|
340
|
+
* Did the store record the HTTP status of a call that failed in this window?
|
|
341
|
+
*
|
|
342
|
+
* A structural echo, like the echo of the error text: an app that keeps `status: 429` beside a
|
|
343
|
+
* retry button knows that the call failed. Strict, because a false acknowledgement hides a failed
|
|
344
|
+
* write. The value must be exactly that status (a number or its string), it must change in this
|
|
345
|
+
* write, and the write must come after the call was sent. The status of a call that succeeded is
|
|
346
|
+
* not one.
|
|
347
|
+
*/
|
|
348
|
+
export declare function storeEchoesFailedStatus(events: readonly ReticleEvent[]): boolean;
|
|
349
|
+
/**
|
|
350
|
+
* Did the app write text into an existing ASSERTIVE live region after a failed call was sent?
|
|
351
|
+
*
|
|
352
|
+
* The common way to show "Wrong email or password" is to write it into a `role="alert"` region that
|
|
353
|
+
* is already on the page, which a mount event does not record (#2173). The words do not decide, the
|
|
354
|
+
* level does. ARIA keeps the assertive level for errors and urgent warnings. A polite region
|
|
355
|
+
* (`role="status"`) is where an app writes "Saved", so text there is not an acknowledgement. The
|
|
356
|
+
* ceiling: an app that writes a success word into an alert region over a failed write is read as
|
|
357
|
+
* acknowledging it, as a mounted alert already is. Text written before the send cannot answer the
|
|
358
|
+
* call, and a cleared region says nothing.
|
|
359
|
+
*/
|
|
360
|
+
export declare function liveAlertAfterFailedSend(events: readonly ReticleEvent[]): boolean;
|
|
361
|
+
/** Reticle's own instrumentation's signals (core's `RETICLE_HYDRATION_SIGNAL`); not imported: coupling only shrinks. */
|
|
362
|
+
export declare const RETICLE_SIGNAL_NAMESPACE = "reticle:";
|
|
363
|
+
/**
|
|
364
|
+
* Whether NOTHING in this window is attributable to the action.
|
|
365
|
+
*
|
|
366
|
+
* Ambient churn is deliberately not counted as evidence the action worked — a background event
|
|
367
|
+
* stream, a polling store, a perf sample and a scroll position all move on their own. What counts:
|
|
368
|
+
*
|
|
369
|
+
* - a mutation inside the target's own subtree (what the target itself did),
|
|
370
|
+
* - a request (the action asked the server for something),
|
|
371
|
+
* - a navigation, or a dialog/live region appearing — the two ways a real reaction legitimately
|
|
372
|
+
* lands OUTSIDE the target, e.g. a modal portalled to the body,
|
|
373
|
+
* - a store change or an app signal tied to the action (#1531): see
|
|
374
|
+
* `tiedReaction`.
|
|
375
|
+
*
|
|
376
|
+
* The last two clauses are what keep this from manufacturing noise: a button that opens a modal
|
|
377
|
+
* mutates nothing within itself, and a Pause button whose store updates on the media `pause` event
|
|
378
|
+
* renders its new label only later. Neither must be called dead.
|
|
379
|
+
*/
|
|
380
|
+
export declare function didNothing(events: readonly ReticleEvent[], requests: readonly NetCall[], options: ContradictionOptions): boolean;
|