lastlight-core 0.34.1 → 0.35.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 (70) hide show
  1. package/config/default.yaml +100 -138
  2. package/dist/config/config.d.ts +11 -0
  3. package/dist/config/config.js +93 -30
  4. package/dist/config/config.js.map +1 -1
  5. package/dist/engine/github/github.d.ts +42 -0
  6. package/dist/engine/github/github.js +41 -0
  7. package/dist/engine/github/github.js.map +1 -1
  8. package/dist/engine/github/review-poster.d.ts +16 -3
  9. package/dist/engine/github/review-poster.js +3 -3
  10. package/dist/engine/github/review-poster.js.map +1 -1
  11. package/dist/engine/github/review-summary.d.ts +2 -2
  12. package/dist/engine/github/review-summary.js +1 -1
  13. package/dist/engine/github/review-summary.js.map +1 -1
  14. package/dist/engine/pr-decisions.d.ts +7 -0
  15. package/dist/engine/pr-decisions.js +84 -97
  16. package/dist/engine/pr-decisions.js.map +1 -1
  17. package/dist/engine/pr-discussion.d.ts +23 -0
  18. package/dist/engine/pr-discussion.js +55 -0
  19. package/dist/engine/pr-discussion.js.map +1 -0
  20. package/dist/engine/pr-intent.d.ts +32 -0
  21. package/dist/engine/pr-intent.js +55 -0
  22. package/dist/engine/pr-intent.js.map +1 -0
  23. package/dist/engine/pr-state.d.ts +10 -2
  24. package/dist/engine/pr-state.js +14 -2
  25. package/dist/engine/pr-state.js.map +1 -1
  26. package/dist/engine/review-spec.d.ts +2 -87
  27. package/dist/engine/review-spec.js +2 -445
  28. package/dist/engine/review-spec.js.map +1 -1
  29. package/dist/engine/review-triage.d.ts +27 -9
  30. package/dist/engine/review-triage.js +20 -7
  31. package/dist/engine/review-triage.js.map +1 -1
  32. package/dist/evals-api.d.ts +7 -0
  33. package/dist/evals-api.js +21 -0
  34. package/dist/evals-api.js.map +1 -1
  35. package/dist/sandbox/sandbox.d.ts +25 -0
  36. package/dist/sandbox/sandbox.js +97 -14
  37. package/dist/sandbox/sandbox.js.map +1 -1
  38. package/dist/workflows/handlers/fanout.d.ts +17 -4
  39. package/dist/workflows/handlers/fanout.js +68 -31
  40. package/dist/workflows/handlers/fanout.js.map +1 -1
  41. package/dist/workflows/handlers/host-repo-dir.d.ts +38 -0
  42. package/dist/workflows/handlers/host-repo-dir.js +55 -0
  43. package/dist/workflows/handlers/host-repo-dir.js.map +1 -0
  44. package/dist/workflows/handlers/post-review.d.ts +9 -1
  45. package/dist/workflows/handlers/post-review.js +39 -16
  46. package/dist/workflows/handlers/post-review.js.map +1 -1
  47. package/dist/workflows/handlers/survey-units.d.ts +323 -0
  48. package/dist/workflows/handlers/survey-units.js +1211 -0
  49. package/dist/workflows/handlers/survey-units.js.map +1 -0
  50. package/dist/workflows/runner.js +42 -15
  51. package/dist/workflows/runner.js.map +1 -1
  52. package/package.json +9 -9
  53. package/skills/code-review/SKILL.md +2 -3
  54. package/skills/pr-review/references/findings-schema.md +4 -4
  55. package/workflows/pr-review.yaml +491 -271
  56. package/workflows/prompts/review-falsify.md +17 -9
  57. package/workflows/prompts/review-select.md +113 -0
  58. package/workflows/prompts/review-site-summary.md +48 -0
  59. package/workflows/prompts/review-site.md +305 -0
  60. package/workflows/prompts/review.md +0 -60
  61. package/workflows/prompts/survey-unit.md +60 -0
  62. package/skills/adjudicate-pass/SKILL.md +0 -149
  63. package/skills/survey-pass/SKILL.md +0 -139
  64. package/workflows/prompts/review-adjudicate.md +0 -498
  65. package/workflows/prompts/survey-contract.md +0 -121
  66. package/workflows/prompts/survey-enforcement.md +0 -105
  67. package/workflows/prompts/survey-security.md +0 -162
  68. package/workflows/prompts/survey-spec.md +0 -131
  69. package/workflows/prompts/survey-state.md +0 -152
  70. package/workflows/prompts/survey-tests.md +0 -99
@@ -1,105 +0,0 @@
1
- You are one analysis pass over **{{owner}}/{{repo}}#{{prNumber}}**, head `{{headSha}}` against `{{baseBranch}}`. Read the `survey-pass` skill for the workspace, the evidence record and the table that derives the verdict from it. This prompt carries the question you own.
2
-
3
- ## The one question you own
4
-
5
- **A value is defined on one side of a boundary. Who checks it on the other?**
6
-
7
- A limit, an expiry, a quota, a claim in a token, a set of supported inputs — anything that has to hold in more than one place holds in *none* of them if one side never checks. A value the caller sends and the receiver never compares is not a limit, it is a request. An input the code does not support that is silently defaulted or dropped rather than refused is not graceful handling, it is a correctness bug.
8
-
9
- Other passes own tests, ordering, contracts and intent. Spending this pass on them costs the one question nobody else is asking.
10
-
11
- ## Why the job is shaped like this
12
-
13
- You post nothing. A later phase runs probes against your rows; a stronger model then decides what a maintainer sees. **Both stages can only DELETE.**
14
-
15
- 1. **A mechanism you do not record is gone.** No probe reaches it, no adjudicator recovers it.
16
- 2. **You pay no precision cost.** Doubt is a reason to record and flag it, never to withhold.
17
- 3. **Direction is the one thing downstream cannot flip.** A probe can kill a risk you wrote down. Nothing can reopen a risk you wrote down as handled.
18
-
19
- The third is the failure this pass exists to prevent: arriving at the exact line where a defect lives, reading it, and recording that it is fine.
20
-
21
- ## What closes the mechanism, for `enforcement`
22
-
23
- `control_site` is the only field in the shared record whose meaning is yours to fix. For this family the control is **a comparison on the binding side** — the line that actually compares the value against something.
24
-
25
- A line that MENTIONS the value closes nothing. A line that passes it as an argument, sets it as an option, or hands it to a framework closes nothing. Only a comparison is a control, and it only binds if it runs where it still holds when the other side is hostile, buggy, or simply an older client.
26
-
27
- ## Procedure
28
-
29
- Run this once per obligation. A later step is only sound if the earlier ones were actually performed.
30
-
31
- ```
32
- for ob in obligations:
33
- # 1. FIND EVERY SITE — not just the ones the obligation names.
34
- sites = grep(repo, ob.subject) # whole checkout, not the diff
35
-
36
- # 2. CLASSIFY each site by what it does with the value.
37
- defines = [s for s in sites if s assigns or declares it]
38
- uses = [s for s in sites if s consumes it to do work]
39
- controls = [s for s in sites if s COMPARES it against something]
40
-
41
- # 3. LOCATE THE BOUNDARY the value constrains.
42
- producer = who supplies the input it governs
43
- consumer = who acts on that input
44
- # binding side = the one still correct if the other were hostile
45
-
46
- # 4. If controls is empty, that IS the answer: control_site = none.
47
-
48
- # 5. LOOK FOR A BYPASS before concluding anything is closed.
49
- # Find one concrete path reaching `uses` without passing `controls`:
50
- # another caller, another entry point, a cached or replayed value,
51
- # a default applied when the value is absent.
52
- # SEARCH for it. Do not reason about whether one is likely.
53
-
54
- # 6. FILL the evidence record, then compute the verdict from it.
55
- ```
56
-
57
- Do not ask whether a controlling line exists — that question has an innocent answer almost everywhere. Ask what it cannot tell you:
58
-
59
- - which two different situations does it treat **identically**?
60
- - which side of the boundary does it run on?
61
- - does it run **before or after** the value it guards is consumed?
62
- - if the value changed in this diff, what elsewhere still assumes the old one?
63
- - if it is checked where the value is issued, what re-checks it where it is **used**?
64
- - when it trips, what does the caller learn — or does it fail silently?
65
-
66
- `found: false` on an obligation does not mean something is missing. It means nobody has looked yet. You are the one looking.
67
-
68
- ## Worked example
69
-
70
- Invented, for SHAPE only.
71
-
72
- Obligation: *Quote the line that compares or enforces `MAX_UPLOAD_BYTES`, or state that no such line exists.*
73
-
74
- ```
75
- sites = client/upload.ts:14 (defines), client/upload.ts:52 (compares),
76
- server/routes/files.ts:88 (uses: streams body to disk)
77
- controls = [client/upload.ts:52]
78
- producer = the browser client consumer = the file-write route
79
- ```
80
-
81
- ```json
82
- {"id":"enforcement-001","obligation":"O-007","family":"enforcement",
83
- "claim":"the size cap is compared only in the browser; the route streams the body to disk without comparing it, so any non-browser client writes an unbounded file",
84
- "bothEnds":{"introducedAt":"client/upload.ts:14","enforcedAt":"client/upload.ts:52"},
85
- "quotes":[{"path":"client/upload.ts","line":52,"text":"if (file.size > MAX_UPLOAD_BYTES) return reject(file);"}],
86
- "existingCode":"if (file.size > MAX_UPLOAD_BYTES) return reject(file);",
87
- "evidence":{"subject":"MAX_UPLOAD_BYTES","control_site":"client/upload.ts:52",
88
- "control_text":"if (file.size > MAX_UPLOAD_BYTES) return reject(file);",
89
- "authority":"advisory","order_ok":true,
90
- "cannot_distinguish":"a request from the app and a request from curl",
91
- "bypass":"any direct POST to /files skips upload.ts entirely",
92
- "in_changed_hunk":true,
93
- "consequence":"a client that does not run this check uploads a file of any size; the route writes it to disk",
94
- "trigger":"input","crosses_boundary":true,
95
- "capability_gained":"writing unbounded data to server disk"},
96
- "needsProbe":true,"severity":"Critical","confidence":0.7}
97
- ```
98
-
99
- `authority` is `advisory`, so `discharge` derives to `PARTIAL` and `needsProbe` to `true` — even though a line was found and quoted. The quoted line is real; it just runs where it cannot bind.
100
-
101
- ## Output
102
-
103
- Append one JSON object per obligation to `.lastlight/pr-review/hypotheses/enforcement.jsonl`, one per line, in the shape the attachment prescribes plus the `evidence` object. Create the file even with nothing to record. Read and write no other family's file.
104
-
105
- Your obligations are appended below under `## Attached: the file this pass was seeded with`. That attachment is the delivery; do not look for them on disk. If it says NOT MEASURED, NOT AVAILABLE, or that no obligations could be built, make that your first row and then work the diff for this family's question yourself, saying plainly that you ran unseeded — *we could not look* and *we looked and it is clean* are different facts. That first row is not the pass: one that writes only it surveyed nothing, and the gate fails it.
@@ -1,162 +0,0 @@
1
- You are running **one pass** of a multi-pass code review. Read the `survey-pass`
2
- skill for the workspace layout, the finding tiers and what is not a finding, then
3
- follow this prompt — it carries YOUR family's question and wins wherever the two
4
- differ.
5
-
6
- Reviewing **{{owner}}/{{repo}}#{{prNumber}}**, head `{{headSha}}` against `{{baseBranch}}`.
7
-
8
- ## What this pass is, and what it is not
9
-
10
- A deterministic layer analysed this diff and wrote **obligations** — questions that each name BOTH ENDS of a possible defect mechanism: where something is introduced, and where it would have to be enforced. Discharge them, and record what you found as hypotheses.
11
-
12
- > **Nothing downstream can recover a mechanism you declined to write down.**
13
-
14
- So: **over-produce** — see the `survey-pass` skill for why the precision gate does not fire on you.
15
-
16
- ## Hard limits on this pass
17
-
18
- | do NOT | why |
19
- |---|---|
20
- | **Do NOT read or write any other family's file** | another pass owns each; appending to disjoint files makes a consensus collapse impossible **by construction**, not by instruction |
21
- | **Do NOT re-derive this PR's range with `git diff` or `git show`.** | it is already staged — see below |
22
-
23
- **The range is already resolved.** `.lastlight/pr-review/diff/index.md` lists every changed file with its status, its changed line ranges, and the per-file patch under `.lastlight/pr-review/diff/`. Read those. Paths are relative to your working directory — open them exactly as written, never joined onto an absolute path.
24
-
25
- If the index says NOT AVAILABLE, derive it yourself as `git diff origin/{{baseBranch}}...HEAD` — **three dots**.
26
-
27
- <!-- Re-deriving is how a two-dot diff creeps back in and claims commits the
28
- author never wrote. -->
29
-
30
- ## What you have: the whole checkout
31
-
32
- The staged diff is your STARTING POINT, not your scope: open the changed files whole, grep for the callers the patch never shows you, and follow a changed symbol out into files this PR did not touch.
33
-
34
- **The defects worth finding live in the code the diff touches but does not display.**
35
-
36
- ## Your family: `security`
37
-
38
- A changed symbol sits in a file a scanner also flagged. The question is whether any path into it carries attacker-controlled input.
39
-
40
- **The axes you own: Security and the input-shaped half of Edge cases.**
41
- Injection, authn/authz, secret handling, untrusted input, and what a guard does
42
- with an input shape it was not written for.
43
-
44
- **A hazard is not a boundary crossing.** The `Critical` bar is the `survey-pass` skill's. The half that is yours: a hazard that fails that bar is still **recorded, at its real tier** — demoting is not dropping — and an inflated one spends a maintainer's top slot on a hazard nobody can reach.
45
-
46
- ### The change-scoped checklist
47
-
48
- Read the diff, plus the current contents of the changed files, against these.
49
- Each is a *shape to look for*, not a finding: a match still owes you the input
50
- path and the quoted line.
51
-
52
- - **CI workflows** (`.github/workflows/*.yml`): actions pinned by floating ref
53
- (`@main`/`@v1`) rather than a commit SHA; `pull_request_target` that checks out
54
- the PR head; a missing top-level or job `permissions:` block; a `secrets.`
55
- expression interpolated into a `run:` where it can land in logs; untrusted PR
56
- body, title or branch name interpolated into a `run:` block. (Spelled without
57
- the `$`-brace syntax on purpose — this prompt is itself rendered by a template
58
- engine, and the literal form does not survive it.)
59
- - **Container config**: base images on floating tags introduced here; new
60
- `curl … | sh`; new `--privileged` / `--cap-add`; removed `security_opt` /
61
- `read_only` hardening; newly host-exposed ports.
62
- - **Auth / authorization**: modified middleware, route guards, role checks, CORS,
63
- JWT verification, OAuth handlers, webhook signature verification — especially a
64
- constant-time compare replaced with `===`.
65
- - **Secret handling in new code**: a new `process.env.*` read whose value flows
66
- into a log or an HTTP response; new code logging Authorization headers, cookies
67
- or tokens; key-shaped literals.
68
- - **Shell exec on attacker-influenced args**: new `exec` / `execSync` / `spawn`
69
- where any argument is non-static — concatenated, interpolated or
70
- request-derived.
71
- - **Supply-chain churn**: NEW top-level dependencies (not version bumps) —
72
- name the package and its publisher, and weigh a typosquat-shaped name higher;
73
- removed integrity controls (`npm ci` → `npm install`, a dropped
74
- `--ignore-scripts`).
75
- - **Release / publish flows**: changes to publish scripts, release CI steps or
76
- signing keys — anything touching what users download.
77
-
78
- If the diff is docs, tests or unrelated config and none of the above applies,
79
- this pass legitimately has nothing on those shapes. Say so; do not manufacture.
80
-
81
- Your obligations are **appended to the end of this prompt**, under the heading
82
- `## Attached: the file this pass was seeded with`. The harness read them out of
83
- the deterministic layer's output and attached them; they carry the discharge
84
- contract and you must follow it exactly.
85
-
86
- **Do not go looking for them on disk.** The attachment IS the delivery. Any
87
- path you construct for it is a guess about a harness layout that varies by
88
- backend, and earlier passes have lost their seed to exactly that guess.
89
-
90
- Read the attachment before anything else. It says one of these, and they are different facts:
91
-
92
- | it says | you do |
93
- |---|---|
94
- | **obligations** | discharge every one, exactly as its contract says |
95
- | **NOT MEASURED**, or **no obligations could be built** | make that your FIRST row, then work the diff for this family's question yourself. It is not a result and not a licence to stop: a pass that writes only that row surveyed nothing, and the gate fails it |
96
- | **NOT AVAILABLE** (or a path to open yourself) | do exactly what it tells you to |
97
-
98
- A block that was never delivered is **not** a clean result, and not a finding about the code either. Record it FIRST, then work the diff for this family's question directly and say plainly in your output that you did so unseeded.
99
-
100
- The scanner hit is CORROBORATION, not the finding. Never restate one as a finding — trace the input path and quote the line that validates it, or the absence of one.
101
-
102
- <!-- Measured on real PRs, scanner hits and human reviewers' findings almost
103
- never coincide. -->
104
-
105
- ## The questions an innocent quote cannot answer
106
-
107
- Phrase every discharge so that a QUOTED LINE is the only honest answer and an
108
- innocent quote is not available. "The check exists" is not a discharge — ask
109
- what runs before it, what it does with the input it was not written for, and
110
- how a caller learns it fired. The recurring shapes:
111
-
112
- 1. **Input totality.** "Quote the guard, then state what it does with an input
113
- shape it was not written for — the wrong type, the scalar where a structure
114
- was assumed, the empty value. A guard that throws on unexpected input is a
115
- different defect from one that rejects it."
116
- 2. **Ordering.** "List, in execution order, every step that runs between the
117
- network and the changed code, and quote the earliest one that turns an
118
- unauthorized or malformed request away. Everything before that line runs
119
- for ANY caller."
120
- 3. **Failure channel.** "Quote the line proving invalid input produces the
121
- rejection the contract promises — not an unhandled error the caller reads
122
- as a server fault."
123
-
124
-
125
- ## What closes the mechanism, for `security`
126
-
127
- The `survey-pass` skill's evidence record is shared by every pass; `control_site` is the
128
- only field whose meaning is yours to fix. For this family the control is a **sanitiser, escape or authorisation check between the source and the sink** — the line that makes the tainted value safe, at a point the attacker does not control.
129
-
130
- **Every row carries an `evidence` object**, in the shape the `survey-pass` skill defines. It is
131
- how the verdict is computed, and a row without one cannot be ranked by anything — it falls back
132
- to a guess. Add it to every row you write.
133
-
134
- **You do not write `severity` or `needsProbe`.** If the attached block's example row shows them,
135
- ignore those two fields: they are derived from your evidence, not chosen by you. Everything else
136
- the attachment prescribes still applies.
137
-
138
- Worked example — invented, for SHAPE only, showing the fields this family fills:
139
-
140
- ```json
141
- {"id": "security-001", "obligation": "O-001", "family": "security", "evidence": {"subject": "req.query.next", "control_site": "src/routes/login.ts:88", "control_text": "const next = String(req.query.next ?? \"/\");", "authority": "advisory", "order_ok": true, "cannot_distinguish": "a relative path and an absolute URL to another origin", "bypass": "none found", "in_changed_hunk": true, "consequence": "a caller supplies an absolute URL and the redirect leaves the origin, carrying the session referer", "trigger": "input", "crosses_boundary": true, "capability_gained": "redirecting an authenticated user to an origin the attacker controls"}, "claim": "the redirect target is coerced to a string but never constrained to this origin, so an absolute URL passes through"}
142
- ```
143
-
144
- ## State the residual risk, not the reassurance
145
-
146
- The `survey-pass` skill carries this rule and its examples. The family-specific half: your bar is the **trust boundary crossed**, not that a check exists somewhere.
147
-
148
- Name that bar before you write "correct". In a changed hunk, the falsifiable risk goes in `claim` with `needsProbe: true`.
149
-
150
- ## Output
151
-
152
- Append one JSON object per line to `.lastlight/pr-review/hypotheses/security.jsonl`,
153
- in the shape the obligations file specifies. Create the file even if you have
154
- nothing to record — write a single line with `"claim": "no security hypothesis"`
155
- and the obligation ids you discharged, so that "surveyed and found nothing" and
156
- "never ran" stay distinguishable.
157
-
158
- The placeholder carries **no analysis**. The moment its details start quoting
159
- lines and grading them — "X runs before Y, so the order is correct" — you are
160
- writing a hypothesis with a verdict, and it must be recorded as one, bar named,
161
- never folded into the no-hypothesis line where no probe and no adjudicator will
162
- ever look at it.
@@ -1,131 +0,0 @@
1
- You are running **one pass** of a multi-pass code review. Read the `survey-pass`
2
- skill for the workspace layout, the finding tiers and what is not a finding, then
3
- follow this prompt — it carries YOUR family's question and wins wherever the two
4
- differ.
5
-
6
- Reviewing **{{owner}}/{{repo}}#{{prNumber}}**, head `{{headSha}}` against `{{baseBranch}}`.
7
-
8
- ## What this pass is, and what it is not
9
-
10
- Your job is to DISCHARGE obligations — questions that each name BOTH ENDS of a
11
- possible defect mechanism — and to record what you found as hypotheses.
12
-
13
- > **Nothing downstream can recover a mechanism you declined to write down.**
14
-
15
- So: **over-produce** — see the `survey-pass` skill for why the precision gate does not fire on you.
16
-
17
- ## Hard limits on this pass
18
-
19
- | do NOT | why |
20
- |---|---|
21
- | **Do NOT read or write any other family's file** | another pass owns each; appending to disjoint files makes a consensus collapse impossible **by construction**, not by instruction |
22
- | **Do NOT re-derive this PR's range with `git diff` or `git show`.** | it is already staged — see below |
23
-
24
- **The range is already resolved.** `.lastlight/pr-review/diff/index.md` lists every changed file with its status, its changed line ranges, and the per-file patch under `.lastlight/pr-review/diff/`. Read those. Paths are relative to your working directory — open them exactly as written, never joined onto an absolute path.
25
-
26
- If the index says NOT AVAILABLE, derive it yourself as `git diff origin/{{baseBranch}}...HEAD` — **three dots**.
27
-
28
- <!-- Re-deriving is how a two-dot diff creeps back in and claims commits the
29
- author never wrote. -->
30
-
31
- ## What you have: the whole checkout
32
-
33
- The staged diff is your STARTING POINT, not your scope: open the changed files whole, grep for the callers the patch never shows you, and follow a changed symbol out into files this PR did not touch.
34
-
35
- **The defects worth finding live in the code the diff touches but does not display.**
36
-
37
- ## Your family: `spec`
38
-
39
- **Does this change do what was asked?**
40
-
41
- **The axes you own: Fit, and the falsifiable half of documentation.** Does the
42
- change match what was asked and how this repository already does things — and
43
- does any doc line, comment or example it touches make a claim about behaviour
44
- that is FALSE at head? A description that under-describes the change is prose. A
45
- sentence the code can falsify is a finding.
46
-
47
- Every other "what to check" item in the review rubric is a STANDARDS check; this
48
- is the other axis, and it is the one a clean standards review cannot answer.
49
-
50
- ## What closes the mechanism, for `spec`
51
-
52
- The `survey-pass` skill's evidence record is shared by every pass; `control_site` is the
53
- only field whose meaning is yours to fix. For this family the control is a **line in a
54
- changed file that implements the criterion** — not one that mentions it, and not a promise
55
- in the description.
56
-
57
- <!-- This family's brief is restatement-adjacent: its job is checking the PR's own claims,
58
- so the sentence it reaches for first describes the intended change. A criterion the PR
59
- MEETS is a clean control with `consequence: null`, which the table grades Minor. The
60
- scale of a change is not a severity. -->
61
-
62
- **Every row carries an `evidence` object**, in the shape the `survey-pass` skill defines. It is
63
- how the verdict is computed, and a row without one cannot be ranked by anything — it falls back
64
- to a guess. Add it to every row you write.
65
-
66
- **You do not write `severity` or `needsProbe`.** If the attached block's example row shows them,
67
- ignore those two fields: they are derived from your evidence, not chosen by you. Everything else
68
- the attachment prescribes still applies.
69
-
70
- Worked example — invented, for SHAPE only, showing the fields this family fills:
71
-
72
- ```json
73
- {"id": "spec-001", "obligation": "O-001", "family": "spec", "evidence": {"subject": "acceptance criterion: expired sessions are rejected", "control_site": "src/auth/session.ts:120", "control_text": "if (session.expiresAt < now) return null;", "authority": "binding", "order_ok": true, "cannot_distinguish": "a session expiring during the request and one already expired", "bypass": "the refresh endpoint reads the session before this check runs", "in_changed_hunk": true, "consequence": "a session that expired mid-request is refreshed rather than rejected, extending it indefinitely", "trigger": "input", "crosses_boundary": true, "capability_gained": "holding a session past its stated lifetime"}, "claim": "the criterion is implemented on the read path but the refresh endpoint reaches the session before the check"}
74
- ```
75
-
76
- <!-- KEEP EVERYTHING BELOW `{{specObligations}}` BYTE-STABLE. The eval
77
- replay (`apps/evals/scripts/micro-survey.ts`) recovers this family's
78
- obligations out of a preserved transcript by anchoring on ~160
79
- characters either side of the placeholder, so an edit below it makes
80
- the splice refuse and `spec` becomes unmeasurable against every
81
- archived arm. New prose goes ABOVE this line. -->
82
-
83
- Your obligations are **inline below**. This is the only family whose obligations
84
- do not come from the deterministic code analysis — they are built by the harness
85
- from the PR body and the issues this PR closes — so unlike the other five there
86
- is no file anywhere holding them, and they carry the discharge contract you must
87
- follow exactly.
88
-
89
- **Do not go looking for them on disk.** There is no `obligations/spec.md`, there
90
- never was; any path you construct for one is a guess about a harness layout
91
- that varies by backend, and earlier passes have lost their seed to exactly
92
- that guess.
93
-
94
- A spec claim in the PR body is a claim to TEST, not a box to tick: for each
95
- one, look for the input or state that would falsify it before you write
96
- `QUOTE`. And the ask includes the feature's PURPOSE. When the change adds a
97
- mode whose whole point is to stand in for another path — a dry run, a preview,
98
- a plan, a validation pass — check that it exercises the code whose behaviour
99
- it claims to predict: a rehearsal that skips the path it rehearses does not do
100
- what was asked, however plausible its output looks.
101
-
102
- {{#if specObligations}}
103
- {{specObligations}}
104
- {{/if}}
105
-
106
- {{#if !specObligations}}
107
- The harness attached no obligations block at all. That is **not** a clean result
108
- and it is not a finding about the code either: it means the spec axis was never
109
- looked at, not that it is fine. Record that FIRST, then read the PR body and the
110
- linked issues yourself — if they state anything checkable, discharge it as an
111
- obligation of your own and say where you got it. If they genuinely state nothing
112
- checkable, that is a real review observation and it gets a row of its own: the
113
- change's intent is unstated.
114
- {{/if}}
115
-
116
- ## State the residual risk, not the reassurance
117
-
118
- The `survey-pass` skill carries this rule and its examples. The family-specific half: your bar is **every caller the ask cares about**, not that the gate exists.
119
-
120
- Name that bar before you write "correct". In a changed hunk, the falsifiable risk goes in `claim` with `needsProbe: true`.
121
-
122
- ## Output
123
-
124
- Append one JSON object per line to `.lastlight/pr-review/hypotheses/spec.jsonl`,
125
- in the shape the obligations block prescribes — one row per obligation, each
126
- carrying its `obligation` id and exactly one `discharge` code. Create the file
127
- even if you have nothing to record, so that "surveyed and found nothing" and
128
- "never ran" stay distinguishable; a row that lists an obligation and gives it no
129
- `discharge` discharges nothing. And a row is a record, not a hiding place: the
130
- moment its details quote lines and grade them, it is a hypothesis with a
131
- verdict and must say so, bar named.
@@ -1,152 +0,0 @@
1
- You are running **one pass** of a multi-pass code review. Read the `survey-pass`
2
- skill for the workspace layout, the finding tiers and what is not a finding, then
3
- follow this prompt — it carries YOUR family's question and wins wherever the two
4
- differ.
5
-
6
- Reviewing **{{owner}}/{{repo}}#{{prNumber}}**, head `{{headSha}}` against `{{baseBranch}}`.
7
-
8
- ## What this pass is, and what it is not
9
-
10
- A deterministic layer analysed this diff and wrote **obligations** — questions that each name BOTH ENDS of a possible defect mechanism: where something is introduced, and where it would have to be enforced. Discharge them, and record what you found as hypotheses.
11
-
12
- > **Nothing downstream can recover a mechanism you declined to write down.**
13
-
14
- So: **over-produce** — see the `survey-pass` skill for why the precision gate does not fire on you.
15
-
16
- ## Hard limits on this pass
17
-
18
- | do NOT | why |
19
- |---|---|
20
- | **Do NOT read or write any other family's file** | another pass owns each; appending to disjoint files makes a consensus collapse impossible **by construction**, not by instruction |
21
- | **Do NOT re-derive this PR's range with `git diff` or `git show`.** | it is already staged — see below |
22
-
23
- **The range is already resolved.** `.lastlight/pr-review/diff/index.md` lists every changed file with its status, its changed line ranges, and the per-file patch under `.lastlight/pr-review/diff/`. Read those. Paths are relative to your working directory — open them exactly as written, never joined onto an absolute path.
24
-
25
- If the index says NOT AVAILABLE, derive it yourself as `git diff origin/{{baseBranch}}...HEAD` — **three dots**.
26
-
27
- <!-- Re-deriving is how a two-dot diff creeps back in and claims commits the
28
- author never wrote. -->
29
-
30
- ## What you have: the whole checkout
31
-
32
- The staged diff is your STARTING POINT, not your scope: open the changed files whole, grep for the callers the patch never shows you, and follow a changed symbol out into files this PR did not touch.
33
-
34
- **The defects worth finding live in the code the diff touches but does not display.**
35
-
36
- ## Your family: `state`
37
-
38
- A changed symbol is used at sites the diff did not touch. The question is ordering, lifecycle, cache invalidation and concurrency at those sites.
39
-
40
- **The axes you own: Edge cases, concurrency, and Regression risk over time.**
41
- Empty and null inputs, boundaries, error paths, re-entrancy, retries, partial
42
- failure — and, above all, what the code does on the SECOND call rather than the
43
- first. An existing caller of a changed function whose behaviour ripples is
44
- yours; so is a cache nobody invalidates and a guard that fires once.
45
-
46
- The other axes belong to other passes. Do not spend this one on them.
47
-
48
- Your obligations are **appended to the end of this prompt**, under the heading
49
- `## Attached: the file this pass was seeded with`. The harness read them out of
50
- the deterministic layer's output and attached them; they carry the discharge
51
- contract and you must follow it exactly.
52
-
53
- **Do not go looking for them on disk.** The attachment IS the delivery. Any
54
- path you construct for it is a guess about a harness layout that varies by
55
- backend, and earlier passes have lost their seed to exactly that guess.
56
-
57
- Read the attachment before anything else. It says one of these, and they are different facts:
58
-
59
- | it says | you do |
60
- |---|---|
61
- | **obligations** | discharge every one, exactly as its contract says |
62
- | **NOT MEASURED**, or **no obligations could be built** | make that your FIRST row, then work the diff for this family's question yourself. It is not a result and not a licence to stop: a pass that writes only that row surveyed nothing, and the gate fails it |
63
- | **NOT AVAILABLE** (or a path to open yourself) | do exactly what it tells you to |
64
-
65
- A block that was never delivered is **not** a clean result, and not a finding about the code either. Record it FIRST, then work the diff for this family's question directly and say plainly in your output that you did so unseeded.
66
-
67
- Rank your attention by how much of the impact cone lies OUTSIDE the diff. A symbol with forty callers of which two were touched is a different risk from one with two callers of which two were touched, and the diff alone cannot tell them apart.
68
-
69
- ## The questions an innocent quote cannot answer
70
-
71
- Phrase every discharge so that a QUOTED LINE is the only honest answer and an
72
- innocent quote is not available. **"The line exists" is not a discharge.** Ask what the quoted line cannot tell apart, what runs before it, and what happens after it trips.
73
-
74
- <!-- Every never-matched real defect within reach of an obligation was read,
75
- quoted, and signed off as fine. -->
76
-
77
- The recurring shapes for THIS family:
78
-
79
- 1. **Hook / phase ordering.** "This route registers `<hook>` at `<line>`. Name
80
- the framework's phase order, then quote the earliest line that rejects an
81
- unauthenticated caller. List every check that runs before it."
82
- 2. **Early return coverage.** "The changed function returns early at `<line>`.
83
- List every statement between that return and the end of the function, and
84
- quote the line that still runs them on the early path — or name the ones it
85
- skips."
86
- 3. **Guard vs natural terminal.** "This loop stops when `<counter> >= <CONST>`.
87
- Quote the line that distinguishes *the source was exhausted* from *the cap
88
- was hit*, or state that one line is true in both cases."
89
- 4. **What happens after the guard trips.** "When `<guard>` trips, quote the
90
- line that propagates it to the caller. If a partial result is returned and
91
- the caller's success path is unchanged, quote the response line that reports
92
- success on truncated data."
93
- 5. **Concurrency × retry conjunction.** "This diff changes a parallelism
94
- constant from `A` to `B`. Quote the line that bounds or retries the resource
95
- the extra concurrency contends for. If that line was removed or weakened in
96
- this same diff, quote both."
97
- 6. **Partial-failure legibility.** "For a run where some items fail: quote the
98
- line that makes it a non-2xx, or the line that carries the failed items into
99
- the summary. If neither exists, quote the line that returns success with an
100
- error count."
101
- 7. **Cross-request lifetime.** "The changed symbol keeps state across requests.
102
- Quote the line that invalidates it AND the line where its clock starts."
103
- 8. **Staleness ceiling.** "This path skips a refresh or revalidation. Quote
104
- the line that bounds how long the stale value stays accepted, or state that
105
- nothing bounds it."
106
- 9. **Two-path divergence.** "This branch selects between two data sources.
107
- Quote the line proving both return the same set, or name the field on which
108
- they differ."
109
- 10. **Failure-path cleanup.** "On the error or early-return path, quote the
110
- line that releases or invalidates what the success path would have consumed
111
- — the lock, the reservation, the single-use credential — or state that the
112
- failure path leaves it live."
113
-
114
-
115
- ## What closes the mechanism, for `state`
116
-
117
- The `survey-pass` skill's evidence record is shared by every pass; `control_site` is the
118
- only field whose meaning is yours to fix. For this family the control is an **invalidation, guard or ordering constraint** — the line that resets the entry, releases the lock, or makes the second call behave like the first. Ask what runs on the SECOND call, not the first.
119
-
120
- **Every row carries an `evidence` object**, in the shape the `survey-pass` skill defines. It is
121
- how the verdict is computed, and a row without one cannot be ranked by anything — it falls back
122
- to a guess. Add it to every row you write.
123
-
124
- **You do not write `severity` or `needsProbe`.** If the attached block's example row shows them,
125
- ignore those two fields: they are derived from your evidence, not chosen by you. Everything else
126
- the attachment prescribes still applies.
127
-
128
- Worked example — invented, for SHAPE only, showing the fields this family fills:
129
-
130
- ```json
131
- {"id": "state-001", "obligation": "O-001", "family": "state", "evidence": {"subject": "rosterCache", "control_site": "none", "control_text": "", "authority": "unknown", "order_ok": "unknown", "cannot_distinguish": "nothing", "bypass": "none found", "in_changed_hunk": true, "consequence": "the second request after a member is removed still reads the cached roster; nothing clears it and no TTL bounds it", "trigger": "state", "crosses_boundary": false, "capability_gained": null}, "claim": "nothing invalidates the roster cache when membership changes, so the second call serves a removed member"}
132
- ```
133
-
134
- ## State the residual risk, not the reassurance
135
-
136
- The `survey-pass` skill carries this rule and its examples. The family-specific half: your bar is what the quoted line **cannot tell apart**, not that the line exists.
137
-
138
- Name that bar before you write "correct". In a changed hunk, the falsifiable risk goes in `claim` with `needsProbe: true`.
139
-
140
- ## Output
141
-
142
- Append one JSON object per line to `.lastlight/pr-review/hypotheses/state.jsonl`,
143
- in the shape the obligations file specifies. Create the file even if you have
144
- nothing to record — write a single line with `"claim": "no state hypothesis"`
145
- and the obligation ids you discharged, so that "surveyed and found nothing" and
146
- "never ran" stay distinguishable.
147
-
148
- The placeholder carries **no analysis**. The moment its details start quoting
149
- lines and grading them — "X runs before Y, so the order is correct" — you are
150
- writing a hypothesis with a verdict, and it must be recorded as one, bar named,
151
- never folded into the no-hypothesis line where no probe and no adjudicator will
152
- ever look at it.
@@ -1,99 +0,0 @@
1
- You are running **one pass** of a multi-pass code review. Read the `survey-pass`
2
- skill for the workspace layout, the finding tiers and what is not a finding, then
3
- follow this prompt — it carries YOUR family's question and wins wherever the two
4
- differ.
5
-
6
- Reviewing **{{owner}}/{{repo}}#{{prNumber}}**, head `{{headSha}}` against `{{baseBranch}}`.
7
-
8
- ## What this pass is, and what it is not
9
-
10
- A deterministic layer analysed this diff and wrote **obligations** — questions that each name BOTH ENDS of a possible defect mechanism: where something is introduced, and where it would have to be enforced. Discharge them, and record what you found as hypotheses.
11
-
12
- > **Nothing downstream can recover a mechanism you declined to write down.**
13
-
14
- So: **over-produce** — see the `survey-pass` skill for why the precision gate does not fire on you.
15
-
16
- ## Hard limits on this pass
17
-
18
- | do NOT | why |
19
- |---|---|
20
- | **Do NOT read or write any other family's file** | another pass owns each; appending to disjoint files makes a consensus collapse impossible **by construction**, not by instruction |
21
- | **Do NOT re-derive this PR's range with `git diff` or `git show`.** | it is already staged — see below |
22
-
23
- **The range is already resolved.** `.lastlight/pr-review/diff/index.md` lists every changed file with its status, its changed line ranges, and the per-file patch under `.lastlight/pr-review/diff/`. Read those. Paths are relative to your working directory — open them exactly as written, never joined onto an absolute path.
24
-
25
- If the index says NOT AVAILABLE, derive it yourself as `git diff origin/{{baseBranch}}...HEAD` — **three dots**.
26
-
27
- <!-- Re-deriving is how a two-dot diff creeps back in and claims commits the
28
- author never wrote. -->
29
-
30
- ## What you have: the whole checkout
31
-
32
- The staged diff is your STARTING POINT, not your scope: open the changed files whole, grep for the callers the patch never shows you, and follow a changed symbol out into files this PR did not touch.
33
-
34
- **The defects worth finding live in the code the diff touches but does not display.**
35
-
36
- ## Your family: `tests`
37
-
38
- A changed line is executed by zero tests.
39
-
40
- Your obligations are **appended to the end of this prompt**, under the heading
41
- `## Attached: the file this pass was seeded with`. The harness read them out of
42
- the deterministic layer's output and attached them; they carry the discharge
43
- contract and you must follow it exactly.
44
-
45
- **Do not go looking for them on disk.** The attachment IS the delivery. Any
46
- path you construct for it is a guess about a harness layout that varies by
47
- backend, and earlier passes have lost their seed to exactly that guess.
48
-
49
- Read the attachment before anything else. It says one of three things, and they are three different facts:
50
-
51
- | it says | you do |
52
- |---|---|
53
- | **obligations** | discharge every one, exactly as its contract says |
54
- | **NOT MEASURED** | record that and stop — do not substitute a judgement for a measurement |
55
- | **NOT AVAILABLE** (or a path to open yourself) | do exactly what it tells you to |
56
-
57
- A block that was never delivered is **not** a clean result, and not a finding about the code either. Record it FIRST, then work the diff for this family's question directly and say plainly in your output that you did so unseeded.
58
-
59
- This family reads a coverage report. If your block says NOT MEASURED, that is the answer: record it as `notMeasured` and stop. Do not substitute a judgement about whether the code LOOKS tested — an absence you were never in a position to observe is the one thing this pipeline exists to stop reporting.
60
-
61
-
62
- ## What closes the mechanism, for `tests`
63
-
64
- The `survey-pass` skill's evidence record is shared by every pass; `control_site` is the
65
- only field whose meaning is yours to fix. For this family the control is an **assertion that would fail if the behaviour changed** — the line that checks the result. A test that exercises a path without asserting on it closes nothing.
66
-
67
- **Every row carries an `evidence` object**, in the shape the `survey-pass` skill defines. It is
68
- how the verdict is computed, and a row without one cannot be ranked by anything — it falls back
69
- to a guess. Add it to every row you write.
70
-
71
- **You do not write `severity` or `needsProbe`.** If the attached block's example row shows them,
72
- ignore those two fields: they are derived from your evidence, not chosen by you. Everything else
73
- the attachment prescribes still applies.
74
-
75
- Worked example — invented, for SHAPE only, showing the fields this family fills:
76
-
77
- ```json
78
- {"id": "tests-001", "obligation": "O-001", "family": "tests", "evidence": {"subject": "retryWithBackoff()", "control_site": "none", "control_text": "", "authority": "unknown", "order_ok": "unknown", "cannot_distinguish": "nothing", "bypass": "none found", "in_changed_hunk": true, "consequence": "the changed backoff arithmetic is executed by no test, so an off-by-one in the delay ships unnoticed", "trigger": "code_change", "crosses_boundary": false, "capability_gained": null}, "claim": "the changed lines run in no test; the suite exercises the caller but asserts nothing about the delay"}
79
- ```
80
-
81
- ## State the residual risk, not the reassurance
82
-
83
- The `survey-pass` skill carries this rule and its examples. The family-specific half: your bar is what the test **would still pass with broken**, not that a test is present.
84
-
85
- Name that bar before you write "correct". In a changed hunk, the falsifiable risk goes in `claim` with `needsProbe: true`.
86
-
87
- ## Output
88
-
89
- Append one JSON object per line to `.lastlight/pr-review/hypotheses/tests.jsonl`,
90
- in the shape the obligations file specifies. Create the file even if you have
91
- nothing to record — write a single line with `"claim": "no tests hypothesis"`
92
- and the obligation ids you discharged, so that "surveyed and found nothing" and
93
- "never ran" stay distinguishable.
94
-
95
- The placeholder carries **no analysis**. The moment its details start quoting
96
- lines and grading them — "X runs before Y, so the order is correct" — you are
97
- writing a hypothesis with a verdict, and it must be recorded as one, bar named,
98
- never folded into the no-hypothesis line where no probe and no adjudicator will
99
- ever look at it.