@reticlehq/core 2.13.1 → 3.1.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.
Files changed (147) hide show
  1. package/dist/artifacts/artifacts-entry.d.ts +20 -0
  2. package/dist/artifacts/artifacts-entry.js +20 -0
  3. package/dist/artifacts/flow-composition.d.ts +30 -0
  4. package/dist/artifacts/flow-composition.js +19 -0
  5. package/dist/{flow-constants.d.ts → artifacts/flow-constants.d.ts} +97 -3
  6. package/dist/{flow-constants.js → artifacts/flow-constants.js} +103 -4
  7. package/dist/artifacts/flow-mutation-target.d.ts +39 -0
  8. package/dist/artifacts/flow-mutation-target.js +89 -0
  9. package/dist/artifacts/flow-order.d.ts +30 -0
  10. package/dist/artifacts/flow-order.js +49 -0
  11. package/dist/artifacts/flow-select.d.ts +56 -0
  12. package/dist/artifacts/flow-select.js +56 -0
  13. package/dist/artifacts/flow-step-tool.d.ts +31 -0
  14. package/dist/artifacts/flow-step-tool.js +31 -0
  15. package/dist/artifacts/flow-types.d.ts +3736 -0
  16. package/dist/artifacts/flow-types.js +463 -0
  17. package/dist/artifacts/flow-unreached.d.ts +12 -0
  18. package/dist/artifacts/flow-unreached.js +24 -0
  19. package/dist/{impact-savings.d.ts → artifacts/impact-savings.d.ts} +7 -3
  20. package/dist/{impact-savings.js → artifacts/impact-savings.js} +27 -4
  21. package/dist/{impact.d.ts → artifacts/impact.d.ts} +122 -54
  22. package/dist/{impact.js → artifacts/impact.js} +30 -0
  23. package/dist/{journal.d.ts → artifacts/journal.d.ts} +50 -6
  24. package/dist/{journal.js → artifacts/journal.js} +38 -2
  25. package/dist/artifacts/step-effect.d.ts +29 -0
  26. package/dist/artifacts/step-effect.js +28 -0
  27. package/dist/hooks/hook-events.d.ts +311 -0
  28. package/dist/hooks/hook-events.js +127 -0
  29. package/dist/hooks/hooks-entry.d.ts +9 -0
  30. package/dist/hooks/hooks-entry.js +9 -0
  31. package/dist/{brand.d.ts → identity/brand.d.ts} +7 -0
  32. package/dist/{contract-fingerprint.d.ts → identity/contract-fingerprint.d.ts} +21 -3
  33. package/dist/{contract-fingerprint.js → identity/contract-fingerprint.js} +22 -4
  34. package/dist/{document-identity.d.ts → identity/document-identity.d.ts} +4 -5
  35. package/dist/{document-identity.js → identity/document-identity.js} +4 -5
  36. package/dist/{source-constants.d.ts → identity/source-constants.d.ts} +4 -4
  37. package/dist/{source-constants.js → identity/source-constants.js} +4 -4
  38. package/dist/index.d.ts +69 -42
  39. package/dist/index.js +78 -44
  40. package/dist/onboarding.d.ts +114 -0
  41. package/dist/onboarding.js +141 -0
  42. package/dist/realm/registry.d.ts +212 -0
  43. package/dist/realm/registry.js +302 -0
  44. package/dist/{dev-server-registry.d.ts → registry/dev-server-registry.d.ts} +4 -5
  45. package/dist/{dev-server-registry.js → registry/dev-server-registry.js} +28 -19
  46. package/dist/{project-registry.d.ts → registry/project-registry.d.ts} +5 -5
  47. package/dist/{project-registry.js → registry/project-registry.js} +5 -5
  48. package/dist/schema/command-name.json +31 -0
  49. package/dist/schema/event-message.json +1 -0
  50. package/dist/schema/event-payloads.json +791 -0
  51. package/dist/schema/event-type.json +1 -0
  52. package/dist/schema/hello-message.json +76 -2
  53. package/dist/schema/reticle-event.json +1 -0
  54. package/dist/schema/reticle-message.json +77 -2
  55. package/dist/telemetry-entry.d.ts +15 -0
  56. package/dist/telemetry-entry.js +15 -0
  57. package/dist/telemetry-feedback.d.ts +13 -14
  58. package/dist/telemetry-feedback.js +11 -12
  59. package/dist/telemetry-license.d.ts +1 -1
  60. package/dist/telemetry-license.js +1 -1
  61. package/dist/telemetry-refusal.d.ts +11 -11
  62. package/dist/telemetry-refusal.js +7 -8
  63. package/dist/telemetry-session.d.ts +49 -57
  64. package/dist/telemetry-session.js +47 -55
  65. package/dist/telemetry.d.ts +229 -198
  66. package/dist/telemetry.js +83 -98
  67. package/dist/tour-entry.d.ts +10 -0
  68. package/dist/tour-entry.js +10 -0
  69. package/dist/tour.d.ts +125 -0
  70. package/dist/tour.js +165 -0
  71. package/dist/{consequence.d.ts → verdict/consequence.d.ts} +35 -11
  72. package/dist/{consequence.js → verdict/consequence.js} +9 -22
  73. package/dist/{finding-fingerprint.js → verdict/finding-fingerprint.js} +1 -1
  74. package/dist/{findings.d.ts → verdict/findings.d.ts} +149 -41
  75. package/dist/{findings.js → verdict/findings.js} +169 -48
  76. package/dist/{instrumentation-gap.d.ts → verdict/instrumentation-gap.d.ts} +22 -14
  77. package/dist/{instrumentation-gap.js → verdict/instrumentation-gap.js} +23 -15
  78. package/dist/{intent.d.ts → verdict/intent.d.ts} +41 -52
  79. package/dist/{intent.js → verdict/intent.js} +11 -22
  80. package/dist/verdict/revision.d.ts +44 -0
  81. package/dist/verdict/revision.js +53 -0
  82. package/dist/{run-context.d.ts → verdict/run-context.d.ts} +13 -34
  83. package/dist/{run-context.js → verdict/run-context.js} +15 -36
  84. package/dist/{security.js → verdict/security.js} +12 -21
  85. package/dist/{verification-run.d.ts → verdict/verification-run.d.ts} +369 -93
  86. package/dist/{verification-run.js → verdict/verification-run.js} +157 -21
  87. package/dist/{verified-constants.d.ts → verdict/verified-constants.d.ts} +36 -13
  88. package/dist/{verified-constants.js → verdict/verified-constants.js} +36 -13
  89. package/dist/verdict/verify-progress.d.ts +129 -0
  90. package/dist/verdict/verify-progress.js +74 -0
  91. package/dist/wire/channel.d.ts +46 -0
  92. package/dist/wire/channel.js +95 -0
  93. package/dist/{constants.d.ts → wire/constants/constants.d.ts} +124 -28
  94. package/dist/{constants.js → wire/constants/constants.js} +137 -28
  95. package/dist/{session-constants.d.ts → wire/constants/session-constants.d.ts} +9 -2
  96. package/dist/{session-constants.js → wire/constants/session-constants.js} +9 -2
  97. package/dist/{desktop-contract.js → wire/desktop-contract.js} +1 -1
  98. package/dist/{event-classification.js → wire/event-classification.js} +1 -1
  99. package/dist/{event-payloads.d.ts → wire/event-payloads.d.ts} +229 -17
  100. package/dist/{event-payloads.js → wire/event-payloads.js} +61 -3
  101. package/dist/{event-priority.d.ts → wire/event-priority.d.ts} +1 -4
  102. package/dist/{event-priority.js → wire/event-priority.js} +2 -5
  103. package/dist/wire/global-press.d.ts +30 -0
  104. package/dist/wire/global-press.js +54 -0
  105. package/dist/{messages.d.ts → wire/messages.d.ts} +290 -38
  106. package/dist/{messages.js → wire/messages.js} +93 -5
  107. package/dist/wire/narrow.d.ts +39 -0
  108. package/dist/wire/narrow.js +45 -0
  109. package/dist/{net.d.ts → wire/net.d.ts} +49 -10
  110. package/dist/{net.js → wire/net.js} +49 -10
  111. package/dist/wire/platform.d.ts +37 -0
  112. package/dist/wire/platform.js +36 -0
  113. package/dist/{redaction.d.ts → wire/redaction.d.ts} +30 -0
  114. package/dist/wire/redaction.js +274 -0
  115. package/dist/wire/tool-names.d.ts +133 -0
  116. package/dist/wire/tool-names.js +142 -0
  117. package/dist/{toon.js → wire/toon.js} +1 -1
  118. package/dist/{types.d.ts → wire/types.d.ts} +106 -66
  119. package/dist/{types.js → wire/types.js} +24 -4
  120. package/dist/{no-session-reason.d.ts → words/no-session-reason.d.ts} +7 -3
  121. package/dist/{no-session-reason.js → words/no-session-reason.js} +7 -3
  122. package/dist/{notices.d.ts → words/notices.d.ts} +24 -12
  123. package/dist/{notices.js → words/notices.js} +27 -12
  124. package/package.json +22 -5
  125. package/dist/flow-types.d.ts +0 -1473
  126. package/dist/flow-types.js +0 -195
  127. package/dist/redaction.js +0 -149
  128. /package/dist/{brand.js → identity/brand.js} +0 -0
  129. /package/dist/{edit-epoch.d.ts → identity/edit-epoch.d.ts} +0 -0
  130. /package/dist/{edit-epoch.js → identity/edit-epoch.js} +0 -0
  131. /package/dist/{project-id.d.ts → identity/project-id.d.ts} +0 -0
  132. /package/dist/{project-id.js → identity/project-id.js} +0 -0
  133. /package/dist/{daemon-registry.d.ts → registry/daemon-registry.d.ts} +0 -0
  134. /package/dist/{daemon-registry.js → registry/daemon-registry.js} +0 -0
  135. /package/dist/{finding-fingerprint.d.ts → verdict/finding-fingerprint.d.ts} +0 -0
  136. /package/dist/{security.d.ts → verdict/security.d.ts} +0 -0
  137. /package/dist/{desktop-contract.d.ts → wire/desktop-contract.d.ts} +0 -0
  138. /package/dist/{event-classification.d.ts → wire/event-classification.d.ts} +0 -0
  139. /package/dist/{state-select.d.ts → wire/state-select.d.ts} +0 -0
  140. /package/dist/{state-select.js → wire/state-select.js} +0 -0
  141. /package/dist/{toon.d.ts → wire/toon.d.ts} +0 -0
  142. /package/dist/{browser-misdirect.d.ts → words/browser-misdirect.d.ts} +0 -0
  143. /package/dist/{browser-misdirect.js → words/browser-misdirect.js} +0 -0
  144. /package/dist/{unreachable-notice.d.ts → words/unreachable-notice.d.ts} +0 -0
  145. /package/dist/{unreachable-notice.js → words/unreachable-notice.js} +0 -0
  146. /package/dist/{upgrade.d.ts → words/upgrade.d.ts} +0 -0
  147. /package/dist/{upgrade.js → words/upgrade.js} +0 -0
@@ -1,18 +1,8 @@
1
1
  /**
2
2
  * What a verification can FIND — the vocabulary of faults and contradictions shared by the crawl,
3
- * the contradiction hunter and the tools that report them. Split out of constants.ts to keep that
4
- * file under the size cap.
5
- */
6
- /**
7
- * Cross-channel contradictions: two observation channels making INCOMPATIBLE claims about the same
8
- * action. This is the bug class a human structurally cannot see, because a human has one channel
9
- * open — the screen. The agent holds DOM, store, signals, console and network in one causally
10
- * ordered window and can notice they disagree.
11
- *
12
- * Every kind here describes a shipped-today false green: the run is green, the screen looks right,
13
- * and the app is wrong. Contrast `CrawlAnomalyKind`, whose members are all SINGLE-channel facts (an
14
- * error was logged; a request failed) — those are findable by reading one stream.
3
+ * the contradiction hunter and the tools that report them.
15
4
  */
5
+ import { ChannelId, disagreementCanConvict } from '../wire/channel.js';
16
6
  export const ContradictionKind = {
17
7
  /** The screen moved forward while a request in the same window failed — the swallowed rejection. */
18
8
  UI_ADVANCED_REQUEST_FAILED: 'ui-advanced-request-failed',
@@ -29,7 +19,7 @@ export const ContradictionKind = {
29
19
  * "dispatched but the app did NOTHING (no DOM/net/route/signal)", so firing a signal was enough to
30
20
  * rescue a control that did nothing at all. That is the hole. An app whose signal is emitted from
31
21
  * 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
22
+ * the strongest grade there is — for a click that changed nothing. On the bench fixture: a
33
23
  * modal that never opened came back `verified: "yes" / proved`.
34
24
  *
35
25
  * Absence-derived on purpose (see below). "Nothing corroborated it" is not "it did not happen":
@@ -37,6 +27,20 @@ export const ContradictionKind = {
37
27
  * so the false green cannot stand, without asserting a fault nobody proved.
38
28
  */
39
29
  SIGNAL_WITHOUT_CONSEQUENCE: 'signal-without-consequence',
30
+ /**
31
+ * The store committed and the screen never moved.
32
+ *
33
+ * `response-ignored` covers *a write succeeded and nothing moved*; `action-had-no-effect` covers
34
+ * *the click did nothing at all*. Neither covers the commonest render defect there is: state
35
+ * commits and the component that should have re-rendered does not — a memo with a stale
36
+ * comparator, a key that never changes, a selector reading the wrong slice. The app is internally
37
+ * consistent and the user is looking at the old value.
38
+ *
39
+ * Absence-derived, for the same reason as the entry above: a store holds plenty that was never
40
+ * meant to paint — an analytics flag, a timer, a cached token — so "nothing rendered" is not proof
41
+ * of a fault. It removes the false green and never invents a NO.
42
+ */
43
+ STATE_VS_RENDER: 'state-vs-render',
40
44
  /**
41
45
  * A write succeeded on the server and nothing moved in THIS document — because the page opened
42
46
  * another browsing context (an OAuth popup is the archetype) and the consequence lives there,
@@ -46,6 +50,18 @@ export const ContradictionKind = {
46
50
  CONSEQUENCE_ELSEWHERE: 'consequence-elsewhere',
47
51
  /** The same write fired more than once in one action — double-submit / retry storm. */
48
52
  DUPLICATE_REQUEST: 'duplicate-request',
53
+ /**
54
+ * The same write fired repeatedly on an endpoint the assertion never named.
55
+ *
56
+ * A poll that bursts, a batched analytics beacon, a retry loop the caller was not asking about.
57
+ * The finding is real and worth reporting; what it is NOT is evidence about the consequence the
58
+ * caller declared. An app that polls could not produce a verdict at all -- every assertion that
59
+ * had already seen its consequence came back `unknown` behind writes it never mentioned (#673).
60
+ *
61
+ * ADVISORY, so it rides out in `contradictions` and decides nothing. `DUPLICATE_REQUEST` proper
62
+ * -- a burst on an endpoint the assertion DID name -- keeps its downgrade.
63
+ */
64
+ DUPLICATE_REQUEST_UNRELATED: 'duplicate-request-unrelated',
49
65
  /**
50
66
  * Two reads of the same endpoint were in flight together and settled OUT OF ORDER, so the one the
51
67
  * user asked for first is the one that landed last — and the screen is showing it.
@@ -84,7 +100,7 @@ export const ContradictionKind = {
84
100
  * PATCH honouring a subset, an enum falling back to a default. The status is 2xx, the body reports
85
101
  * no failure, the UI advanced, the page settled — so every channel except the payload agrees the
86
102
  * save worked, and the screen goes on showing the value the user typed rather than the value that
87
- * was stored. Measured on a preferences write that asked for `locale: fr` and echoed `locale: en`.
103
+ * was stored — a write asking for `locale: fr` and echoing `locale: en`.
88
104
  */
89
105
  WRITE_FIELD_IGNORED: 'write-field-ignored',
90
106
  /** The UI advanced while a request was still in flight, so `settled` was reported over a live call. */
@@ -103,9 +119,8 @@ export const ContradictionKind = {
103
119
  * `dispatched: true, settled: true`, and every observation channel reports an empty window. The
104
120
  * settle half is the trap — a page that does nothing is quiet, and quiet is exactly what `settled`
105
121
  * tests for, so `until: { kind: 'settled' }` PASSES on a dead click and the verdict read
106
- * `verified: "yes", because: "no channel disagreeing"`. Measured on a real merchant dashboard by
107
- * clicking a `styled.div` that `reticle_query { by: 'text' }` had resolved instead of the button
108
- * beside it: zero events, store unchanged, green verdict.
122
+ * `verified: "yes", because: "no channel disagreeing"`. The shape that produces it: a `by: 'text'`
123
+ * query resolves a `styled.div` instead of the button beside it, and the click lands on nothing.
109
124
  */
110
125
  ACTION_HAD_NO_EFFECT: 'action-had-no-effect',
111
126
  /**
@@ -113,24 +128,40 @@ export const ContradictionKind = {
113
128
  * The URL says you arrived somewhere; the page is blank.
114
129
  *
115
130
  * This is the class every "did the control work" heuristic misses, because the control DID work:
116
- * it navigated. Measured on a real merchant dashboard with nine such links (Invoices, Route,
117
- * Subscriptions, QR Codes, Customers…), `reticle_crawl` drove all nine and reported
118
- * `deadControls: 0` — correctly, by its own definition, since a route change is activity.
131
+ * it navigated. A crawler counting dead controls reports none, correctly by its own definition,
132
+ * since a route change IS activity.
119
133
  *
120
- * The discriminator came from executing both cases and comparing, not from reasoning: a working
121
- * nav emitted `domAdded: 1, network: 2`; a blank one emitted `domAdded: 0, domRemoved: 0,
122
- * network: 0` and left the page at an eighth the size. A real transition either fetches something
123
- * or renders something.
134
+ * The discriminator: a working nav emits `domAdded: 1, network: 2`; a blank one emits
135
+ * `domAdded: 0, domRemoved: 0, network: 0`. A real transition either fetches something or renders
136
+ * something.
124
137
  *
125
- * MEASURED PRECISION, and the limit is real: 11 findings on that dashboard, 10 of them genuinely
126
- * blank destinations (verified by reading the DOM directly, not by asking Reticle), 1 false
127
- * positive. The false positive is instructive rather than fixable by tuning — a route whose view
128
- * is REVEALED from DOM that already existed emits `route.change` + `dom.attr` and nothing else,
129
- * which is byte-for-byte the window a blank destination emits. No event-only rule separates them.
130
- * Over-warning is the safe direction here (a false alarm costs a glance; a blank page shipped as
131
- * working does not), so it is reported with that ceiling stated rather than tuned into silence.
138
+ * THE LIMIT IS REAL, and is not fixable by tuning: a route whose view is REVEALED from DOM that
139
+ * already existed emits `route.change` + `dom.attr` and nothing else, which is byte-for-byte the
140
+ * window a blank destination emits. No event-only rule separates them. Over-warning is the safe
141
+ * direction (a false alarm costs a glance; a blank page shipped as working does not), so this is
142
+ * reported with the ceiling stated rather than tuned into silence.
132
143
  */
133
144
  ROUTE_RENDERED_NOTHING: 'route-rendered-nothing',
145
+ /**
146
+ * The route changed, nothing was rendered for it, AND the window holds a console error — the same
147
+ * shape as `ROUTE_RENDERED_NOTHING`, but with positive evidence of WHY the destination is blank,
148
+ * not merely its absence.
149
+ *
150
+ * `ROUTE_RENDERED_NOTHING` is deliberately absence-derived: a route that renders nothing might be a
151
+ * false positive (a view revealed from DOM that already existed — the 1-in-11 case measured on its
152
+ * own doc comment), so it downgrades to UNKNOWN rather than assert a fault nobody proved. That
153
+ * caution is wrong for THIS case. A console error in the same window is not an absence of
154
+ * evidence, it is a specific, positive claim — the destination crashed, and the app's own error
155
+ * boundary or console said so. Reported `unknown` anyway once, when a route-rendered-nothing
156
+ * window also carried a React hooks error: the console errors and the empty destination were both
157
+ * in hand, and the honest answer was available and not given.
158
+ *
159
+ * NOT in `ABSENCE_DERIVED_CONTRADICTIONS` — this is exactly the "evidence AGAINST the action"
160
+ * category that set exists to distinguish itself from, and it is graded `NO` for the same reason
161
+ * `ui-advanced-request-failed` is: a definitive verdict is available and inconclusive is a weaker,
162
+ * wrong answer to give when it is.
163
+ */
164
+ ROUTE_RENDERED_NOTHING_CRASHED: 'route-rendered-nothing-crashed',
134
165
  /**
135
166
  * Everything this window held belongs to a document that has SINCE been replaced.
136
167
  *
@@ -174,26 +205,22 @@ export const ContradictionKind = {
174
205
  /**
175
206
  * Contradictions inferred from the ABSENCE of evidence in a window whose end Reticle itself chose.
176
207
  *
177
- * The distinction is not cosmetic — it decides whether Reticle is entitled to say an action FAILED.
178
- * The other kinds are things we positively observed: a request came back 500 while the UI advanced,
179
- * a signal fired carrying data that disagrees with the DOM, a written field echoed a different
180
- * value. Those are evidence AGAINST the action, and they must keep outranking a passing assertion,
181
- * because a green assertion sitting on top of a failed write is the entire bug class this product
182
- * exists to catch.
208
+ * The distinction decides whether Reticle is entitled to say an action FAILED. The other kinds are
209
+ * POSITIVELY observed — a request came back 500 while the UI advanced, a signal fired carrying data
210
+ * that disagrees with the DOM, a written field echoed a different value — and they must keep
211
+ * outranking a passing assertion, because a green assertion on top of a failed write is the bug
212
+ * class this product exists to catch.
183
213
  *
184
- * These five are different. Each says "the thing I expected to see had not happened YET when I
185
- * stopped looking" — and the window closes the moment the predicate first passes, which on an app
186
- * that navigates optimistically is routinely before the network drains. Reproduced on the bench app:
187
- * `auth:granted` fired WITH matching data, application state changed, the token was stored, capture
188
- * integrity was clean and the honesty grade was `signal` — our strongest evidence class — and the
189
- * verdict was still `no`, because one POST had not settled. A timing observation overruled a
190
- * consequence observation, which inverts the grade hierarchy the verifier is built on.
214
+ * These five say only "the thing I expected had not happened YET when I stopped looking", and the
215
+ * window closes the moment the predicate first passes — on an app that navigates optimistically,
216
+ * routinely before the network drains. Letting one assert NO makes a timing observation overrule a
217
+ * consequence observation, which inverts the grade hierarchy the verifier is built on: the bench app
218
+ * produces a `no` over a fired signal with matching data, changed state, a stored token and a clean
219
+ * capture, because one POST had not settled.
191
220
  *
192
221
  * A false negative is not the mirror of a false positive here. A false positive stops an agent
193
222
  * early; a false NEGATIVE makes it redo work that already succeeded, or stop trusting the verdict
194
- * channel — and the verdict channel is the product. `bug.attribution` was deleted for exactly this
195
- * reason: every `attribution: 'app'` on `request-never-settled` turned out to be a misattribution.
196
- * We removed the field and left the verdict.
223
+ * channel — and the verdict channel is the product.
197
224
  *
198
225
  * So these downgrade a verdict to UNKNOWN rather than asserting NO. The finding is still reported in
199
226
  * `contradictions` either way — nothing is hidden, and an agent that wants to wait and re-check has
@@ -206,6 +233,9 @@ export const ABSENCE_DERIVED_CONTRADICTIONS = new Set([
206
233
  // never proof the app is wrong — a signal about non-visual state has nothing to corroborate it by
207
234
  // construction. UNKNOWN removes the false green; NO would invent a fault.
208
235
  ContradictionKind.SIGNAL_WITHOUT_CONSEQUENCE,
236
+ // The store moved and nothing painted. Non-visual state is a legitimate reason for that, so the
237
+ // absence of a render is never by itself proof the app is wrong.
238
+ ContradictionKind.STATE_VS_RENDER,
209
239
  // The consequence is not missing, it is somewhere this document's SDK cannot look — a claim about
210
240
  // the reach of the observation, never a positive fault in the app.
211
241
  ContradictionKind.CONSEQUENCE_ELSEWHERE,
@@ -223,6 +253,31 @@ export const ABSENCE_DERIVED_CONTRADICTIONS = new Set([
223
253
  export function isAbsenceDerived(kind) {
224
254
  return ABSENCE_DERIVED_CONTRADICTIONS.has(kind);
225
255
  }
256
+ /**
257
+ * Findings that are REPORTED and decide nothing.
258
+ *
259
+ * The two existing tiers both move a verdict: OBSERVED answers `no`, ABSENCE_DERIVED downgrades to
260
+ * `unknown`. Neither fits a fact that is true, worth telling the caller, and simply not about the
261
+ * question the caller asked.
262
+ *
263
+ * That gap had a cost. An app that polls on an interval could not produce a verdict at all: a camera
264
+ * scan loop POSTing until it acquired a lock had every assertion -- ones that had already seen the
265
+ * person recognised, the heading, the 200s -- come back `unknown`, because writes the assertion
266
+ * never mentioned counted against it. The caller then reports `pass: true` with correct evidence and
267
+ * has to explain in prose that Reticle's own verdict is wrong, which erodes the reason to have a
268
+ * verdict (#673).
269
+ *
270
+ * The bar for adding a kind here is high, and it is not "this rule is noisy". It is that the finding
271
+ * cannot, even in principle, be evidence about the declared consequence -- because it concerns
272
+ * traffic the assertion did not name.
273
+ */
274
+ export const ADVISORY_CONTRADICTIONS = new Set([
275
+ ContradictionKind.DUPLICATE_REQUEST_UNRELATED,
276
+ ]);
277
+ /** True when this kind is reported alongside a verdict without changing it. */
278
+ export function isAdvisory(kind) {
279
+ return ADVISORY_CONTRADICTIONS.has(kind);
280
+ }
226
281
  /**
227
282
  * How much authority a finding carries — the distinction above, said out loud on the finding itself.
228
283
  *
@@ -240,9 +295,18 @@ export const FindingTier = {
240
295
  OBSERVED: 'observed',
241
296
  /**
242
297
  * Inferred from something NOT having happened yet, in a window whose end Reticle chose. It may
243
- * become true a moment later. It is a statement about our timing at least as much as about the app.
298
+ * become true a moment later. It is a statement about the window's timing at least as much as
299
+ * about the app.
244
300
  */
245
301
  ABSENCE_DERIVED: 'absence-derived',
302
+ /**
303
+ * True, reported, and not about the question asked. Traffic the assertion never named.
304
+ *
305
+ * Distinct from ABSENCE_DERIVED, which IS about the declared consequence and says the timing was
306
+ * inconclusive about it. This one is about something else entirely, so downgrading on it answers a
307
+ * question nobody put.
308
+ */
309
+ ADVISORY: 'advisory',
246
310
  };
247
311
  /**
248
312
  * The tier of a finding, DERIVED from its kind.
@@ -258,6 +322,8 @@ export const FindingTier = {
258
322
  * end Reticle chose, so downgrading it would invent a caveat on its author's behalf.
259
323
  */
260
324
  export function tierOfFinding(kind) {
325
+ if (isAdvisory(kind))
326
+ return FindingTier.ADVISORY;
261
327
  return isAbsenceDerived(kind) ? FindingTier.ABSENCE_DERIVED : FindingTier.OBSERVED;
262
328
  }
263
329
  /**
@@ -266,6 +332,61 @@ export function tierOfFinding(kind) {
266
332
  * write. Narrowing to writes is what keeps the rules from crying wolf on ordinary reads.
267
333
  */
268
334
  export const MUTATING_METHODS = ['POST', 'PUT', 'PATCH', 'DELETE', 'IPC'];
335
+ /**
336
+ * Which two channels each contradiction sets against each other.
337
+ *
338
+ * `Record<ContradictionKind, ...>` on purpose: a new kind does not compile until somebody says what
339
+ * it compares. That is the point -- the independence rule is only checkable if the pairing is
340
+ * written down, and until now it was carried in the head of whoever added the rule.
341
+ *
342
+ * The pairing is causal, not observational: it names where each side of the disagreement was
343
+ * PRODUCED. A screenshot is `ui` even though it is taken out of process, because the pixels came
344
+ * from the render the action caused.
345
+ */
346
+ export const CONTRADICTION_CHANNELS = {
347
+ [ContradictionKind.UI_ADVANCED_REQUEST_FAILED]: [ChannelId.UI, ChannelId.NET],
348
+ [ContradictionKind.SIGNAL_CONTRADICTED]: [ChannelId.SIGNAL, ChannelId.NET],
349
+ [ContradictionKind.RESPONSE_IGNORED]: [ChannelId.NET, ChannelId.UI],
350
+ [ContradictionKind.SIGNAL_WITHOUT_CONSEQUENCE]: [ChannelId.SIGNAL, ChannelId.NET],
351
+ // The two channels that disagree are the store and the screen it should have driven.
352
+ [ContradictionKind.STATE_VS_RENDER]: [ChannelId.STATE, ChannelId.UI],
353
+ [ContradictionKind.CONSEQUENCE_ELSEWHERE]: [ChannelId.NET, ChannelId.UI],
354
+ [ContradictionKind.DUPLICATE_REQUEST]: [ChannelId.NET, ChannelId.NET],
355
+ [ContradictionKind.DUPLICATE_REQUEST_UNRELATED]: [ChannelId.NET, ChannelId.NET],
356
+ // The evidence is the interleaving of two responses, read against what the screen ended up showing.
357
+ [ContradictionKind.STALE_RESPONSE_APPLIED]: [ChannelId.NET, ChannelId.UI],
358
+ // Both sides are the server's own answer: the status line and the payload under it.
359
+ [ContradictionKind.PARTIAL_FAILURE_IN_OK_RESPONSE]: [ChannelId.NET, ChannelId.NET],
360
+ [ContradictionKind.UNIT_MISMATCH]: [ChannelId.UI, ChannelId.NET],
361
+ // What was sent against what came back -- the request and its echo, neither derived from the click.
362
+ [ContradictionKind.WRITE_FIELD_IGNORED]: [ChannelId.NET, ChannelId.NET],
363
+ [ContradictionKind.REQUEST_NEVER_SETTLED]: [ChannelId.TIME, ChannelId.NET],
364
+ // The app's message to the user, against the status the server actually returned.
365
+ [ContradictionKind.FAILURE_MISATTRIBUTED]: [ChannelId.UI, ChannelId.NET],
366
+ // "Nothing anywhere moved" is a claim about every channel; `net` is the independent one in it.
367
+ [ContradictionKind.ACTION_HAD_NO_EFFECT]: [ChannelId.NET, ChannelId.UI],
368
+ [ContradictionKind.ROUTE_RENDERED_NOTHING]: [ChannelId.ROUTE, ChannelId.NET],
369
+ // The crashed variant pairs against LOG rather than NET, because that is what makes it a
370
+ // different finding from the one above: its positive evidence is a console error in the same
371
+ // window, not a request. Pairing it with `net` would claim the network disagreed when nothing
372
+ // about the network was read.
373
+ [ContradictionKind.ROUTE_RENDERED_NOTHING_CRASHED]: [ChannelId.ROUTE, ChannelId.LOG],
374
+ // Not two channels disagreeing but evidence disagreeing with the clock, which is the independent
375
+ // side. Recorded rather than exempted: an exemption is a hole somebody later widens.
376
+ [ContradictionKind.EVIDENCE_SUPERSEDED]: [ChannelId.TIME, ChannelId.UI],
377
+ [ContradictionKind.EVIDENCE_PREDATES_EDIT]: [ChannelId.TIME, ChannelId.UI],
378
+ };
379
+ /**
380
+ * May this kind of disagreement be reported as a fault in the app?
381
+ *
382
+ * False when both sides come from the app's own actuation path. Such a disagreement is real and
383
+ * worth reporting -- the app contradicted itself -- but it is not evidence that the action failed,
384
+ * and treating it as such is how a verdict channel earns a reputation for crying wolf.
385
+ */
386
+ export function contradictionCanConvict(kind) {
387
+ const pair = CONTRADICTION_CHANNELS[kind];
388
+ return disagreementCanConvict(pair[0], pair[1]);
389
+ }
269
390
  export const CrawlAnomalyKind = {
270
391
  CONSOLE_ERROR: 'console-error', // the click logged a console.error / uncaught error
271
392
  FAILED_REQUEST: 'failed-request', // it fired a request that returned >= 400
@@ -5,20 +5,14 @@
5
5
  * verdict rather than passing it. That is a safety property and it is why a green verdict here means
6
6
  * something. What it has never answered is the other half: **what would I need in order to see it?**
7
7
  *
8
- * The difference matters because of who is driving. The decision-maker is an agent, and an agent
9
- * cannot be relied on to remember to instrument an app — nobody can. But an agent WILL act on a cost
10
- * it is paying right now, if it is handed the file, the line, and the change. So an absence in the
11
- * app stops being a silent weakness in the verdict and becomes a piece of work, at the moment the
12
- * agent is trying to finish.
8
+ * An agent will act on a cost it is paying right now if it is handed the file, the line and the
9
+ * change — so an absence in the app becomes a piece of work rather than a silent weakness in the
10
+ * verdict.
13
11
  *
14
- * ## The rule that keeps this from becoming noise
15
- *
16
- * A gap is reported ONLY when a verdict came back weaker than it would otherwise have been, BECAUSE
17
- * of an absence in the app. Never as a survey of everything uninstrumented on the page.
18
- *
19
- * A gap nobody hit is a backlog, not a finding, and this product does not need another surface
20
- * producing findings nobody reads. The test for whether a gap belongs here is: *did this absence
21
- * change the answer the agent just got?* If not, it does not fire.
12
+ * THE RULE THAT KEEPS IT FROM BECOMING NOISE: a gap is reported ONLY when a verdict came back weaker
13
+ * than it would otherwise have been, BECAUSE of an absence in the app. Never as a survey of
14
+ * everything uninstrumented on the page. The test is *did this absence change the answer the agent
15
+ * just got?* — if not, it does not fire.
22
16
  */
23
17
  /**
24
18
  * The kinds of absence that can weaken a verdict. Most name a capability the app did not provide;
@@ -43,7 +37,6 @@ export declare const InstrumentationGapKind: {
43
37
  */
44
38
  readonly NO_SIGNAL_ON_MUTATION: "no-signal-on-mutation";
45
39
  /** The route changed and no route signal fired, so route consequences cannot be asserted. */
46
- readonly NO_ROUTE_SIGNAL: "no-route-signal";
47
40
  /** A control was driven that the declared capability contract does not mention. */
48
41
  readonly UNDECLARED_CONTROL: "undeclared-control";
49
42
  /**
@@ -101,6 +94,21 @@ export declare const InstrumentationGapKind: {
101
94
  * on it. Absence stays honest.
102
95
  */
103
96
  readonly NO_FLOW_INTENT: "no-flow-intent";
97
+ /**
98
+ * Source mapping is off because the PROJECT turned it off, not because nothing provides it.
99
+ *
100
+ * A separate kind from `NO_SOURCE_MAPPING` because the remedy is the opposite one. Reported from
101
+ * the field by a react-three-fiber app: the `data-reticle-source` stamp crashed it to a white
102
+ * screen — R3F host elements are three.js objects, and a dashed prop is read there as a property
103
+ * path — so the option was disabled, correctly, and every red verdict afterwards told the reader
104
+ * to add a build plugin that was already installed and whose stamp was the thing that broke.
105
+ *
106
+ * A remedy that cannot be followed costs a round trip and teaches the reader to skip the gap
107
+ * block, which is where the honest gaps live too. Any app built on a non-DOM reconciler has to
108
+ * turn the stamp off to run at all, so this is a supported configuration rather than an unusual
109
+ * one, and the verdict has to speak to it.
110
+ */
111
+ readonly SOURCE_MAPPING_OFF: "source-mapping-off";
104
112
  };
105
113
  export type InstrumentationGapKind = (typeof InstrumentationGapKind)[keyof typeof InstrumentationGapKind];
106
114
  export interface InstrumentationGap {
@@ -5,20 +5,14 @@
5
5
  * verdict rather than passing it. That is a safety property and it is why a green verdict here means
6
6
  * something. What it has never answered is the other half: **what would I need in order to see it?**
7
7
  *
8
- * The difference matters because of who is driving. The decision-maker is an agent, and an agent
9
- * cannot be relied on to remember to instrument an app — nobody can. But an agent WILL act on a cost
10
- * it is paying right now, if it is handed the file, the line, and the change. So an absence in the
11
- * app stops being a silent weakness in the verdict and becomes a piece of work, at the moment the
12
- * agent is trying to finish.
8
+ * An agent will act on a cost it is paying right now if it is handed the file, the line and the
9
+ * change — so an absence in the app becomes a piece of work rather than a silent weakness in the
10
+ * verdict.
13
11
  *
14
- * ## The rule that keeps this from becoming noise
15
- *
16
- * A gap is reported ONLY when a verdict came back weaker than it would otherwise have been, BECAUSE
17
- * of an absence in the app. Never as a survey of everything uninstrumented on the page.
18
- *
19
- * A gap nobody hit is a backlog, not a finding, and this product does not need another surface
20
- * producing findings nobody reads. The test for whether a gap belongs here is: *did this absence
21
- * change the answer the agent just got?* If not, it does not fire.
12
+ * THE RULE THAT KEEPS IT FROM BECOMING NOISE: a gap is reported ONLY when a verdict came back weaker
13
+ * than it would otherwise have been, BECAUSE of an absence in the app. Never as a survey of
14
+ * everything uninstrumented on the page. The test is *did this absence change the answer the agent
15
+ * just got?* — if not, it does not fire.
22
16
  */
23
17
  /**
24
18
  * The kinds of absence that can weaken a verdict. Most name a capability the app did not provide;
@@ -43,7 +37,6 @@ export const InstrumentationGapKind = {
43
37
  */
44
38
  NO_SIGNAL_ON_MUTATION: 'no-signal-on-mutation',
45
39
  /** The route changed and no route signal fired, so route consequences cannot be asserted. */
46
- NO_ROUTE_SIGNAL: 'no-route-signal',
47
40
  /** A control was driven that the declared capability contract does not mention. */
48
41
  UNDECLARED_CONTROL: 'undeclared-control',
49
42
  /**
@@ -101,6 +94,21 @@ export const InstrumentationGapKind = {
101
94
  * on it. Absence stays honest.
102
95
  */
103
96
  NO_FLOW_INTENT: 'no-flow-intent',
97
+ /**
98
+ * Source mapping is off because the PROJECT turned it off, not because nothing provides it.
99
+ *
100
+ * A separate kind from `NO_SOURCE_MAPPING` because the remedy is the opposite one. Reported from
101
+ * the field by a react-three-fiber app: the `data-reticle-source` stamp crashed it to a white
102
+ * screen — R3F host elements are three.js objects, and a dashed prop is read there as a property
103
+ * path — so the option was disabled, correctly, and every red verdict afterwards told the reader
104
+ * to add a build plugin that was already installed and whose stamp was the thing that broke.
105
+ *
106
+ * A remedy that cannot be followed costs a round trip and teaches the reader to skip the gap
107
+ * block, which is where the honest gaps live too. Any app built on a non-DOM reconciler has to
108
+ * turn the stamp off to run at all, so this is a supported configuration rather than an unusual
109
+ * one, and the verdict has to speak to it.
110
+ */
111
+ SOURCE_MAPPING_OFF: 'source-mapping-off',
104
112
  };
105
113
  /**
106
114
  * The remedy for a kind, as one line an agent can act on without reading a doc.
@@ -113,11 +121,11 @@ const GAP_FIX = {
113
121
  [InstrumentationGapKind.NO_SOURCE_MAPPING]: 'add the Reticle build plugin (@reticlehq/vite-plugin, @reticlehq/next, or the babel plugin) so elements carry data-reticle-source',
114
122
  [InstrumentationGapKind.NO_STORE_REGISTERED]: 'register the store with reticle.registerStore(name, getState) so state can be read directly instead of inferred from the DOM',
115
123
  [InstrumentationGapKind.NO_SIGNAL_ON_MUTATION]: 'fire reticle.signal(name, data) where this state is committed — commitAndSignal binds the two so they cannot drift',
116
- [InstrumentationGapKind.NO_ROUTE_SIGNAL]: 'let the Reticle router adapter observe navigation, or fire reticle.signal on route commit',
117
124
  [InstrumentationGapKind.UNDECLARED_CONTROL]: 'add this control to reticle.describe() so the capability contract matches what the app actually exposes',
118
125
  [InstrumentationGapKind.MISSING_TESTID]: 'add data-testid="..." on this control so the flow can name it after a refactor',
119
126
  [InstrumentationGapKind.UNDECLARED_CHANGE]: 'declare it with reticle_intent { action: "declare", intents: [{ id, statement }] } — the statement is prose, in your own words: which user does what, and what should become true',
120
127
  [InstrumentationGapKind.INTENT_UNDISCHARGED]: 'draw a verdict whose `until` asserts the intent itself, then it discharges — or call reticle_run({ tool: "reticle_context" }) to see exactly what is still owed',
128
+ [InstrumentationGapKind.SOURCE_MAPPING_OFF]: 'nothing to install — this build has sourceMapping turned off, so no element carries data-reticle-source. Re-enable it in the Reticle plugin options unless this app renders through a non-DOM reconciler (react-three-fiber, react-pdf, ink), where the stamp is what would break it',
121
129
  [InstrumentationGapKind.NO_FLOW_INTENT]: 'save it again with intent: "<which user does what, and what should become true>" — prose, in your own words — or set intentId to an intent already in the ledger',
122
130
  };
123
131
  /** The one-line remedy for a gap kind. */