@reticlehq/core 2.11.0 → 2.12.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.
@@ -37,6 +37,20 @@ export declare const STATUS_PATH = "/status";
37
37
  */
38
38
  export declare const DRIVE_PATH = "/drive";
39
39
  export declare const RETICLE_PROTOCOL_VERSION = 1;
40
+ /**
41
+ * The host a CLIENT names when it dials the bridge, as opposed to the address the bridge BINDS.
42
+ *
43
+ * They are deliberately different values and both are correct. The daemon binds `127.0.0.1` so it can
44
+ * never be reached off-host; a client says `localhost`, which is the readable name every doc, log
45
+ * line and error message uses. The gap between them is covered by the IPv6 loopback alias
46
+ * (`loopback-alias.ts`), which serves `[::1]` too, so `localhost` reaches the daemon whichever family
47
+ * a platform resolves first.
48
+ *
49
+ * Named rather than inlined because it was inlined, and three generators then wrote their own: CRA
50
+ * emitted `127.0.0.1`, the Astro helper and the Next plugin each spelled out `localhost`. A default
51
+ * argument is not a single source of truth if it can be bypassed by typing the value.
52
+ */
53
+ export declare const RETICLE_CLIENT_HOST = "localhost";
40
54
  /**
41
55
  * The one place the bridge WebSocket URL is built. The SDK connect default, the vite/next snippet
42
56
  * generators, and the CLI's inject-connect all call this instead of hand-writing `ws://…${path}` —
@@ -210,6 +224,8 @@ export declare const ReticleDir: {
210
224
  * questions about the product; this answers the user's question about their own work.
211
225
  */
212
226
  readonly IMPACT_FILE: "impact.json";
227
+ /** what changes were SUPPOSED to make true —.reticle/intent.json (git-checked, reviewed) */
228
+ readonly INTENT_FILE: "intent.json";
213
229
  /** opt-in pixel baselines —.reticle/visual/<name>.png + <name>.diff.png. */
214
230
  readonly VISUAL_SUBDIR: "visual";
215
231
  /** verification-run artifacts —.reticle/runs/<runId>.json (the OEM/CI-consumable verdict). */
@@ -330,6 +346,12 @@ export declare const EventType: {
330
346
  readonly STORAGE_CHANGE: "storage.change";
331
347
  /** page-level visibility/focus health (distinct from element-level VISIBLE_*). */
332
348
  readonly PAGE_HEALTH: "page.health";
349
+ /**
350
+ * synthetic: the page called window.open, so the consequence of what was just clicked may live in
351
+ * another browsing context this one cannot observe (an OAuth popup is the archetype).
352
+ * `data: { href }` — the URL the page asked to open, when it named one.
353
+ */
354
+ readonly CONTEXT_OPENED: "context.opened";
333
355
  /** aggregated React commits over a throttle window (dev builds) — `data: { commits }`. Commit storms /
334
356
  * wasted re-renders show up here without a per-render flood. */
335
357
  readonly RENDER_COMMIT: "render.commit";
package/dist/constants.js CHANGED
@@ -37,13 +37,27 @@ export const STATUS_PATH = '/status';
37
37
  */
38
38
  export const DRIVE_PATH = '/drive';
39
39
  export const RETICLE_PROTOCOL_VERSION = 1;
40
+ /**
41
+ * The host a CLIENT names when it dials the bridge, as opposed to the address the bridge BINDS.
42
+ *
43
+ * They are deliberately different values and both are correct. The daemon binds `127.0.0.1` so it can
44
+ * never be reached off-host; a client says `localhost`, which is the readable name every doc, log
45
+ * line and error message uses. The gap between them is covered by the IPv6 loopback alias
46
+ * (`loopback-alias.ts`), which serves `[::1]` too, so `localhost` reaches the daemon whichever family
47
+ * a platform resolves first.
48
+ *
49
+ * Named rather than inlined because it was inlined, and three generators then wrote their own: CRA
50
+ * emitted `127.0.0.1`, the Astro helper and the Next plugin each spelled out `localhost`. A default
51
+ * argument is not a single source of truth if it can be bypassed by typing the value.
52
+ */
53
+ export const RETICLE_CLIENT_HOST = 'localhost';
40
54
  /**
41
55
  * The one place the bridge WebSocket URL is built. The SDK connect default, the vite/next snippet
42
56
  * generators, and the CLI's inject-connect all call this instead of hand-writing `ws://…${path}` —
43
57
  * so the wire string can never drift across the four call sites. Host defaults to `localhost` (the
44
58
  * dev app connects from the browser); pass it only for a non-default bind.
45
59
  */
46
- export function bridgeWsUrl(port = RETICLE_DEFAULT_PORT, host = 'localhost') {
60
+ export function bridgeWsUrl(port = RETICLE_DEFAULT_PORT, host = RETICLE_CLIENT_HOST) {
47
61
  return `ws://${host}:${String(port)}${RETICLE_WS_PATH}`;
48
62
  }
49
63
  /**
@@ -212,6 +226,8 @@ export const ReticleDir = {
212
226
  * questions about the product; this answers the user's question about their own work.
213
227
  */
214
228
  IMPACT_FILE: 'impact.json',
229
+ /** what changes were SUPPOSED to make true —.reticle/intent.json (git-checked, reviewed) */
230
+ INTENT_FILE: 'intent.json',
215
231
  /** opt-in pixel baselines —.reticle/visual/<name>.png + <name>.diff.png. */
216
232
  VISUAL_SUBDIR: 'visual',
217
233
  /** verification-run artifacts —.reticle/runs/<runId>.json (the OEM/CI-consumable verdict). */
@@ -338,6 +354,12 @@ export const EventType = {
338
354
  STORAGE_CHANGE: 'storage.change',
339
355
  /** page-level visibility/focus health (distinct from element-level VISIBLE_*). */
340
356
  PAGE_HEALTH: 'page.health',
357
+ /**
358
+ * synthetic: the page called window.open, so the consequence of what was just clicked may live in
359
+ * another browsing context this one cannot observe (an OAuth popup is the archetype).
360
+ * `data: { href }` — the URL the page asked to open, when it named one.
361
+ */
362
+ CONTEXT_OPENED: 'context.opened',
341
363
  /** aggregated React commits over a throttle window (dev builds) — `data: { commits }`. Commit storms /
342
364
  * wasted re-renders show up here without a per-render flood. */
343
365
  RENDER_COMMIT: 'render.commit',
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Which document an observation belongs to.
3
+ *
4
+ * Evidence used to be scoped by time and by ring-buffer capacity and by nothing else. A request
5
+ * observed under a PREVIOUS document — or under a previous run of the application entirely — could
6
+ * therefore be counted against an action taken now. Field reports describe exactly that, including
7
+ * one where the failing request Reticle cited named a database row that no longer exists: true about
8
+ * the bytes, false about the world, which is the worst kind of wrong a verification tool can be.
9
+ *
10
+ * A document id is minted once per real document and dies with it. A full navigation replaces the
11
+ * document and so replaces the id. An SPA route change does NOT, which is correct rather than a
12
+ * limitation: same JavaScript context, same in-flight requests, same evidence.
13
+ *
14
+ * This lives in `core` because it crosses the wire, and every wire value is defined here.
15
+ */
16
+ /**
17
+ * Long enough not to collide within a session, short enough to stamp on every event.
18
+ *
19
+ * The cost is paid thousands of times per session, so this is a deliberate trade rather than a
20
+ * default: eight base-36 characters is a little over forty bits, against a population of at most a
21
+ * handful of documents per session. Collisions are not the risk being managed here; wire weight is.
22
+ */
23
+ export declare const DOCUMENT_ID_LENGTH = 8;
24
+ /**
25
+ * Mint an id for the current document.
26
+ *
27
+ * `random` is injected for the same reason the clock is: a generator that reaches for `Math.random()`
28
+ * cannot be unit-tested and cannot be replayed, and this repo forbids both.
29
+ */
30
+ export declare function newDocumentId(random: () => number): string;
31
+ /**
32
+ * Does this evidence belong to the document currently under observation?
33
+ *
34
+ * **Unstamped evidence counts as current.** An SDK older than this field stamps nothing, and
35
+ * excluding it would make those installations silently stop reporting real contradictions. A
36
+ * verification tool that quietly finds nothing is far worse than one that occasionally over-reports,
37
+ * and this change exists to remove quietly-wrong answers rather than to trade one kind for another.
38
+ */
39
+ export declare function isSameDocument(evidenceDocumentId: string | undefined, currentDocumentId: string | undefined): boolean;
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Which document an observation belongs to.
3
+ *
4
+ * Evidence used to be scoped by time and by ring-buffer capacity and by nothing else. A request
5
+ * observed under a PREVIOUS document — or under a previous run of the application entirely — could
6
+ * therefore be counted against an action taken now. Field reports describe exactly that, including
7
+ * one where the failing request Reticle cited named a database row that no longer exists: true about
8
+ * the bytes, false about the world, which is the worst kind of wrong a verification tool can be.
9
+ *
10
+ * A document id is minted once per real document and dies with it. A full navigation replaces the
11
+ * document and so replaces the id. An SPA route change does NOT, which is correct rather than a
12
+ * limitation: same JavaScript context, same in-flight requests, same evidence.
13
+ *
14
+ * This lives in `core` because it crosses the wire, and every wire value is defined here.
15
+ */
16
+ /**
17
+ * Long enough not to collide within a session, short enough to stamp on every event.
18
+ *
19
+ * The cost is paid thousands of times per session, so this is a deliberate trade rather than a
20
+ * default: eight base-36 characters is a little over forty bits, against a population of at most a
21
+ * handful of documents per session. Collisions are not the risk being managed here; wire weight is.
22
+ */
23
+ export const DOCUMENT_ID_LENGTH = 8;
24
+ const ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz';
25
+ /**
26
+ * Mint an id for the current document.
27
+ *
28
+ * `random` is injected for the same reason the clock is: a generator that reaches for `Math.random()`
29
+ * cannot be unit-tested and cannot be replayed, and this repo forbids both.
30
+ */
31
+ export function newDocumentId(random) {
32
+ let out = '';
33
+ for (let i = 0; i < DOCUMENT_ID_LENGTH; i++) {
34
+ const pick = Math.floor(random() * ALPHABET.length);
35
+ // A generator returning exactly 1 (or a rounding artefact at the top of the range) would index
36
+ // past the end and produce `undefined` in the string. Clamp rather than trust the caller.
37
+ out += ALPHABET[Math.min(Math.max(pick, 0), ALPHABET.length - 1)];
38
+ }
39
+ return out;
40
+ }
41
+ /**
42
+ * Does this evidence belong to the document currently under observation?
43
+ *
44
+ * **Unstamped evidence counts as current.** An SDK older than this field stamps nothing, and
45
+ * excluding it would make those installations silently stop reporting real contradictions. A
46
+ * verification tool that quietly finds nothing is far worse than one that occasionally over-reports,
47
+ * and this change exists to remove quietly-wrong answers rather than to trade one kind for another.
48
+ */
49
+ export function isSameDocument(evidenceDocumentId, currentDocumentId) {
50
+ if (undefined === evidenceDocumentId || undefined === currentDocumentId)
51
+ return true;
52
+ return evidenceDocumentId === currentDocumentId;
53
+ }
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Which round of source edits an observation belongs to.
3
+ *
4
+ * `document-identity` scopes evidence to the DOCUMENT it was recorded under, because a navigation
5
+ * throws the page away and takes the truth of everything observed under it with it. This is the same
6
+ * problem for EDITS, and the document id cannot see it: a hot update swaps modules and re-renders
7
+ * inside the same document, so the id never moves. The agent that Reticle is increasingly driven by
8
+ * edits source and re-verifies in a loop — so it routinely reads observations describing code it has
9
+ * already replaced, and refs minted against nodes the framework has already thrown away.
10
+ *
11
+ * An epoch is a counter that advances once per applied hot update. It is NOT a clock and NOT an
12
+ * identity: only the ordering matters, and only within one document (a navigation mints a new
13
+ * document, and a new SDK instance starts the count again — which is correct, because the document
14
+ * scoping already excludes everything from before it).
15
+ *
16
+ * This lives in `core` because it crosses the wire, and every wire value is defined here.
17
+ */
18
+ /**
19
+ * The epoch of a page in which no hot update has been observed.
20
+ *
21
+ * ABSENCE OF EVIDENCE, NOT EVIDENCE OF ABSENCE. Most pages Reticle instruments have no channel that
22
+ * can report a hot update at all — Next, Electron, Tauri, a plain script tag — and a Vite page has
23
+ * none until the first update arrives. So this value means "no edits observed", never "no edits
24
+ * happened", and nothing may be excluded or accused on the strength of it.
25
+ */
26
+ export declare const NO_EDITS_OBSERVED = 0;
27
+ /**
28
+ * Was this evidence recorded under the edit epoch currently in force?
29
+ *
30
+ * **Unstamped evidence counts as current**, following `isSameDocument` exactly rather than inventing
31
+ * a stricter rule beside it. An SDK older than this field stamps nothing, and so does a perfectly
32
+ * current SDK in a page with no hot-update channel. Reading either as foreign would make those
33
+ * installations silently stop reporting real contradictions, and a verification tool that quietly
34
+ * finds nothing is worse than one that occasionally over-reports.
35
+ */
36
+ export declare function isSameEditEpoch(evidenceEpoch: number | undefined, currentEpoch: number | undefined): boolean;
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Which round of source edits an observation belongs to.
3
+ *
4
+ * `document-identity` scopes evidence to the DOCUMENT it was recorded under, because a navigation
5
+ * throws the page away and takes the truth of everything observed under it with it. This is the same
6
+ * problem for EDITS, and the document id cannot see it: a hot update swaps modules and re-renders
7
+ * inside the same document, so the id never moves. The agent that Reticle is increasingly driven by
8
+ * edits source and re-verifies in a loop — so it routinely reads observations describing code it has
9
+ * already replaced, and refs minted against nodes the framework has already thrown away.
10
+ *
11
+ * An epoch is a counter that advances once per applied hot update. It is NOT a clock and NOT an
12
+ * identity: only the ordering matters, and only within one document (a navigation mints a new
13
+ * document, and a new SDK instance starts the count again — which is correct, because the document
14
+ * scoping already excludes everything from before it).
15
+ *
16
+ * This lives in `core` because it crosses the wire, and every wire value is defined here.
17
+ */
18
+ /**
19
+ * The epoch of a page in which no hot update has been observed.
20
+ *
21
+ * ABSENCE OF EVIDENCE, NOT EVIDENCE OF ABSENCE. Most pages Reticle instruments have no channel that
22
+ * can report a hot update at all — Next, Electron, Tauri, a plain script tag — and a Vite page has
23
+ * none until the first update arrives. So this value means "no edits observed", never "no edits
24
+ * happened", and nothing may be excluded or accused on the strength of it.
25
+ */
26
+ export const NO_EDITS_OBSERVED = 0;
27
+ /**
28
+ * Was this evidence recorded under the edit epoch currently in force?
29
+ *
30
+ * **Unstamped evidence counts as current**, following `isSameDocument` exactly rather than inventing
31
+ * a stricter rule beside it. An SDK older than this field stamps nothing, and so does a perfectly
32
+ * current SDK in a page with no hot-update channel. Reading either as foreign would make those
33
+ * installations silently stop reporting real contradictions, and a verification tool that quietly
34
+ * finds nothing is worse than one that occasionally over-reports.
35
+ */
36
+ export function isSameEditEpoch(evidenceEpoch, currentEpoch) {
37
+ if (undefined === evidenceEpoch || undefined === currentEpoch)
38
+ return true;
39
+ return evidenceEpoch === currentEpoch;
40
+ }
@@ -46,10 +46,17 @@ export declare const ScrollDirection: {
46
46
  readonly DOWN: "down";
47
47
  };
48
48
  export type ScrollDirection = (typeof ScrollDirection)[keyof typeof ScrollDirection];
49
+ /**
50
+ * The three readable client-side storage areas.
51
+ *
52
+ * `cookies` is plural because that is what the storage tool accepts, what the browser returns and
53
+ * what the docs publish. This member read `cookie` for as long as it had no callers, which is
54
+ * exactly how long a name can disagree with every use of it for free.
55
+ */
49
56
  export declare const StorageArea: {
50
57
  readonly LOCAL: "local";
51
58
  readonly SESSION: "session";
52
- readonly COOKIE: "cookie";
59
+ readonly COOKIE: "cookies";
53
60
  };
54
61
  export type StorageArea = (typeof StorageArea)[keyof typeof StorageArea];
55
62
  /**
@@ -367,18 +374,18 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
367
374
  area: z.ZodNativeEnum<{
368
375
  readonly LOCAL: "local";
369
376
  readonly SESSION: "session";
370
- readonly COOKIE: "cookie";
377
+ readonly COOKIE: "cookies";
371
378
  }>;
372
379
  key: z.ZodString;
373
380
  old: z.ZodOptional<z.ZodString>;
374
381
  new: z.ZodOptional<z.ZodString>;
375
382
  }, "strip", z.ZodTypeAny, {
376
- area: "local" | "session" | "cookie";
383
+ area: "local" | "session" | "cookies";
377
384
  key: string;
378
385
  old?: string | undefined;
379
386
  new?: string | undefined;
380
387
  }, {
381
- area: "local" | "session" | "cookie";
388
+ area: "local" | "session" | "cookies";
382
389
  key: string;
383
390
  old?: string | undefined;
384
391
  new?: string | undefined;
@@ -444,6 +451,13 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
444
451
  readonly OTHER: "other";
445
452
  }>>;
446
453
  }, z.ZodTypeAny, "passthrough">>;
454
+ "context.opened": z.ZodObject<{
455
+ href: z.ZodOptional<z.ZodString>;
456
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
457
+ href: z.ZodOptional<z.ZodString>;
458
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
459
+ href: z.ZodOptional<z.ZodString>;
460
+ }, z.ZodTypeAny, "passthrough">>;
447
461
  "render.commit": z.ZodObject<{
448
462
  commits: z.ZodNumber;
449
463
  }, "strip", z.ZodTypeAny, {
@@ -34,7 +34,14 @@ export const StreamTransport = { SSE: 'sse', WS: 'ws', FETCH: 'fetch' };
34
34
  /** `CLOSE` pairs with `OPEN`: until it arrives, the body is still being written. */
35
35
  export const StreamDirection = { OPEN: 'open', IN: 'in', OUT: 'out', CLOSE: 'close' };
36
36
  export const ScrollDirection = { UP: 'up', DOWN: 'down' };
37
- export const StorageArea = { LOCAL: 'local', SESSION: 'session', COOKIE: 'cookie' };
37
+ /**
38
+ * The three readable client-side storage areas.
39
+ *
40
+ * `cookies` is plural because that is what the storage tool accepts, what the browser returns and
41
+ * what the docs publish. This member read `cookie` for as long as it had no callers, which is
42
+ * exactly how long a name can disagree with every use of it for free.
43
+ */
44
+ export const StorageArea = { LOCAL: 'local', SESSION: 'session', COOKIE: 'cookies' };
38
45
  const elementLabel = z.object({ role: z.string().optional(), name: z.string().optional() });
39
46
  /**
40
47
  * A file the app produced. `preview`/`lines` are present only when body capture is on, for the same
@@ -145,6 +152,9 @@ export const EVENT_PAYLOAD_SCHEMAS = {
145
152
  brand: z.nativeEnum(BrowserBrand).optional(),
146
153
  })
147
154
  .passthrough(),
155
+ // The page called window.open — the clicked consequence may continue in a context the SDK cannot
156
+ // enter (#508). `href` is what the page asked to open, omitted for the blank-tab form.
157
+ [EventType.CONTEXT_OPENED]: z.object({ href: z.string().optional() }).passthrough(),
148
158
  [EventType.RENDER_COMMIT]: z.object({ commits: z.number() }),
149
159
  [EventType.FOCUS_CHANGE]: z.object({
150
160
  to: z.string().optional(),
@@ -21,6 +21,29 @@ export declare const ContradictionKind: {
21
21
  readonly SIGNAL_CONTRADICTED: "signal-contradicted";
22
22
  /** A write succeeded on the server and nothing on the client moved — the response went nowhere. */
23
23
  readonly RESPONSE_IGNORED: "response-ignored";
24
+ /**
25
+ * The app fired a success signal and NOTHING else in the window moved — no DOM, no store, no
26
+ * route, no request. The only evidence that anything happened is the app's own claim.
27
+ *
28
+ * `DEAD_CONTROL` describes almost exactly this and deliberately excludes it: its definition is
29
+ * "dispatched but the app did NOTHING (no DOM/net/route/signal)", so firing a signal was enough to
30
+ * rescue a control that did nothing at all. That is the hole. An app whose signal is emitted from
31
+ * the value it was ASKED for rather than the one it COMMITTED gets a verdict at signal grade —
32
+ * the strongest we award — for a click that changed nothing. Measured on the bench fixture: a
33
+ * modal that never opened came back `verified: "yes" / proved`.
34
+ *
35
+ * Absence-derived on purpose (see below). "Nothing corroborated it" is not "it did not happen":
36
+ * a signal about genuinely non-visual state is legitimate. This downgrades the verdict to UNKNOWN
37
+ * so the false green cannot stand, without asserting a fault nobody proved.
38
+ */
39
+ readonly SIGNAL_WITHOUT_CONSEQUENCE: "signal-without-consequence";
40
+ /**
41
+ * A write succeeded on the server and nothing moved in THIS document — because the page opened
42
+ * another browsing context (an OAuth popup is the archetype) and the consequence lives there,
43
+ * where an in-page SDK cannot follow. Reported instead of response-ignored, which would read as
44
+ * "the client ignored the response" about a client that did no such thing.
45
+ */
46
+ readonly CONSEQUENCE_ELSEWHERE: "consequence-elsewhere";
24
47
  /** The same write fired more than once in one action — double-submit / retry storm. */
25
48
  readonly DUPLICATE_REQUEST: "duplicate-request";
26
49
  /**
@@ -108,6 +131,45 @@ export declare const ContradictionKind: {
108
131
  * working does not), so it is reported with that ceiling stated rather than tuned into silence.
109
132
  */
110
133
  readonly ROUTE_RENDERED_NOTHING: "route-rendered-nothing";
134
+ /**
135
+ * Everything this window held belongs to a document that has SINCE been replaced.
136
+ *
137
+ * Not a disagreement between channels; a disagreement between the evidence and the clock. A window
138
+ * is scoped by time and by ring-buffer capacity, so it can still hold the network calls, console
139
+ * errors and signals of a page that a full navigation or a reload has already thrown away. Citing
140
+ * one of those as the cause of an action taken now is true about the bytes and false about the
141
+ * world — reported from the field with a failing request that named a database row which no longer
142
+ * exists.
143
+ *
144
+ * Dropping that evidence is only half the fix. The other half is that its absence must not read as
145
+ * "nothing happened", which would trade a wrong citation for a wrong all-clear, and an all-clear is
146
+ * the more expensive of the two. This kind is what the engine says instead, and the distinction is
147
+ * the whole user-visible point: an agent told its evidence was superseded knows to re-drive, and an
148
+ * agent told the window was empty does not.
149
+ */
150
+ readonly EVIDENCE_SUPERSEDED: "evidence-superseded";
151
+ /**
152
+ * Everything this window held was observed BEFORE the last source edit landed in the page.
153
+ *
154
+ * The sibling of `EVIDENCE_SUPERSEDED`, for the loop an agent actually runs: verify, edit source,
155
+ * verify again. A hot update replaces modules and re-renders inside the SAME document, so the
156
+ * document id — the only thing that could previously say "this evidence is about a page that is
157
+ * gone" — never moves, and observations of code the agent has already rewritten go on answering
158
+ * for it in silence.
159
+ *
160
+ * Reported rather than EXCLUDED, and the difference from the document case is deliberate. A
161
+ * navigation is total: it throws away the page, the refs, the in-flight requests and the state, so
162
+ * nothing recorded under it is still about the world. An edit is not. Most modules, most of the
163
+ * DOM, the whole network log and every console line survive a hot update, so most of what was
164
+ * observed a second before it is still true a second after. Dropping that window would empty
165
+ * verdicts that hold real findings, and an emptied window reads as "nothing happened" — the more
166
+ * expensive of the two wrong answers, and the one this family of checks exists to prevent.
167
+ *
168
+ * So the evidence stays and the caveat is said out loud: absence-derived, because nothing here
169
+ * claims the app is wrong. It downgrades a verdict to unknown, which is the honest reading of
170
+ * "you changed the code and then looked only at what happened before you did".
171
+ */
172
+ readonly EVIDENCE_PREDATES_EDIT: "evidence-predates-edit";
111
173
  };
112
174
  export type ContradictionKind = (typeof ContradictionKind)[keyof typeof ContradictionKind];
113
175
  /**
package/dist/findings.js CHANGED
@@ -21,6 +21,29 @@ export const ContradictionKind = {
21
21
  SIGNAL_CONTRADICTED: 'signal-contradicted',
22
22
  /** A write succeeded on the server and nothing on the client moved — the response went nowhere. */
23
23
  RESPONSE_IGNORED: 'response-ignored',
24
+ /**
25
+ * The app fired a success signal and NOTHING else in the window moved — no DOM, no store, no
26
+ * route, no request. The only evidence that anything happened is the app's own claim.
27
+ *
28
+ * `DEAD_CONTROL` describes almost exactly this and deliberately excludes it: its definition is
29
+ * "dispatched but the app did NOTHING (no DOM/net/route/signal)", so firing a signal was enough to
30
+ * rescue a control that did nothing at all. That is the hole. An app whose signal is emitted from
31
+ * the value it was ASKED for rather than the one it COMMITTED gets a verdict at signal grade —
32
+ * the strongest we award — for a click that changed nothing. Measured on the bench fixture: a
33
+ * modal that never opened came back `verified: "yes" / proved`.
34
+ *
35
+ * Absence-derived on purpose (see below). "Nothing corroborated it" is not "it did not happen":
36
+ * a signal about genuinely non-visual state is legitimate. This downgrades the verdict to UNKNOWN
37
+ * so the false green cannot stand, without asserting a fault nobody proved.
38
+ */
39
+ SIGNAL_WITHOUT_CONSEQUENCE: 'signal-without-consequence',
40
+ /**
41
+ * A write succeeded on the server and nothing moved in THIS document — because the page opened
42
+ * another browsing context (an OAuth popup is the archetype) and the consequence lives there,
43
+ * where an in-page SDK cannot follow. Reported instead of response-ignored, which would read as
44
+ * "the client ignored the response" about a client that did no such thing.
45
+ */
46
+ CONSEQUENCE_ELSEWHERE: 'consequence-elsewhere',
24
47
  /** The same write fired more than once in one action — double-submit / retry storm. */
25
48
  DUPLICATE_REQUEST: 'duplicate-request',
26
49
  /**
@@ -108,6 +131,45 @@ export const ContradictionKind = {
108
131
  * working does not), so it is reported with that ceiling stated rather than tuned into silence.
109
132
  */
110
133
  ROUTE_RENDERED_NOTHING: 'route-rendered-nothing',
134
+ /**
135
+ * Everything this window held belongs to a document that has SINCE been replaced.
136
+ *
137
+ * Not a disagreement between channels; a disagreement between the evidence and the clock. A window
138
+ * is scoped by time and by ring-buffer capacity, so it can still hold the network calls, console
139
+ * errors and signals of a page that a full navigation or a reload has already thrown away. Citing
140
+ * one of those as the cause of an action taken now is true about the bytes and false about the
141
+ * world — reported from the field with a failing request that named a database row which no longer
142
+ * exists.
143
+ *
144
+ * Dropping that evidence is only half the fix. The other half is that its absence must not read as
145
+ * "nothing happened", which would trade a wrong citation for a wrong all-clear, and an all-clear is
146
+ * the more expensive of the two. This kind is what the engine says instead, and the distinction is
147
+ * the whole user-visible point: an agent told its evidence was superseded knows to re-drive, and an
148
+ * agent told the window was empty does not.
149
+ */
150
+ EVIDENCE_SUPERSEDED: 'evidence-superseded',
151
+ /**
152
+ * Everything this window held was observed BEFORE the last source edit landed in the page.
153
+ *
154
+ * The sibling of `EVIDENCE_SUPERSEDED`, for the loop an agent actually runs: verify, edit source,
155
+ * verify again. A hot update replaces modules and re-renders inside the SAME document, so the
156
+ * document id — the only thing that could previously say "this evidence is about a page that is
157
+ * gone" — never moves, and observations of code the agent has already rewritten go on answering
158
+ * for it in silence.
159
+ *
160
+ * Reported rather than EXCLUDED, and the difference from the document case is deliberate. A
161
+ * navigation is total: it throws away the page, the refs, the in-flight requests and the state, so
162
+ * nothing recorded under it is still about the world. An edit is not. Most modules, most of the
163
+ * DOM, the whole network log and every console line survive a hot update, so most of what was
164
+ * observed a second before it is still true a second after. Dropping that window would empty
165
+ * verdicts that hold real findings, and an emptied window reads as "nothing happened" — the more
166
+ * expensive of the two wrong answers, and the one this family of checks exists to prevent.
167
+ *
168
+ * So the evidence stays and the caveat is said out loud: absence-derived, because nothing here
169
+ * claims the app is wrong. It downgrades a verdict to unknown, which is the honest reading of
170
+ * "you changed the code and then looked only at what happened before you did".
171
+ */
172
+ EVIDENCE_PREDATES_EDIT: 'evidence-predates-edit',
111
173
  };
112
174
  /**
113
175
  * Contradictions inferred from the ABSENCE of evidence in a window whose end Reticle itself chose.
@@ -140,9 +202,22 @@ export const ContradictionKind = {
140
202
  export const ABSENCE_DERIVED_CONTRADICTIONS = new Set([
141
203
  ContradictionKind.REQUEST_NEVER_SETTLED,
142
204
  ContradictionKind.RESPONSE_IGNORED,
205
+ // The app said something happened and nothing corroborated it. That is an absence of agreement,
206
+ // never proof the app is wrong — a signal about non-visual state has nothing to corroborate it by
207
+ // construction. UNKNOWN removes the false green; NO would invent a fault.
208
+ ContradictionKind.SIGNAL_WITHOUT_CONSEQUENCE,
209
+ // The consequence is not missing, it is somewhere this document's SDK cannot look — a claim about
210
+ // the reach of the observation, never a positive fault in the app.
211
+ ContradictionKind.CONSEQUENCE_ELSEWHERE,
143
212
  ContradictionKind.ROUTE_RENDERED_NOTHING,
144
213
  ContradictionKind.ACTION_HAD_NO_EFFECT,
145
214
  ContradictionKind.DUPLICATE_REQUEST,
215
+ // Absence in the strictest sense: the evidence that would have answered the question was thrown
216
+ // away with the document it belonged to. Nothing here says the app is wrong, so it must downgrade
217
+ // the verdict to UNKNOWN rather than assert NO — the same reasoning `unclean_capture` follows.
218
+ ContradictionKind.EVIDENCE_SUPERSEDED,
219
+ // Nothing here says the app is wrong either — only that the window predates the edit under test.
220
+ ContradictionKind.EVIDENCE_PREDATES_EDIT,
146
221
  ]);
147
222
  /** True when this kind was inferred from absence rather than positively observed. */
148
223
  export function isAbsenceDerived(kind) {