@reticlehq/core 3.1.0 → 3.3.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/artifacts/flow-composition.d.ts +3 -2
- package/dist/artifacts/flow-constants.d.ts +59 -2
- package/dist/artifacts/flow-constants.js +63 -3
- package/dist/artifacts/flow-expect-flat.d.ts +260 -0
- package/dist/artifacts/flow-expect-flat.js +284 -0
- package/dist/artifacts/flow-mutation-target.d.ts +0 -1
- package/dist/artifacts/flow-mutation-target.js +26 -2
- package/dist/artifacts/flow-step-tool.d.ts +2 -0
- package/dist/artifacts/flow-types.d.ts +1071 -1225
- package/dist/artifacts/flow-types.js +96 -140
- package/dist/artifacts/impact.d.ts +200 -20
- package/dist/artifacts/impact.js +72 -0
- package/dist/artifacts/journal.d.ts +85 -6
- package/dist/artifacts/journal.js +51 -1
- package/dist/hooks/hook-events.d.ts +18 -18
- package/dist/hud-entry.d.ts +9 -0
- package/dist/hud-entry.js +9 -0
- package/dist/identity/brand.d.ts +46 -0
- package/dist/identity/brand.js +7 -0
- package/dist/identity/source-constants.d.ts +11 -0
- package/dist/identity/source-constants.js +11 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +26 -2
- package/dist/onboarding.d.ts +2 -2
- package/dist/realm/registry.d.ts +0 -8
- package/dist/realm/registry.js +1 -11
- package/dist/schema/event-message.json +3 -1
- package/dist/schema/event-payloads.json +74 -1
- package/dist/schema/event-type.json +3 -1
- package/dist/schema/reticle-event.json +3 -1
- package/dist/schema/reticle-message.json +3 -1
- package/dist/source-constants.cjs +1 -0
- package/dist/source-constants.d.cts +1 -0
- package/dist/telemetry-feedback.d.ts +6 -6
- package/dist/telemetry-refusal.d.ts +2 -2
- package/dist/telemetry-session.d.ts +25 -2
- package/dist/telemetry-session.js +13 -0
- package/dist/telemetry.d.ts +184 -102
- package/dist/telemetry.js +29 -1
- package/dist/verdict/consequence.d.ts +10 -0
- package/dist/verdict/consequence.js +13 -0
- package/dist/verdict/intent.d.ts +36 -12
- package/dist/verdict/intent.js +66 -10
- package/dist/verdict/predicate-tree.d.ts +47 -0
- package/dist/verdict/predicate-tree.js +146 -0
- package/dist/verdict/predicate.d.ts +129 -0
- package/dist/verdict/predicate.js +394 -0
- package/dist/verdict/property-assertion.d.ts +191 -0
- package/dist/verdict/property-assertion.js +42 -0
- package/dist/verdict/security.js +16 -4
- package/dist/verdict/verdict-attribution.d.ts +52 -0
- package/dist/verdict/verdict-attribution.js +87 -0
- package/dist/verdict/verification-run.d.ts +98 -84
- package/dist/verdict/verification-run.js +8 -1
- package/dist/verdict/verified-constants.d.ts +18 -0
- package/dist/verdict/verified-constants.js +18 -0
- package/dist/wire/constants/constants.d.ts +108 -98
- package/dist/wire/constants/constants.js +116 -97
- package/dist/wire/constants/discovery.d.ts +25 -0
- package/dist/wire/constants/discovery.js +25 -0
- package/dist/wire/constants/event-types.d.ts +122 -0
- package/dist/wire/constants/event-types.js +121 -0
- package/dist/wire/constants/hud-controls.d.ts +19 -0
- package/dist/wire/constants/hud-controls.js +95 -0
- package/dist/wire/constants/hud-use.d.ts +27 -0
- package/dist/wire/constants/hud-use.js +24 -0
- package/dist/wire/constants/session-constants.d.ts +24 -0
- package/dist/wire/constants/session-constants.js +24 -0
- package/dist/wire/event-payloads.d.ts +70 -10
- package/dist/wire/event-payloads.js +20 -1
- package/dist/wire/messages.d.ts +90 -48
- package/dist/wire/messages.js +17 -0
- package/dist/wire/net.d.ts +42 -0
- package/dist/wire/net.js +48 -0
- package/dist/wire/snapshot-tree.d.ts +33 -0
- package/dist/wire/snapshot-tree.js +43 -0
- package/dist/wire/state-select.d.ts +2 -1
- package/dist/wire/state-select.js +56 -3
- package/dist/wire/toon.js +28 -7
- package/dist/wire/types.d.ts +91 -66
- package/dist/wire/types.js +23 -1
- package/package.json +5 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { FlowFile } from './flow-types.js';
|
|
2
|
+
import type { Predicate } from '../verdict/predicate.js';
|
|
2
3
|
/**
|
|
3
4
|
* Whether one flow may be replayed straight after another.
|
|
4
5
|
*
|
|
@@ -22,7 +23,7 @@ export interface CompositionCheck {
|
|
|
22
23
|
/** True when nothing B requires is left undischarged by A. Vacuously true when either is silent. */
|
|
23
24
|
readonly ok: boolean;
|
|
24
25
|
/** The claims B requires that A does not ensure. Empty when `ok`. */
|
|
25
|
-
readonly unmet: readonly
|
|
26
|
+
readonly unmet: readonly Predicate[];
|
|
26
27
|
/** True when neither flow declared anything, so the answer is "unchecked" rather than "safe". */
|
|
27
28
|
readonly unchecked: boolean;
|
|
28
29
|
}
|
|
@@ -52,8 +52,25 @@ export declare const PROJECT_RUN_CAP: {
|
|
|
52
52
|
};
|
|
53
53
|
/** Maximum distinct route identities retained in project.json. */
|
|
54
54
|
export declare const PROJECT_ROUTE_CAP = 200;
|
|
55
|
-
/**
|
|
56
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Schema version STAMPED onto a flow file this Reticle writes.
|
|
57
|
+
*
|
|
58
|
+
* 2 since `FlowStep.expect` became a `Predicate`. Version 1 stored one flat slot per kind, which
|
|
59
|
+
* could not hold a composite, a negation or a property assertion — an `allOf[netA, netB]` saved as
|
|
60
|
+
* one of the two arms and the other was gone with nothing said.
|
|
61
|
+
*/
|
|
62
|
+
export declare const FLOW_FILE_VERSION = 2;
|
|
63
|
+
/**
|
|
64
|
+
* Every version this Reticle can READ, which is not the same question as what it writes.
|
|
65
|
+
*
|
|
66
|
+
* A flow file is committed to a repository that other people share, so a reader that refused the
|
|
67
|
+
* previous format would break a teammate's suite on the day one person upgraded. v1 is lifted on
|
|
68
|
+
* read by `flowExpectToPredicate` and is NEVER rewritten: the file on disk stays v1 until something
|
|
69
|
+
* saves it again, at which point it is stamped with the version above.
|
|
70
|
+
*
|
|
71
|
+
* A number outside this set is the wrong READER, not a damaged file, and says so.
|
|
72
|
+
*/
|
|
73
|
+
export declare const READABLE_FLOW_VERSIONS: ReadonlySet<number>;
|
|
57
74
|
/** How a flow step is anchored to the live DOM at replay time (semantic, never a volatile ref). */
|
|
58
75
|
export declare const AnchorKind: {
|
|
59
76
|
readonly TESTID: "testid";
|
|
@@ -74,6 +91,19 @@ export declare const FlowErrorCode: {
|
|
|
74
91
|
readonly INVALID_NAME: "flow_invalid_name";
|
|
75
92
|
readonly NOT_FOUND: "flow_not_found";
|
|
76
93
|
readonly PARSE_FAILED: "flow_parse_failed";
|
|
94
|
+
/**
|
|
95
|
+
* The file is well-formed and carries a `version` this build does not read.
|
|
96
|
+
*
|
|
97
|
+
* Distinct from PARSE_FAILED because the two need OPPOSITE fixes, and saying the wrong one costs
|
|
98
|
+
* somebody a search for damage that is not there. Malformed means "repair or regenerate this
|
|
99
|
+
* file". Wrong version means the file is fine and the READER is the wrong one -- upgrade or
|
|
100
|
+
* downgrade Reticle, and do not touch the flow.
|
|
101
|
+
*
|
|
102
|
+
* `ProjectReadError.WRONG_VERSION` above draws the same line for `project.json` and for the same
|
|
103
|
+
* reason; flows simply had no equivalent, so every future format bump would have reported itself
|
|
104
|
+
* as corruption to every reader already in the field.
|
|
105
|
+
*/
|
|
106
|
+
readonly WRONG_VERSION: "flow_wrong_version";
|
|
77
107
|
readonly NO_RECORDING: "flow_no_recording";
|
|
78
108
|
};
|
|
79
109
|
export type FlowErrorCode = (typeof FlowErrorCode)[keyof typeof FlowErrorCode];
|
|
@@ -131,6 +161,23 @@ export declare const DriftReason: {
|
|
|
131
161
|
* hunting for the nearest testid to the literal word "unresolved".
|
|
132
162
|
*/
|
|
133
163
|
readonly ANCHOR_DEGRADED: "anchor_degraded";
|
|
164
|
+
/**
|
|
165
|
+
* The anchor resolved to MORE THAN ONE live element, so which one the recording meant is no
|
|
166
|
+
* longer decidable.
|
|
167
|
+
*
|
|
168
|
+
* Replay used to take the first match, act on it, and return `ok: true` carrying a note --
|
|
169
|
+
* "ambiguous testid 'x', used first match". The verdict is computed from `drift` and `ok` alone,
|
|
170
|
+
* so the note never reached it: a replay that clicked row 3 instead of row 1 reported `ok`.
|
|
171
|
+
* That is a locator resolving to a different element than the one recorded, reported green,
|
|
172
|
+
* which is the one thing a replay must never do -- its entire claim is "it did what it did
|
|
173
|
+
* before".
|
|
174
|
+
*
|
|
175
|
+
* Distinct from TESTID_NOT_FOUND for the same reason ANCHOR_DEGRADED is, and the distinction is
|
|
176
|
+
* what makes it fixable: "your element disappeared" wants a RENAMED anchor, and "your element is
|
|
177
|
+
* now several elements" wants a NARROWER one. Heal can only propose the second if the reason
|
|
178
|
+
* says which happened.
|
|
179
|
+
*/
|
|
180
|
+
readonly ANCHOR_AMBIGUOUS: "anchor_ambiguous";
|
|
134
181
|
/**
|
|
135
182
|
* The step's anchor resolved and its action ran; the testid its `expect.element` names was absent
|
|
136
183
|
* afterwards. Distinct from TESTID_NOT_FOUND for the same reason ANCHOR_DEGRADED is: "the element
|
|
@@ -139,6 +186,16 @@ export declare const DriftReason: {
|
|
|
139
186
|
* step whose anchor was fine.
|
|
140
187
|
*/
|
|
141
188
|
readonly EXPECT_ELEMENT_NOT_FOUND: "expect_element_not_found";
|
|
189
|
+
/**
|
|
190
|
+
* The step's `expect.net` named a request that was still ON THE WIRE when the budget ended.
|
|
191
|
+
*
|
|
192
|
+
* A blind spot, not a failed assertion. Reported as SIGNAL_NOT_OBSERVED it reads as "the request
|
|
193
|
+
* you declared never happened", which sends a reader hunting a feature that works — the live
|
|
194
|
+
* verdict path already refuses to grade a named in-flight request as a miss, and replay was the
|
|
195
|
+
* one reader that had not asked the question. The fix for this drift is a longer budget or a
|
|
196
|
+
* faster endpoint; the fix for SIGNAL_NOT_OBSERVED is the handler behind the action.
|
|
197
|
+
*/
|
|
198
|
+
readonly NET_STILL_IN_FLIGHT: "net_still_in_flight";
|
|
142
199
|
};
|
|
143
200
|
export type DriftReason = (typeof DriftReason)[keyof typeof DriftReason];
|
|
144
201
|
/**
|
|
@@ -49,8 +49,25 @@ export const PROJECT_RUN_CAP = {
|
|
|
49
49
|
};
|
|
50
50
|
/** Maximum distinct route identities retained in project.json. */
|
|
51
51
|
export const PROJECT_ROUTE_CAP = 200;
|
|
52
|
-
/**
|
|
53
|
-
|
|
52
|
+
/**
|
|
53
|
+
* Schema version STAMPED onto a flow file this Reticle writes.
|
|
54
|
+
*
|
|
55
|
+
* 2 since `FlowStep.expect` became a `Predicate`. Version 1 stored one flat slot per kind, which
|
|
56
|
+
* could not hold a composite, a negation or a property assertion — an `allOf[netA, netB]` saved as
|
|
57
|
+
* one of the two arms and the other was gone with nothing said.
|
|
58
|
+
*/
|
|
59
|
+
export const FLOW_FILE_VERSION = 2;
|
|
60
|
+
/**
|
|
61
|
+
* Every version this Reticle can READ, which is not the same question as what it writes.
|
|
62
|
+
*
|
|
63
|
+
* A flow file is committed to a repository that other people share, so a reader that refused the
|
|
64
|
+
* previous format would break a teammate's suite on the day one person upgraded. v1 is lifted on
|
|
65
|
+
* read by `flowExpectToPredicate` and is NEVER rewritten: the file on disk stays v1 until something
|
|
66
|
+
* saves it again, at which point it is stamped with the version above.
|
|
67
|
+
*
|
|
68
|
+
* A number outside this set is the wrong READER, not a damaged file, and says so.
|
|
69
|
+
*/
|
|
70
|
+
export const READABLE_FLOW_VERSIONS = new Set([1, FLOW_FILE_VERSION]);
|
|
54
71
|
/** How a flow step is anchored to the live DOM at replay time (semantic, never a volatile ref). */
|
|
55
72
|
export const AnchorKind = {
|
|
56
73
|
TESTID: 'testid', // { kind:'testid', value }
|
|
@@ -70,6 +87,19 @@ export const FlowErrorCode = {
|
|
|
70
87
|
INVALID_NAME: 'flow_invalid_name', // path traversal / illegal chars
|
|
71
88
|
NOT_FOUND: 'flow_not_found', // load of a missing flow
|
|
72
89
|
PARSE_FAILED: 'flow_parse_failed', // on-disk JSON failed zod validation
|
|
90
|
+
/**
|
|
91
|
+
* The file is well-formed and carries a `version` this build does not read.
|
|
92
|
+
*
|
|
93
|
+
* Distinct from PARSE_FAILED because the two need OPPOSITE fixes, and saying the wrong one costs
|
|
94
|
+
* somebody a search for damage that is not there. Malformed means "repair or regenerate this
|
|
95
|
+
* file". Wrong version means the file is fine and the READER is the wrong one -- upgrade or
|
|
96
|
+
* downgrade Reticle, and do not touch the flow.
|
|
97
|
+
*
|
|
98
|
+
* `ProjectReadError.WRONG_VERSION` above draws the same line for `project.json` and for the same
|
|
99
|
+
* reason; flows simply had no equivalent, so every future format bump would have reported itself
|
|
100
|
+
* as corruption to every reader already in the field.
|
|
101
|
+
*/
|
|
102
|
+
WRONG_VERSION: 'flow_wrong_version',
|
|
73
103
|
NO_RECORDING: 'flow_no_recording', // save with no compiled program by that name
|
|
74
104
|
};
|
|
75
105
|
/** A flow name must be a single safe path segment (no '/', '\\', '..', leading dot). */
|
|
@@ -125,6 +155,23 @@ export const DriftReason = {
|
|
|
125
155
|
* hunting for the nearest testid to the literal word "unresolved".
|
|
126
156
|
*/
|
|
127
157
|
ANCHOR_DEGRADED: 'anchor_degraded',
|
|
158
|
+
/**
|
|
159
|
+
* The anchor resolved to MORE THAN ONE live element, so which one the recording meant is no
|
|
160
|
+
* longer decidable.
|
|
161
|
+
*
|
|
162
|
+
* Replay used to take the first match, act on it, and return `ok: true` carrying a note --
|
|
163
|
+
* "ambiguous testid 'x', used first match". The verdict is computed from `drift` and `ok` alone,
|
|
164
|
+
* so the note never reached it: a replay that clicked row 3 instead of row 1 reported `ok`.
|
|
165
|
+
* That is a locator resolving to a different element than the one recorded, reported green,
|
|
166
|
+
* which is the one thing a replay must never do -- its entire claim is "it did what it did
|
|
167
|
+
* before".
|
|
168
|
+
*
|
|
169
|
+
* Distinct from TESTID_NOT_FOUND for the same reason ANCHOR_DEGRADED is, and the distinction is
|
|
170
|
+
* what makes it fixable: "your element disappeared" wants a RENAMED anchor, and "your element is
|
|
171
|
+
* now several elements" wants a NARROWER one. Heal can only propose the second if the reason
|
|
172
|
+
* says which happened.
|
|
173
|
+
*/
|
|
174
|
+
ANCHOR_AMBIGUOUS: 'anchor_ambiguous',
|
|
128
175
|
/**
|
|
129
176
|
* The step's anchor resolved and its action ran; the testid its `expect.element` names was absent
|
|
130
177
|
* afterwards. Distinct from TESTID_NOT_FOUND for the same reason ANCHOR_DEGRADED is: "the element
|
|
@@ -133,6 +180,16 @@ export const DriftReason = {
|
|
|
133
180
|
* step whose anchor was fine.
|
|
134
181
|
*/
|
|
135
182
|
EXPECT_ELEMENT_NOT_FOUND: 'expect_element_not_found',
|
|
183
|
+
/**
|
|
184
|
+
* The step's `expect.net` named a request that was still ON THE WIRE when the budget ended.
|
|
185
|
+
*
|
|
186
|
+
* A blind spot, not a failed assertion. Reported as SIGNAL_NOT_OBSERVED it reads as "the request
|
|
187
|
+
* you declared never happened", which sends a reader hunting a feature that works — the live
|
|
188
|
+
* verdict path already refuses to grade a named in-flight request as a miss, and replay was the
|
|
189
|
+
* one reader that had not asked the question. The fix for this drift is a longer budget or a
|
|
190
|
+
* faster endpoint; the fix for SIGNAL_NOT_OBSERVED is the handler behind the action.
|
|
191
|
+
*/
|
|
192
|
+
NET_STILL_IN_FLIGHT: 'net_still_in_flight',
|
|
136
193
|
};
|
|
137
194
|
/**
|
|
138
195
|
* Did the step's anchor resolve and its action RUN, leaving only the declared consequence unmet?
|
|
@@ -150,7 +207,10 @@ export const DriftReason = {
|
|
|
150
207
|
export function isConsequenceDrift(reason) {
|
|
151
208
|
return (DriftReason.SIGNAL_NOT_OBSERVED === reason ||
|
|
152
209
|
DriftReason.STATE_MISMATCH === reason ||
|
|
153
|
-
DriftReason.EXPECT_ELEMENT_NOT_FOUND === reason
|
|
210
|
+
DriftReason.EXPECT_ELEMENT_NOT_FOUND === reason ||
|
|
211
|
+
// Same class: the anchor resolved, the action ran, and the page is where the step left it. Only
|
|
212
|
+
// the answer is missing. Excluding it would halt a sweep on a slow endpoint.
|
|
213
|
+
DriftReason.NET_STILL_IN_FLIGHT === reason);
|
|
154
214
|
}
|
|
155
215
|
/** Default timeout (ms) a signal anchor waits to be observed at replay. */
|
|
156
216
|
export const FLOW_SIGNAL_TIMEOUT_MS = 4000;
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading the FLAT expect a flow file used to store.
|
|
3
|
+
*
|
|
4
|
+
* The older format held one slot per kind — `{ signal, net, element, text, state, console, route }`
|
|
5
|
+
* — which could not nest, compose or negate. A step's expect is a `Predicate` now. This is the
|
|
6
|
+
* reader that bridges them, and it lives in core because the schema that parses a flow is here and
|
|
7
|
+
* the lift happens during the parse.
|
|
8
|
+
*
|
|
9
|
+
* A READ NEVER REWRITES. A v1 file stays v1 on disk until something saves it again; only the value
|
|
10
|
+
* in memory is lifted. That is what makes the migration safe to ship to people whose flows are
|
|
11
|
+
* committed to a repository they share.
|
|
12
|
+
*/
|
|
13
|
+
import { z } from 'zod';
|
|
14
|
+
import type { Predicate } from '../verdict/predicate.js';
|
|
15
|
+
/**
|
|
16
|
+
* A post-condition a step asserts (compiled from a structured annotation; optional).
|
|
17
|
+
*
|
|
18
|
+
* Strict, at every nesting level: an unrecognized key (a typo, or a predicate kind this schema
|
|
19
|
+
* doesn't model, e.g. `allOf`, or a typo'd `net`/`console`/`element`/`state` sub-field) must fail
|
|
20
|
+
* to parse instead of being silently dropped. A loose z.object() here would quietly discard the
|
|
21
|
+
* extra key and leave the step with a weaker (or empty) assertion than its author wrote — the
|
|
22
|
+
* flow then replays green against nothing, having proved no real regression.
|
|
23
|
+
*/
|
|
24
|
+
export declare const FlowExpectSchema: z.ZodObject<{
|
|
25
|
+
/**
|
|
26
|
+
* The route the step must have reached — the consequence of a NAVIGATION.
|
|
27
|
+
*
|
|
28
|
+
* Absent until now, and its absence was not a corner case: navigation is one of the commonest
|
|
29
|
+
* journeys there is, and every route-asserted drive saved a flow that could never go red. Found
|
|
30
|
+
* by driving a real app, where `act_and_wait { until: { kind: "route" } }` returned
|
|
31
|
+
* `verified: "yes"` and the flow saved from that same drive graded `assertion-free`.
|
|
32
|
+
*
|
|
33
|
+
* Additive and optional, so a flow file written before it still parses and FLOW_FILE_VERSION
|
|
34
|
+
* stays 1 — the same treatment `signalData` and `signalCount` had.
|
|
35
|
+
*/
|
|
36
|
+
route: z.ZodOptional<z.ZodObject<{
|
|
37
|
+
pathname: z.ZodOptional<z.ZodString>;
|
|
38
|
+
contains: z.ZodOptional<z.ZodString>;
|
|
39
|
+
}, "strip", z.ZodTypeAny, {
|
|
40
|
+
contains?: string | undefined;
|
|
41
|
+
pathname?: string | undefined;
|
|
42
|
+
}, {
|
|
43
|
+
contains?: string | undefined;
|
|
44
|
+
pathname?: string | undefined;
|
|
45
|
+
}>>;
|
|
46
|
+
signal: z.ZodOptional<z.ZodString>;
|
|
47
|
+
/**
|
|
48
|
+
* Optional payload shape an `assert-signal` annotation requires the signal
|
|
49
|
+
* to match (the predicate DSL's signal.dataMatches). Additive/optional — a flow file with a
|
|
50
|
+
* bare `signal` still parses, and the on-disk version stays FLOW_FILE_VERSION 1.
|
|
51
|
+
*/
|
|
52
|
+
signalData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
53
|
+
/**
|
|
54
|
+
* Exact number of times the signal must have fired — the signal-side twin of `net.count`, and the
|
|
55
|
+
* only way a saved flow can keep a cardinality the agent actually asserted. Without it a
|
|
56
|
+
* `count: 1` drive would be recorded as bare presence, which is a strictly WEAKER claim than the
|
|
57
|
+
* one made: the replayed flow then goes green on the double-fire it was recorded to catch.
|
|
58
|
+
* Additive/optional — a flow file with a bare `signal` still parses, and FLOW_FILE_VERSION stays 1.
|
|
59
|
+
*/
|
|
60
|
+
signalCount: z.ZodOptional<z.ZodNumber>;
|
|
61
|
+
net: z.ZodOptional<z.ZodObject<{
|
|
62
|
+
method: z.ZodOptional<z.ZodString>;
|
|
63
|
+
urlContains: z.ZodOptional<z.ZodString>;
|
|
64
|
+
status: z.ZodOptional<z.ZodNumber>;
|
|
65
|
+
/**
|
|
66
|
+
* Exact number of matching requests since the action — turns presence into a cardinality
|
|
67
|
+
* assertion. Catches the double-submit / useEffect-double-fire / retry-storm regression class:
|
|
68
|
+
* the request fired (presence passes) but fired the WRONG number of times. Omit = presence (≥1).
|
|
69
|
+
*/
|
|
70
|
+
count: z.ZodOptional<z.ZodNumber>;
|
|
71
|
+
}, "strict", z.ZodTypeAny, {
|
|
72
|
+
status?: number | undefined;
|
|
73
|
+
method?: string | undefined;
|
|
74
|
+
urlContains?: string | undefined;
|
|
75
|
+
count?: number | undefined;
|
|
76
|
+
}, {
|
|
77
|
+
status?: number | undefined;
|
|
78
|
+
method?: string | undefined;
|
|
79
|
+
urlContains?: string | undefined;
|
|
80
|
+
count?: number | undefined;
|
|
81
|
+
}>>;
|
|
82
|
+
/**
|
|
83
|
+
* Console golden end-condition: assert the action logged (or, with absent:true, did NOT log) a
|
|
84
|
+
* console message at `level` (default 'error'). `absent:true` is the common case — "the action
|
|
85
|
+
* completed with a clean console" — catching the regression where an action throws a caught error
|
|
86
|
+
* / logs an uncaught rejection while the UI still renders fine (a presence check passes it).
|
|
87
|
+
*/
|
|
88
|
+
console: z.ZodOptional<z.ZodObject<{
|
|
89
|
+
level: z.ZodOptional<z.ZodString>;
|
|
90
|
+
absent: z.ZodOptional<z.ZodBoolean>;
|
|
91
|
+
}, "strict", z.ZodTypeAny, {
|
|
92
|
+
level?: string | undefined;
|
|
93
|
+
absent?: boolean | undefined;
|
|
94
|
+
}, {
|
|
95
|
+
level?: string | undefined;
|
|
96
|
+
absent?: boolean | undefined;
|
|
97
|
+
}>>;
|
|
98
|
+
element: z.ZodOptional<z.ZodObject<{
|
|
99
|
+
testid: z.ZodOptional<z.ZodString>;
|
|
100
|
+
role: z.ZodOptional<z.ZodString>;
|
|
101
|
+
name: z.ZodOptional<z.ZodString>;
|
|
102
|
+
}, "strict", z.ZodTypeAny, {
|
|
103
|
+
testid?: string | undefined;
|
|
104
|
+
role?: string | undefined;
|
|
105
|
+
name?: string | undefined;
|
|
106
|
+
}, {
|
|
107
|
+
testid?: string | undefined;
|
|
108
|
+
role?: string | undefined;
|
|
109
|
+
name?: string | undefined;
|
|
110
|
+
}>>;
|
|
111
|
+
/**
|
|
112
|
+
* Rendered text as an end-condition, using the shapes the assert surface already accepts.
|
|
113
|
+
*
|
|
114
|
+
* The gap this closes: an app with no testids, no `reticle.signal`, no registrable store and no
|
|
115
|
+
* network call on the interaction under test -- a discount price computed and rendered, a
|
|
116
|
+
* formatted total, a derived label -- could not produce an asserted flow AT ALL. Everything the
|
|
117
|
+
* vocabulary offered needed a channel that app does not have, so the only honest outcome was
|
|
118
|
+
* `assertion-free`, which is a permanent green (#811).
|
|
119
|
+
*
|
|
120
|
+
* Derived-DOM rendering is a large share of what actually breaks in a UI, and it was the share
|
|
121
|
+
* that could not be pinned.
|
|
122
|
+
*
|
|
123
|
+
* Classified PRESENCE, not consequence, and that is not a technicality: text is read from the
|
|
124
|
+
* DOM, so a locator healed to the wrong element can still satisfy it. It earns `presence-only`,
|
|
125
|
+
* which is a real grade above `assertion-free` and honestly below `signal`/`net`/`state`.
|
|
126
|
+
*/
|
|
127
|
+
text: z.ZodOptional<z.ZodObject<{
|
|
128
|
+
contains: z.ZodString;
|
|
129
|
+
/** Narrow the search to a container, exactly as the `text` predicate's `scope` does. */
|
|
130
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
131
|
+
/** Assert the text is GONE — the regression check for a cleared error or a dismissed toast. */
|
|
132
|
+
absent: z.ZodOptional<z.ZodBoolean>;
|
|
133
|
+
/** Require the match to be visible, not merely present in the DOM. */
|
|
134
|
+
visible: z.ZodOptional<z.ZodBoolean>;
|
|
135
|
+
}, "strict", z.ZodTypeAny, {
|
|
136
|
+
contains: string;
|
|
137
|
+
visible?: boolean | undefined;
|
|
138
|
+
scope?: string | undefined;
|
|
139
|
+
absent?: boolean | undefined;
|
|
140
|
+
}, {
|
|
141
|
+
contains: string;
|
|
142
|
+
visible?: boolean | undefined;
|
|
143
|
+
scope?: string | undefined;
|
|
144
|
+
absent?: boolean | undefined;
|
|
145
|
+
}>>;
|
|
146
|
+
/**
|
|
147
|
+
* Assert a registered store's value — the source of truth no DOM/network read can reach. Compiles
|
|
148
|
+
* to the predicate engine's `state` predicate. Additive/optional — a flow without it still parses
|
|
149
|
+
* and the on-disk version stays FLOW_FILE_VERSION 1. `equals` accepts a literal, omitted = presence,
|
|
150
|
+
* or a `{ $gte | $contains | $length }` operator pattern.
|
|
151
|
+
*/
|
|
152
|
+
state: z.ZodOptional<z.ZodObject<{
|
|
153
|
+
store: z.ZodOptional<z.ZodString>;
|
|
154
|
+
path: z.ZodString;
|
|
155
|
+
equals: z.ZodOptional<z.ZodUnknown>;
|
|
156
|
+
/**
|
|
157
|
+
* Treat this as an INVARIANT that must still hold AFTER the action settles, rather than a
|
|
158
|
+
* condition to wait for. Set it for a blast-radius check ("this unrelated path must NOT have
|
|
159
|
+
* moved") — without it a wait-until-true read passes before an over-reaching side-effect lands.
|
|
160
|
+
*/
|
|
161
|
+
hold: z.ZodOptional<z.ZodBoolean>;
|
|
162
|
+
}, "strict", z.ZodTypeAny, {
|
|
163
|
+
path: string;
|
|
164
|
+
store?: string | undefined;
|
|
165
|
+
equals?: unknown;
|
|
166
|
+
hold?: boolean | undefined;
|
|
167
|
+
}, {
|
|
168
|
+
path: string;
|
|
169
|
+
store?: string | undefined;
|
|
170
|
+
equals?: unknown;
|
|
171
|
+
hold?: boolean | undefined;
|
|
172
|
+
}>>;
|
|
173
|
+
}, "strict", z.ZodTypeAny, {
|
|
174
|
+
signal?: string | undefined;
|
|
175
|
+
text?: {
|
|
176
|
+
contains: string;
|
|
177
|
+
visible?: boolean | undefined;
|
|
178
|
+
scope?: string | undefined;
|
|
179
|
+
absent?: boolean | undefined;
|
|
180
|
+
} | undefined;
|
|
181
|
+
net?: {
|
|
182
|
+
status?: number | undefined;
|
|
183
|
+
method?: string | undefined;
|
|
184
|
+
urlContains?: string | undefined;
|
|
185
|
+
count?: number | undefined;
|
|
186
|
+
} | undefined;
|
|
187
|
+
state?: {
|
|
188
|
+
path: string;
|
|
189
|
+
store?: string | undefined;
|
|
190
|
+
equals?: unknown;
|
|
191
|
+
hold?: boolean | undefined;
|
|
192
|
+
} | undefined;
|
|
193
|
+
element?: {
|
|
194
|
+
testid?: string | undefined;
|
|
195
|
+
role?: string | undefined;
|
|
196
|
+
name?: string | undefined;
|
|
197
|
+
} | undefined;
|
|
198
|
+
route?: {
|
|
199
|
+
contains?: string | undefined;
|
|
200
|
+
pathname?: string | undefined;
|
|
201
|
+
} | undefined;
|
|
202
|
+
console?: {
|
|
203
|
+
level?: string | undefined;
|
|
204
|
+
absent?: boolean | undefined;
|
|
205
|
+
} | undefined;
|
|
206
|
+
signalData?: Record<string, unknown> | undefined;
|
|
207
|
+
signalCount?: number | undefined;
|
|
208
|
+
}, {
|
|
209
|
+
signal?: string | undefined;
|
|
210
|
+
text?: {
|
|
211
|
+
contains: string;
|
|
212
|
+
visible?: boolean | undefined;
|
|
213
|
+
scope?: string | undefined;
|
|
214
|
+
absent?: boolean | undefined;
|
|
215
|
+
} | undefined;
|
|
216
|
+
net?: {
|
|
217
|
+
status?: number | undefined;
|
|
218
|
+
method?: string | undefined;
|
|
219
|
+
urlContains?: string | undefined;
|
|
220
|
+
count?: number | undefined;
|
|
221
|
+
} | undefined;
|
|
222
|
+
state?: {
|
|
223
|
+
path: string;
|
|
224
|
+
store?: string | undefined;
|
|
225
|
+
equals?: unknown;
|
|
226
|
+
hold?: boolean | undefined;
|
|
227
|
+
} | undefined;
|
|
228
|
+
element?: {
|
|
229
|
+
testid?: string | undefined;
|
|
230
|
+
role?: string | undefined;
|
|
231
|
+
name?: string | undefined;
|
|
232
|
+
} | undefined;
|
|
233
|
+
route?: {
|
|
234
|
+
contains?: string | undefined;
|
|
235
|
+
pathname?: string | undefined;
|
|
236
|
+
} | undefined;
|
|
237
|
+
console?: {
|
|
238
|
+
level?: string | undefined;
|
|
239
|
+
absent?: boolean | undefined;
|
|
240
|
+
} | undefined;
|
|
241
|
+
signalData?: Record<string, unknown> | undefined;
|
|
242
|
+
signalCount?: number | undefined;
|
|
243
|
+
}>;
|
|
244
|
+
export type FlowExpect = z.infer<typeof FlowExpectSchema>;
|
|
245
|
+
/**
|
|
246
|
+
* Lift a flat `FlowExpect` into the predicate a current file stores directly.
|
|
247
|
+
*
|
|
248
|
+
* THE READER FOR THE OLDER FORMAT. A flow written before `FlowStep.expect` became a `Predicate` holds one slot
|
|
249
|
+
* per kind, and this is what turns that into the tree everything downstream now evaluates. It runs
|
|
250
|
+
* on READ and changes nothing on disk: a v1 file stays a v1 file until something re-saves it.
|
|
251
|
+
*
|
|
252
|
+
* Faithful on purpose, including one wart it does NOT fix: a `route` clause returns immediately and
|
|
253
|
+
* drops every other clause beside it. That is what v1 files have always meant, and a migration that
|
|
254
|
+
* quietly started asserting a clause those files used to ignore would turn greens red for a reason
|
|
255
|
+
* nobody could see in their diff. It is a real lossy path and it is being fixed separately, where it
|
|
256
|
+
* can carry its own test and its own explanation.
|
|
257
|
+
*
|
|
258
|
+
* `undefined` means nothing assertable, which is vacuously met rather than failed.
|
|
259
|
+
*/
|
|
260
|
+
export declare function flowExpectToPredicate(success: FlowExpect): Predicate | undefined;
|