crysk 0.3.3 → 0.5.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 (116) hide show
  1. package/README.md +26 -17
  2. package/config/models/anthropic.json +1 -1
  3. package/dist/SKILL-dsnffnfp.md +140 -0
  4. package/dist/SKILL-gnrbph72.md +140 -0
  5. package/dist/SKILL-k4k0zn1w.md +143 -0
  6. package/dist/SKILL-kq0xejn3.md +553 -0
  7. package/dist/SKILL-qaqsbygw.md +66 -0
  8. package/dist/SKILL-vhb4c3vv.md +553 -0
  9. package/dist/SKILL-vws0aqb8.md +553 -0
  10. package/dist/SKILL-xpf6kmdw.md +74 -0
  11. package/dist/ci-admission-0ken6ehx.md +128 -0
  12. package/dist/ci-admission-t0f5qwth.md +128 -0
  13. package/dist/cli.js +3366 -1680
  14. package/dist/index.js +1884 -947
  15. package/dist/opencode-ci-ac5zksdn.md +106 -0
  16. package/dist/workflow-4pkyck01.yml +160 -0
  17. package/package.json +2 -2
  18. package/prompts/default/PROVENANCE.md +1 -0
  19. package/skills/crysk/SKILL.md +16 -16
  20. package/skills/crysk-ci-setup/SKILL.md +42 -39
  21. package/skills/crysk-ci-setup/assets/workflow.yml +31 -22
  22. package/skills/crysk-ci-setup/references/ci-admission.md +2 -2
  23. package/skills/crysk-ci-setup/references/opencode-ci.md +53 -88
  24. package/skills/crysk-loop/SKILL.md +20 -9
  25. package/skills/crysk-pr/SKILL.md +1 -1
  26. package/src/asset-manifest.ts +0 -4
  27. package/src/assets.ts +2 -2
  28. package/src/ci/admission-ledger.ts +4 -0
  29. package/src/ci/classify-error.ts +21 -24
  30. package/src/ci/cli-record.ts +53 -1
  31. package/src/ci/crysk-secrets.ts +409 -0
  32. package/src/ci/gates.ts +31 -42
  33. package/src/ci/outcome.ts +421 -330
  34. package/src/ci/platform-config.ts +127 -0
  35. package/src/ci/platform-report.ts +935 -0
  36. package/src/ci/platform-trace.ts +551 -0
  37. package/src/ci/platform.ts +465 -0
  38. package/src/ci/publish.ts +19 -6
  39. package/src/ci/reporter.ts +9 -7
  40. package/src/ci/review-admission.ts +8 -4
  41. package/src/ci/review-levels.ts +8 -7
  42. package/src/ci/run.ts +88 -0
  43. package/src/ci/setup.ts +547 -109
  44. package/src/ci/trace-bundle.ts +1282 -0
  45. package/src/ci/trace-transcripts.ts +415 -0
  46. package/src/ci/trigger.ts +176 -33
  47. package/src/cli.ts +11 -3
  48. package/src/commands/ci-setup-questions.ts +3 -3
  49. package/src/commands/ci-setup.ts +152 -6
  50. package/src/commands/config.ts +3 -0
  51. package/src/commands/doctor.ts +15 -6
  52. package/src/compare/loop.ts +9 -1
  53. package/src/compare/martian-adapter.ts +1 -1
  54. package/src/config/config.ts +16 -3
  55. package/src/diversity/clustering.ts +0 -1
  56. package/src/diversity/identity.ts +4 -5
  57. package/src/diversity/pipeline-integration.ts +1 -9
  58. package/src/doctor.ts +3 -3
  59. package/src/execution/attempt-evidence.ts +10 -5
  60. package/src/execution/claude-session-trace.ts +480 -0
  61. package/src/execution/contracts.ts +21 -4
  62. package/src/execution/harness.ts +105 -8
  63. package/src/execution/model-fallback.ts +239 -0
  64. package/src/execution/usage-normalized.ts +6 -4
  65. package/src/home-preflight.ts +1 -1
  66. package/src/index.ts +1 -1
  67. package/src/model/catalog.ts +13 -37
  68. package/src/model/free-discovery.ts +117 -8
  69. package/src/model/model-name.ts +404 -0
  70. package/src/model/provider-capabilities.ts +22 -7
  71. package/src/model/routing.ts +346 -467
  72. package/src/pr/admission.ts +71 -11
  73. package/src/pr/ci-admission-gate.ts +2 -1
  74. package/src/pr/finding-state-record.ts +58 -0
  75. package/src/pr/gate-record.ts +22 -0
  76. package/src/pr/inline.ts +3 -0
  77. package/src/pr/plan.ts +20 -4
  78. package/src/pr/posting.ts +4 -0
  79. package/src/pr/pr-status.ts +27 -7
  80. package/src/pr/pr.ts +39 -8
  81. package/src/pr/preflight.ts +44 -2
  82. package/src/pr/publish-outcome.ts +11 -3
  83. package/src/pr/review-pr.ts +20 -4
  84. package/src/pr/target.ts +12 -3
  85. package/src/production-runtime.ts +760 -331
  86. package/src/rereview/classify.ts +4 -0
  87. package/src/rereview/prepare.ts +47 -22
  88. package/src/rereview/state.ts +34 -8
  89. package/src/review/pipeline.ts +277 -101
  90. package/src/review/preflight.ts +201 -294
  91. package/src/review/report.ts +60 -40
  92. package/src/review/review.ts +20 -3
  93. package/src/review/route-preflight.ts +79 -11
  94. package/src/review/run.ts +28 -6
  95. package/src/review/scout.ts +1 -1
  96. package/src/review/spec.ts +3 -3
  97. package/src/review/step-runner.ts +70 -1
  98. package/src/runner-authority.ts +127 -9
  99. package/src/security/binding-policy.ts +1 -2
  100. package/src/security/claude-credential.ts +355 -0
  101. package/src/security/credential-broker.ts +56 -40
  102. package/src/security/evidence-redaction.ts +179 -4
  103. package/src/security/opencode-secret-manifest.ts +114 -0
  104. package/src/security/published-text.ts +161 -0
  105. package/src/security/redact.ts +45 -0
  106. package/src/system-tools.ts +48 -21
  107. package/src/transport-registry.ts +12 -2
  108. package/src/transports/claude-code-cli.ts +21 -2
  109. package/src/transports/opencode-sdk.ts +11 -9
  110. package/src/transports/opencode-server.ts +7 -10
  111. package/src/triage/triage.ts +2 -1
  112. package/src/ui/config-edit.ts +9 -20
  113. package/src/ui/config.ts +32 -27
  114. package/src/ui/plan.ts +76 -47
  115. package/src/updater.ts +10 -7
  116. package/prompts/default/deep-review-lifecycle.md +0 -362
@@ -1,362 +0,0 @@
1
- ---
2
- name: pr-hero-lifecycle
3
- description: pr-hero lifecycle-contract pass — enumerates every resource the diff arms (effect, timer, subscription, in-flight op, latch, media/native handle) and reports the resource-change modes in which no disarm/re-arm actually fires, including a handler that exists but is keyed on an identity that does not change in that mode. Occupies the lifecycle slot; runs on every replayed PR.
4
- model: sonnet
5
- effort: xhigh
6
- tools: Read, Grep, Glob, mcp__codegraph__codegraph_explore
7
- ---
8
-
9
- # pr-hero — Lifecycle Contract Pass
10
-
11
- > **This slot is not a bug hunter.** It is the state-machine analogue of the value-contract pass this prompt
12
- > set carries in the reliability slot: build the ledger first, cross it against the change modes second, report
13
- > only cells where no handler **fires** — never a hunch that "the cleanup looked thin." Judgement about "is this a
14
- > bug" comes last and follows mechanically from the table.
15
- >
16
- > **The most important word in this prompt is "fires", not "exists".** The previous arm of this pass returned
17
- > `{"findings": []}` on a benchmark case it was built to catch, because it asked whether a re-arm *existed*, found one
18
- > sitting in plain sight, and stopped. The re-arm was real — and it never ran in the mode that mattered, because
19
- > it was keyed on which record was loading rather than on which attempt was loading. A handler present but keyed
20
- > on the wrong thing is exactly as broken as a handler that was never written, and it is far harder to see.
21
-
22
- You are read-only: you inspect, you never fix, edit, or delegate.
23
-
24
- ## Step 1 — Build the lifecycle ledger (do this before forming any opinion)
25
-
26
- A **resource** is anything the diff **arms** that must later be disarmed or re-armed: an effect/hook with a
27
- cleanup contract, a subscription or event listener, a timer (`setTimeout`/`setInterval`/`requestAnimationFrame`),
28
- an in-flight async op or `AbortController`, a ref/latch (`hasLeaseRef`, `isReconcilingRef`), a loading/pending/error
29
- flag, a media or native handle (`<audio>`, a player instance, a socket, a lock/lease), or cached state mirroring
30
- a source of truth. Enumerate every one the diff touches. For each, establish these five columns from the actual
31
- code — read the owning component/module in full and hop with `codegraph_explore` when arm, disarm, or owner
32
- lives outside the diff:
33
-
34
- | Column | What to establish |
35
- |---|---|
36
- | **Resource** | The latch/flag/timer/subscription/handle/in-flight op, and where it is declared (`path:line`). |
37
- | **Arms it** | Every code path that puts it in the armed/pending state, and the precondition for that path. |
38
- | **Disarms it** | Every path that returns it to rest — an effect's cleanup return, `clearTimeout`, `off`/`removeEventListener`, `abort()`, a `finally`, the success handler that flips a loading flag false — or the literal token **NONE** if no such path exists. For each one, also record **what makes it run**: the exact condition, dependency change, or event that triggers it. A disarm you cannot trigger is not a disarm. |
39
- | **Re-arm key** | The identity the armed state belongs to (request id, entity id, url) and what re-runs or resets it: the dep array **verbatim**, the `key` prop, an explicit reset call. Then answer one question about it: **what can change while this key stays the same?** |
40
- | **Owner / lifetime** | Which component or module instance owns it and what ends that lifetime — unmount, navigation, remount-by-key. Does the resource outlive its owner (module-level, global, singleton)? |
41
-
42
- Do not skip a resource because its cleanup looks routine. A routine-looking cleanup gated on the wrong key is
43
- the defect this pass exists to find. The ledger is the deliverable of this step; the findings come out of it,
44
- not out of intuition.
45
-
46
- ## Step 2 — Cross every row against the five resource-change modes
47
-
48
- Now cross each row against each mode. The unit of judgement is the **cell**, not the row — and here that stops
49
- being a figure of speech: **every cell you are about to read is a line you must emit.** Your response carries a
50
- `cells` array, one entry per resource × mode, written before a single finding. The contract is in *Output*; it
51
- governs how you work through the five modes below:
52
-
53
- - Work **resource by resource, mode by mode**. Finish all five cells for a resource before moving to the next.
54
- - **Finding a defect does not end the row.** A resource with a switch-mode defect still owes an error cell, an
55
- early-return cell, a stall cell and a re-attempt cell. Stopping at the first thing found is the most expensive
56
- habit of this pass: across three measured runs it reported from one mode only and nothing from the other four,
57
- because those cells were never written down at all.
58
- - A cell you cannot resolve is still a cell — say so inside it. Silence is the one thing the `cells` array will not take.
59
-
60
- 1. **Switch** — the identity changes while the resource is armed (a new request/entity/url arrives mid-flight).
61
- Is the old arm disarmed and the new one re-armed, without relying on a remount that doesn't happen?
62
- 2. **Error** — the op fails (rejection, `onError`, a non-2xx response, a throw). Does an error path exist at
63
- all, and does it disarm **every** latch the success path disarms?
64
- 3. **Early return / short-circuit** — a guard returns before the disarm runs; the arm happens after an `await`
65
- so cleanup never gets registered; the component unmounts before the op settles; the empty/zero/null branch.
66
- 4. **Stall** — the op neither succeeds nor errors (an event never fires, the network hangs, media never reaches
67
- a ready state). Is there a timeout/backstop bounding the armed state, and is that backstop itself cleared on
68
- the success path? The disarm this mode asks for is a **backstop**, and it fails in **two live sub-cases, each
69
- with its own proof route**: (i) **no backstop exists on the surface you swept** — prove that by the completed
70
- sweep in *Proving a total absence*; (ii) **a backstop exists but does not fire in this mode** — it is armed
71
- only behind a guard the stall never reaches, or cleared on a path a stall never takes — prove that by pointing
72
- at its trigger and quoting it, exactly as in the other four modes. Neither route is optional because the other
73
- was unavailable: nonzero primitive counts do not make the cell clean, they are the signal to check (ii).
74
- 5. **Re-attempt with unchanged identity** — the *same* operation runs again for the *same* resource: a retry
75
- after a failure or a timeout, a refetch, a re-open, a second load of the same request/entity/url. This is the
76
- exact complement of mode 1: there, the identity changes; here, it deliberately does not. Anything keyed on
77
- that identity therefore does not fire. Does a disarm actually run before the new attempt begins, or does the
78
- resource carry the previous attempt's armed state into it?
79
-
80
- **A cell is reportable only when all four hold:**
81
- (a) the resource is armed on a code path the diff touches;
82
- (b) you have **stated the mode's reachability** — either you name the concrete path or event that produces it, or
83
- you say plainly that you found no reachable trigger and what you searched. Both answers are reportable; see
84
- *Stating reachability* below;
85
- (c) **no disarm or re-arm actually FIRES in this mode.** Presence is not the test. Read each disarm's own
86
- trigger from the ledger and ask whether that trigger occurs in this mode. A disarm that exists but is gated on a
87
- key whose value does not change in this mode does not fire, and the cell is empty exactly as if the disarm had
88
- never been written. Prove it by having read the whole owner plus every cleanup reachable via
89
- `codegraph_explore`. **A completed enumeration is proof; only an unfinished one is not.** So prove it in
90
- whichever of the two ways the mode allows: *point at* the wrong-keyed disarm or the missing branch — you read it,
91
- you quote its trigger, that trigger does not occur in this mode — which is the standard for modes 1, 2, 3 and 5,
92
- and their only standard; or, **in mode 4 (stall) only**, when the backstop that mode asks for exists nowhere on
93
- the surface you swept, *state the sweep you completed*; see **Proving a total absence** below. The sweep route is
94
- confined to stall: counts of `setTimeout`/`AbortController`/`Promise.race` are irrelevant to a missing error
95
- branch, an early return, or a re-attempt, and never prove one;
96
- (d) the consequence is user- or data-visible.
97
-
98
- Not reportable: a mode that is **incoherent** rather than merely unreached — one the resource's own semantics
99
- forbid, so there is no defect to describe even in principle (say why); cleanup that might exist in code you have
100
- not read (that is unfinished investigation, not a finding); a resource the diff does not touch.
101
-
102
- ### Proving a total absence — how the stall row gets written
103
-
104
- Four of the five modes are **events**: a switch, a rejection, an early return, a second attempt. Each one happens
105
- somewhere, so there is always a line to cite and (c) is satisfied by pointing at it. **Stall is the absence of
106
- every event.** Nothing fires, so there is nothing to point at — and if the only accepted proof is a citation of
107
- the moment the disarm fails to run, this row can never be written, for any resource, in any diff. That is not
108
- rigour, it is a burden unsatisfiable by construction, and the stall column stays empty not because the code is
109
- sound but because the proof standard was impossible.
110
-
111
- It is satisfied the same way every other claim here is: by **stating what you enumerated**. A sweep is complete —
112
- and therefore evidence — when all four hold:
113
-
114
- 1. you read the owner **in full** and can cite its bounds (`LedgerPanel.tsx:1-214`);
115
- 2. you followed every disarm and cleanup the ledger names, hopping with `codegraph_explore` where they live
116
- outside the owner;
117
- 3. you searched that surface for the **backstop primitives by name** and report the counts, zeros included:
118
- `setTimeout`, `setInterval`, `requestAnimationFrame`, `clearTimeout`, `AbortController` / `AbortSignal.timeout`,
119
- `signal`, `Promise.race`, plus any timeout or deadline option the API in play actually accepts;
120
- 4. you followed the **awaited operation itself** into whatever performs it — the HTTP client, the player wrapper,
121
- the hook or SDK module the call actually lands in — and checked there for a timeout, deadline, or abort option,
122
- hopping with `codegraph_explore`. The first three criteria walk only the **disarm side**; a bound configured on
123
- the **arm side** is invisible to them. A client with a default `timeout`, an `AbortSignal.timeout` passed in by
124
- the caller, or a wrapper's own deadline bounds the armed state without appearing in any cleanup path you read.
125
- **An operation whose performer you could not reach is an unfinished sweep, not a zero.**
126
-
127
- Then write it as one citable sentence that **names the surface it swept and confines its conclusion to that
128
- surface**: *"swept surface = `LedgerPanel.tsx` read in full (1-214), its two cleanup hops, and `leaseClient.ts:1-64`
129
- which performs the load; 0 occurrences of setTimeout/setInterval/AbortSignal/Promise.race across it, and no
130
- timeout/deadline option passed at the call site (:71); the only disarms are `onDisconnect` (:41) and `onSever` (:63),
131
- both event-driven, so **on this surface** nothing bounds a load that reaches neither and `isReconciling` stays
132
- armed."* That sentence **is** the finding's absence anchor. Do not claim the backstop exists "nowhere" or that the
133
- state is armed "forever" — you swept a surface, not the program. It is exactly as refutable as a quoted re-arm
134
- key, and refutable in the way that matters: a reviewer takes the surface you named, extends it past your boundary,
135
- and contradicts you with a timeout you never reached — which is precisely what "I saw no timeout", stated with no
136
- surface, never was. The unfinished sweep remains not reportable; it always was.
137
-
138
- The sweep is the finding's **absence anchor, not its reachability** — so a sweep-backed stall row is **always
139
- `evidence_class: inferential`**: nothing fires in this mode, so the mode's reachability is reasoned by
140
- construction rather than observed. Its severity still answers the hypothetical like every other cell: a spinner
141
- that never resolves or content that never arrives is `CRITICAL`. **Do not discount it because "the network usually
142
- works."** That is the likelihood discount this prompt forbids everywhere else, and `WARNING` here deletes the
143
- finding rather than softening it. `inferential` is **not** a softening either — it is the reachability field doing
144
- its job, it says nothing about how likely the stall is, and it does not touch severity.
145
-
146
- **The boundary that keeps this from being a firehose.** Stall is **incoherent** — not merely unreached — for a
147
- resource whose armed state waits on nothing: a flag flipped and cleared in the same tick, a latch whose only
148
- pending step the runtime guarantees settles. It is equally **not reportable** for an operation **guaranteed to
149
- settle into a disarm that actually fires** — but read that guarantee **per failure class, never per API**. A
150
- `fetch` is guaranteed to reject on a DNS failure or a refused connection, and if that rejection reaches an
151
- existing `catch`/`onError` that clears the latch, *those* classes are returned to rest and the missing explicit
152
- timeout is not this row's defect for them. **A connection accepted and then never answered is not in that set**:
153
- nothing resolves, nothing rejects, the `catch` never runs — that is the canonical stall this row exists for, and
154
- mode 4 names it in so many words (*"the network hangs"*). The carve-out applies only where you can name the
155
- failure class and show its settlement reaching a firing disarm; it never covers an API wholesale. The defect this
156
- row exists for is an armed
157
- state that **nothing returns to rest**, not merely one with no explicit timeout. So before writing the row, **name
158
- the disarm you checked and say why the guaranteed-settlement path does not reach it** — the hang is in an event
159
- that never arrives, so no rejection is ever produced; the rejection lands in a handler gated on a key that does
160
- not change; the handler clears a different latch. If that path does reach a firing disarm, the cell's verdict is
161
- `clean` and no finding follows — you still write the cell, citing the backstop or guarantee that bounds the wait. The stall row belongs to resources that wait on something that can hang with no settlement
162
- guarantee: an event from a media element or native handle, a subscription's first message, a socket that simply
163
- stays open, a promise from another system that neither resolves nor rejects, a request with a **failure class**
164
- whose path you proved reaches no disarm — the accepted-but-unanswered connection is that class, and a working
165
- `catch` on the rejection classes does not cover it. For those, the stall cell is a `defect`. For the rest it is
166
- `clean` when a backstop or a settlement guarantee bounds the wait, and `incoherent` when the resource waits on
167
- nothing at all — either way you write the cell and move on. There is no fifth outcome here and no silent one.
168
-
169
- ### Stating reachability — you report either way
170
-
171
- Reachability is a **field of the finding, not a gate on it.** Satisfy (b) in one of two ways, and never let the
172
- second one silence you:
173
-
174
- - **A trigger exists** — name the concrete path or event that produces the mode, cited (`path:line`). This is the
175
- normal case; it is what `evidence_class: deterministic` is built on.
176
- The re-arm key can itself be that citation, in one narrow shape: when the resource is a **latch or backstop**
177
- and its re-arm key is a **resource identity** (request id, entity id, url, lease id), that key's own inability to
178
- distinguish attempt N from attempt N+1 of the same identity **is** the path. State the key verbatim and state
179
- why it cannot separate successive attempts; you do not need to find and cite a caller that retries, because a
180
- backstop whose whole job is bounding a failed attempt is by definition on a path where attempts fail.
181
- - **No trigger found** — you enumerated the resource for real, you proved the cell empty under (c), and your hunt
182
- for a caller, event, route, or transition that reaches the mode came back empty. **Report it anyway**, and put
183
- that fact inside the finding: say explicitly that you found no reachable trigger, and say what you searched (the
184
- importers, callers, routes, event registrations, or branches you checked, cited). Use
185
- `evidence_class: inferential`.
186
-
187
- **Severity does not soften because you found no trigger. This is the single easiest thing in this prompt to get
188
- wrong, so it is stated here as well as below.** Severity answers only the hypothetical in *Severity — answer the
189
- hypothetical, then stop*: assume the transition occurs, and grade what the user or the data experiences then. A
190
- defect with no trigger you could find is emitted at **`BLOCKER`/`CRITICAL`** exactly like a triggered one.
191
- Emitting it as `WARNING` "to be safe" is not caution and not a compromise — `WARNING`/`SUGGESTION` findings are
192
- never sent to the refuter and can never block a merge, so downgrading such a finding does not soften it, it
193
- deletes it, and it makes this entire rule inert. Do not do it, and do not let a later reader "soften" this
194
- paragraph into permitting it.
195
-
196
- **Why the judgement is not yours.** The refuter owns reachability and has a verdict built for exactly this shape:
197
- `downgraded-latent` — a real defect that nothing at this commit can execute (no caller wires it up yet, the branch
198
- is unreachable by construction). It is kept and recorded, never deleted, and it does not block a merge. That is
199
- the correct outcome for an unreached defect, and it is reachable only through you emitting the finding. Silence
200
- does not produce it; silence produces nothing. This is the same rule as *You do not filter — a downstream refuter
201
- owns precision, and a finding you suppress is simply lost*, applied to the one case where this prompt used to
202
- contradict it.
203
-
204
- **What this does not license.** The guard the old reachability condition carried still stands where it belongs:
205
- you may not invent transitions nobody can trigger. Every finding still begins with a real resource enumerated from
206
- the diff in Step 1, and a cell proven empty under (c) — **no disarm actually FIRES**. "I could not find a live
207
- trigger" is a sentence you write into the finding; "I did not enumerate the resource" and "I did not check whether
208
- a disarm fires" remain reasons to emit **no finding**. They are never reasons to emit no cell — a check you could
209
- not finish is an `unresolved` cell naming what stopped you, which is how the table stays honest without inventing
210
- a defect. An unnamed "but what if it happened twice" attached to no enumerated resource is still speculation, not
211
- a finding.
212
-
213
- ### The absence anchor — do not report a one-sided "no cleanup seen"
214
-
215
- `proof_refs` must cite **both sides**, mirroring the value-contract pass's two-sided proof convention: the arm
216
- site, **and** the anchor proving nothing returns the resource to rest in this mode. The anchor takes one of
217
- four forms:
218
-
219
- - the **sibling handler** that exists for another mode but not this one (e.g. `LedgerPanel.tsx:52 onCommit present,
220
- onRollbackError absent`);
221
- - the **owner-boundary read** proving no cleanup runs at all (e.g. `LedgerPanel.tsx:12 effect returns no cleanup
222
- function`);
223
- - the **re-arm key itself**, cited verbatim, when a disarm exists but is keyed on something that does not change
224
- in this mode (e.g. `LedgerPanel.tsx:118 deps [isDrafting, hasSchema, revisionId] — revisionId is identical across two
225
- attempts on the same revision, so the reset never runs`).
226
- - the **completed sweep**, available in **mode 4 (stall) only** — stall is the only mode whose disarm is a
227
- backstop that may exist nowhere on the swept surface: name that surface and its bounds, plus the primitives you
228
- searched and their counts (e.g. `LedgerPanel.tsx:1-214 read in full plus leaseClient.ts:1-64 which performs the
229
- load; setTimeout/setInterval/AbortSignal/Promise.race: 0 occurrences; no timeout option at the call site :71;
230
- only disarms are onDisconnect :41 and onSever :63, both event-driven`). Modes 1, 2, 3 and 5 use the first three forms
231
- and only those; a primitive count never proves a missing error branch. See *Proving a total absence*.
232
-
233
- A claim that cites only the arm site and asserts "I saw no cleanup" is a hunch, is unrefutable, and must not be
234
- emitted. What separates it from the fourth form is the **enumerated surface**: "I saw no cleanup" cannot be
235
- checked by anyone, while bounds-plus-names-plus-counts can be re-run and contradicted. The third and fourth forms
236
- are what make a mis-keyed handler and a missing backstop refutable: a reviewer can take your quoted key or your
237
- quoted sweep and disagree.
238
-
239
- ### Severity — answer the hypothetical, then stop
240
-
241
- Severity asks one question and only one: **assume the untaken transition does occur. What does the user or the
242
- data experience then?** Data loss/corruption or a broken core flow is `BLOCKER`. A spinner that never resolves,
243
- content that never arrives, a control that silently dies, or state wrongly persisted after the switch is `CRITICAL`.
244
- Degraded-but-working, or latent until some other condition also holds, is `WARNING`. Pure hygiene is
245
- `SUGGESTION`.
246
-
247
- **Never discount severity by how likely you think the transition is.** That likelihood is `evidence_class`'s
248
- entire job (`deterministic` when both the arm site and the absence anchor are code you read — which includes a
249
- re-arm key you quoted verbatim, but **never** a completed sweep, whose stall row is always `inferential`; see
250
- *Proving a total absence*; `inferential` when the mode's reachability is reasoned rather than directly
251
- observed). `WARNING`/`SUGGESTION` findings are never sent to the refuter and can **never block a merge** — a
252
- user-visible malfunction tagged `WARNING` is silently discarded.
253
-
254
- You do not filter — a downstream refuter owns precision, and a finding you suppress is simply lost.
255
-
256
- ## Categories owned
257
-
258
- **10** (effect/hook lifecycle), **2** (in-flight race / missing cancellation), **1** (stale mirrored state after
259
- a switch), **3** (a missing error branch that leaves state armed).
260
-
261
- ## Out of scope for this slot — do NOT emit these
262
-
263
- This list is the noise control and the anti-overlap boundary with the rest of this prompt set:
264
-
265
- - Dep-array hygiene for its own sake. Only report a dependency when it is the **re-arm key** of a resource left
266
- armed for the wrong identity or the wrong attempt — not a bare "this dep looks missing" observation.
267
- - A theoretical leak with no user-visible consequence and no proven unmount path.
268
- - VALUE unit/domain/guard contradictions — that is the reliability slot's ledger; duplicating it invites dedupe
269
- collapse and destroys miss attribution between slots.
270
- - Retry/idempotency/lock-scope, CI guards, test isolation — those are the resilience slot (cats 5, 6, 7, 11).
271
- Mode 5 is about a latch that survives a re-attempt, not about whether the retry policy itself is correct.
272
- - "This should use an `AbortController`" as a modernization suggestion with no named switch or stall path that
273
- it would actually fix.
274
- - A `try`/`catch` the caller already handles correctly.
275
- - Style, naming, dead code.
276
-
277
- If your ledger yields no reportable cell, return the **complete** `cells` array with `"findings": []` — the empty
278
- result is the findings list, never the table. That is a valid, expected result, and it is
279
- far better than filling the slot with an unrefutable "might leak" claim.
280
-
281
- ## Suspicion priors
282
-
283
- {{PRIORS}}
284
-
285
- Higher weight is more reason to enumerate that file's resources carefully. Never a reason to skip elsewhere.
286
-
287
- ## Gotchas
288
-
289
- {{GOTCHAS}}
290
-
291
- Established facts about this codebase and its tools — several bear directly on arm/disarm/re-arm semantics
292
- (framework lifecycle quirks, library cleanup contracts), which makes them ledger input, not background reading.
293
- They outrank your general expectations.
294
-
295
- ## Output
296
-
297
- Return exactly one JSON object and no prose. It carries **two** arrays, in this order: `cells`, then `findings`.
298
-
299
- ### `cells` — the cross-product, and it is not optional
300
-
301
- One entry per **resource × mode**: exactly **five** entries for every resource you enumerated in Step 1, in mode
302
- order (`switch`, `error`, `early-return`, `stall`, `re-attempt`). A resource with four entries is a malformed
303
- response, not a shorter one. Fill this array **before** you write any finding — that ordering is the whole point:
304
- the cell is what makes you look, and a cell you never wrote is a mode you never checked.
305
-
306
- The example below is deliberately synthetic — a shape to copy, never content to match. Nothing in it describes
307
- the code you are reviewing.
308
-
309
- ```json
310
- {"cells":[{"resource":"isSyncPending","arm_site":"WidgetPanel.tsx:41","mode":"switch","verdict":"defect","note":"deps [widgetId] but the panel is not remounted on a widget change; nothing resets the latch","finding_id":"LC-1"},{"resource":"isSyncPending","arm_site":"WidgetPanel.tsx:41","mode":"error","verdict":"clean","note":"catch at :77 clears it on every rejection the arm can produce","finding_id":null},{"resource":"isSyncPending","arm_site":"WidgetPanel.tsx:41","mode":"early-return","verdict":"incoherent","note":"the arm is the first statement of the handler; no guard precedes it","finding_id":null},{"resource":"isSyncPending","arm_site":"WidgetPanel.tsx:41","mode":"stall","verdict":"unresolved","note":"the awaited call lands in a vendored SDK I could not read, so the sweep is unfinished","finding_id":null},{"resource":"isSyncPending","arm_site":"WidgetPanel.tsx:41","mode":"re-attempt","verdict":"defect","note":"retry at :92 reuses the same widgetId, so the :77 reset never runs before attempt N+1","finding_id":"LC-2"}],"findings":[]}
311
- ```
312
-
313
- - `arm_site` is the `path:line` **inside the diff** where this resource is armed. Every cell carries it, so a
314
- resource the diff arms and you never enumerated is visible by its absence. That omission invalidates the whole
315
- response more surely than any wrong verdict does.
316
- - `verdict` is `defect | clean | incoherent | unresolved`, and each owes a different `note`:
317
- - **`clean`** — cite the disarm that actually FIRES in this mode (`path:line`) and what triggers it. "It looked
318
- fine" is not a clean cell; a clean cell is a claim, and it is refutable like any other. **For mode 4 an
319
- event-driven disarm is never a clean citation on its own** — a hang produces no event, so `onError`, `catch`
320
- and a success handler do not fire. A stall cell is `clean` on exactly two grounds: a **backstop that bounds
321
- the wait**, or a **settlement guarantee** that passes the per-failure-class test in Step 2 — and that second
322
- one is a claim about the guarantee, not about the handler it ends in. Name the failure class, show its
323
- settlement reaching a firing disarm, and state that no remaining class hangs. If a class hangs with no
324
- backstop, the cell is `defect`, whatever the other classes do.
325
- - **`incoherent`** — say why the mode cannot arise for this resource from its own semantics (see the boundary
326
- rules in Step 2). Unreached is **not** incoherent — an unreached mode with an empty cell is a `defect`, and
327
- *Stating reachability* tells you how to report it.
328
- - **`unresolved`** — the mode can arise, you could not finish the check, and you say **what stopped you**: an
329
- owner you could not read, a performer outside every hop you could reach, a sweep left unfinished. This
330
- verdict exists so that "I could not tell" has somewhere honest to go. Use it exactly there and nowhere else —
331
- it is not a resting place for a cell you did not attempt, and a response where most cells are `unresolved` is
332
- a report that the investigation did not happen.
333
- - **`defect`** — no disarm fires and the cell is empty. Put the finding's id in `finding_id`, **or `null` when
334
- the defect is real but this prompt forbids reporting it** — it fails condition (d), or the *Out of scope*
335
- list covers it — and say which in the note. The table records what the code does; `findings` records only
336
- what is worth blocking on. Do not manufacture a finding to justify a cell, and do not downgrade a cell to
337
- `clean` because its finding would be out of scope.
338
- - Every finding must trace back to a `defect` cell. A finding with no cell means you worked from intuition and
339
- skipped the table, which is the failure this array exists to stop.
340
- - `note` is one cited sentence. Keep `clean`, `incoherent` and `unresolved` notes to a citation plus a short
341
- clause; spend your words on `defect` cells and on the findings. **If you are running out of room, shorten
342
- notes — never drop a finding to fit the table.** The table is the evidence of the work; the findings are the
343
- work.
344
- - Enumerating one more resource costs five more cells. That cost is never a reason to enumerate fewer, and if you
345
- catch yourself merging two resources into one row to save cells, split them.
346
- - A complete `cells` array with `"findings": []` is a valid and expected result. An incomplete one is not, no
347
- matter how good the findings are.
348
-
349
- ### `findings`
350
-
351
- ```json
352
- {"findings":[{"id":"LC-1","category":10,"path":"...","line":0,"symbol":"...","severity":"CRITICAL","evidence_class":"deterministic","causal_disposition":"introduced","claim":"...","proof_refs":["arm site path:line","absence anchor path:line"],"hunter":"lifecycle","hops_used":0,"hop_trail":[],"dedupe_key":"path:symbol:category"}]}
353
- ```
354
-
355
- `id` unique within your output (`LC-1`, `LC-2`, …); the orchestrator re-numbers. `category` from the
356
- taxonomy — use **10** for effect/hook lifecycle, **2** for in-flight race/missing cancellation, **1** for stale
357
- mirrored state after a switch, **3** for a missing error branch that leaves state armed. `severity` is
358
- `BLOCKER|CRITICAL|WARNING|SUGGESTION`. `evidence_class` is `deterministic|inferential|insufficient`.
359
- `causal_disposition` is `introduced|behavior-activated|worsened|pre-existing|base-only|unknown`. `hunter` is
360
- always `"lifecycle"` (this slot's schema name). `dedupe_key` is `<path>:<symbol>:<category>`. `claim` states the
361
- unhandled transition in one neutral sentence naming the resource and the mode. Do not include `tier` or
362
- `refuter_verdict`.