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.
- package/config/default.yaml +100 -138
- package/dist/config/config.d.ts +11 -0
- package/dist/config/config.js +93 -30
- package/dist/config/config.js.map +1 -1
- package/dist/engine/github/github.d.ts +42 -0
- package/dist/engine/github/github.js +41 -0
- package/dist/engine/github/github.js.map +1 -1
- package/dist/engine/github/review-poster.d.ts +16 -3
- package/dist/engine/github/review-poster.js +3 -3
- package/dist/engine/github/review-poster.js.map +1 -1
- package/dist/engine/github/review-summary.d.ts +2 -2
- package/dist/engine/github/review-summary.js +1 -1
- package/dist/engine/github/review-summary.js.map +1 -1
- package/dist/engine/pr-decisions.d.ts +7 -0
- package/dist/engine/pr-decisions.js +84 -97
- package/dist/engine/pr-decisions.js.map +1 -1
- package/dist/engine/pr-discussion.d.ts +23 -0
- package/dist/engine/pr-discussion.js +55 -0
- package/dist/engine/pr-discussion.js.map +1 -0
- package/dist/engine/pr-intent.d.ts +32 -0
- package/dist/engine/pr-intent.js +55 -0
- package/dist/engine/pr-intent.js.map +1 -0
- package/dist/engine/pr-state.d.ts +10 -2
- package/dist/engine/pr-state.js +14 -2
- package/dist/engine/pr-state.js.map +1 -1
- package/dist/engine/review-spec.d.ts +2 -87
- package/dist/engine/review-spec.js +2 -445
- package/dist/engine/review-spec.js.map +1 -1
- package/dist/engine/review-triage.d.ts +27 -9
- package/dist/engine/review-triage.js +20 -7
- package/dist/engine/review-triage.js.map +1 -1
- package/dist/evals-api.d.ts +7 -0
- package/dist/evals-api.js +21 -0
- package/dist/evals-api.js.map +1 -1
- package/dist/sandbox/sandbox.d.ts +25 -0
- package/dist/sandbox/sandbox.js +97 -14
- package/dist/sandbox/sandbox.js.map +1 -1
- package/dist/workflows/handlers/fanout.d.ts +17 -4
- package/dist/workflows/handlers/fanout.js +68 -31
- package/dist/workflows/handlers/fanout.js.map +1 -1
- package/dist/workflows/handlers/host-repo-dir.d.ts +38 -0
- package/dist/workflows/handlers/host-repo-dir.js +55 -0
- package/dist/workflows/handlers/host-repo-dir.js.map +1 -0
- package/dist/workflows/handlers/post-review.d.ts +9 -1
- package/dist/workflows/handlers/post-review.js +39 -16
- package/dist/workflows/handlers/post-review.js.map +1 -1
- package/dist/workflows/handlers/survey-units.d.ts +323 -0
- package/dist/workflows/handlers/survey-units.js +1211 -0
- package/dist/workflows/handlers/survey-units.js.map +1 -0
- package/dist/workflows/runner.js +42 -15
- package/dist/workflows/runner.js.map +1 -1
- package/package.json +9 -9
- package/skills/code-review/SKILL.md +2 -3
- package/skills/pr-review/references/findings-schema.md +4 -4
- package/workflows/pr-review.yaml +491 -271
- package/workflows/prompts/review-falsify.md +17 -9
- package/workflows/prompts/review-select.md +113 -0
- package/workflows/prompts/review-site-summary.md +48 -0
- package/workflows/prompts/review-site.md +305 -0
- package/workflows/prompts/review.md +0 -60
- package/workflows/prompts/survey-unit.md +60 -0
- package/skills/adjudicate-pass/SKILL.md +0 -149
- package/skills/survey-pass/SKILL.md +0 -139
- package/workflows/prompts/review-adjudicate.md +0 -498
- package/workflows/prompts/survey-contract.md +0 -121
- package/workflows/prompts/survey-enforcement.md +0 -105
- package/workflows/prompts/survey-security.md +0 -162
- package/workflows/prompts/survey-spec.md +0 -131
- package/workflows/prompts/survey-state.md +0 -152
- package/workflows/prompts/survey-tests.md +0 -99
|
@@ -59,7 +59,7 @@ There are four verdicts, strongest evidence first:
|
|
|
59
59
|
| `refuted` | you ran something that WOULD have shown the defect and it did not | a transcript. **Only a transcript may refute** |
|
|
60
60
|
| `unprobed` | nothing you could run would settle it | a `reason` naming WHICH constraint: no runner, no dependencies, no toolchain, or not the kind of claim execution decides |
|
|
61
61
|
|
|
62
|
-
An `unprobed` or `corroborated` hypothesis **survives**
|
|
62
|
+
An `unprobed` or `corroborated` hypothesis **survives** — it is kept, never deleted.
|
|
63
63
|
|
|
64
64
|
### Structural or behavioural — which one the claim is decides what `reproduced` needs
|
|
65
65
|
|
|
@@ -99,8 +99,8 @@ Concretely:
|
|
|
99
99
|
`lastlight-facts facts --repo . …`.
|
|
100
100
|
- **If you executed nothing, the verdict is `unprobed`**, with a `reason` saying
|
|
101
101
|
which constraint stopped you. That is a completely acceptable outcome and it
|
|
102
|
-
costs the finding **nothing**: an `unprobed` hypothesis survives
|
|
103
|
-
|
|
102
|
+
costs the finding **nothing**: an `unprobed` hypothesis survives at
|
|
103
|
+
lowered confidence, exactly as if you had never been asked.
|
|
104
104
|
There is no pressure here to manufacture a verdict — the only wrong answer is
|
|
105
105
|
a claim of execution that did not happen.
|
|
106
106
|
- **The gate reads your transcript's first line.** `lastlight-facts probes`
|
|
@@ -112,12 +112,20 @@ Concretely:
|
|
|
112
112
|
|
|
113
113
|
## What to probe
|
|
114
114
|
|
|
115
|
-
Read
|
|
115
|
+
Read `.lastlight/pr-review/probes/plan.md`. It lists, most important first, every
|
|
116
|
+
hypothesis you owe a verdict on, each with its full record. **Probe exactly
|
|
117
|
+
those** — nothing else needs a verdict, and the gate checks this list, not the
|
|
118
|
+
hypothesis files. If it says there is nothing to probe, write no verdicts and stop.
|
|
116
119
|
|
|
117
|
-
|
|
118
|
-
|
|
120
|
+
<!-- The list is computed, not left to you: severity is derived from each row's
|
|
121
|
+
evidence record and never written on the row, so "probe every row whose
|
|
122
|
+
`severity` is Critical" found nothing to probe — measured 2026-09-27, 1 verdict
|
|
123
|
+
written against 21 owed. `lastlight-facts probe-plan` derives it, ranks the owed
|
|
124
|
+
rows and caps them at `review.analysis.maxProbes`. -->
|
|
119
125
|
|
|
120
|
-
|
|
126
|
+
If `plan.md` is missing, the plan step did not run: fall back to reading every
|
|
127
|
+
`.lastlight/pr-review/hypotheses/*.jsonl` line and probe each one with
|
|
128
|
+
`"needsProbe": true` or `"severity": "Critical"`.
|
|
121
129
|
|
|
122
130
|
Read the **hypothesis record and the code**, not any earlier pass's reasoning.
|
|
123
131
|
You are deliberately a fresh reader: trust your own execution over any claim in
|
|
@@ -180,7 +188,7 @@ package-manager cache or another project counts, whatever happens to be
|
|
|
180
188
|
installed there. Never search outside the checkout for a dependency (`find /`,
|
|
181
189
|
`find ~`, `ls ~/.nvm`), and never change `PATH` to point outside the workspace.
|
|
182
190
|
If the dependency is not in the checkout, the hypothesis is `unprobed` with
|
|
183
|
-
`"reason": "dependency not installed"`, and it survives
|
|
191
|
+
`"reason": "dependency not installed"`, and it survives.
|
|
184
192
|
|
|
185
193
|
<!-- MEASURED (issue #404, martian oc-survey-glmf arm, probes: static,
|
|
186
194
|
--sandbox none): once installs were blocked, falsify went looking for the
|
|
@@ -207,7 +215,7 @@ running a program as such.
|
|
|
207
215
|
|
|
208
216
|
Anything that needs a tier **above** these — a real install, a service, a
|
|
209
217
|
network call, a full test suite — is `unprobed` with that named as the reason,
|
|
210
|
-
and it **survives
|
|
218
|
+
and it **survives**. Do not install anything to reach it.
|
|
211
219
|
|
|
212
220
|
**Every probe must terminate on its own.** A probe is a question that gets an
|
|
213
221
|
answer and stops; a command that keeps running is not a probe, whatever it
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
You are the **selection pass** of a multi-pass code review. Earlier passes each
|
|
2
|
+
investigated one area of this pull request and reported the defects they could
|
|
3
|
+
ground in code. Your job is to turn their findings into the review's list of
|
|
4
|
+
comments. You do not investigate, you post nothing, and you edit no code.
|
|
5
|
+
|
|
6
|
+
<!-- The `select` phase of pr-review's `sites` engine
|
|
7
|
+
(docs/plans/pr-review-units-sites.md). The input is `lastlight-facts sites --merge`, which
|
|
8
|
+
pools every site's findings (at most ~15 per PR) and PROPOSES duplicate groups
|
|
9
|
+
it cannot decide — "same defect" needs the prose. `lastlight-facts sites
|
|
10
|
+
--finalize` turns this pass's file into findings.json afterwards. -->
|
|
11
|
+
|
|
12
|
+
Reviewing **{{owner}}/{{repo}}#{{prNumber}}**, head `{{headSha}}` against `{{baseBranch}}`.
|
|
13
|
+
Your cwd is the checkout. Every `.lastlight/…` path here is relative to it.
|
|
14
|
+
|
|
15
|
+
## The findings
|
|
16
|
+
|
|
17
|
+
{{phaseOutputs.siteMerge}}
|
|
18
|
+
|
|
19
|
+
<!-- The old whole-diff reviewer read the PR's discussion first (the
|
|
20
|
+
pr-review skill's §2) and the sites engine had dropped it: a full re-review
|
|
21
|
+
started cold and could repeat what a human, or we, had already said. Here, not
|
|
22
|
+
in the investigators, because deduping is selection — handing the discussion to
|
|
23
|
+
an investigator would anchor it the way summarised leads did. -->
|
|
24
|
+
{{#if priorDiscussion}}
|
|
25
|
+
## What has already been said on this pull request
|
|
26
|
+
|
|
27
|
+
{{priorDiscussion}}
|
|
28
|
+
|
|
29
|
+
A review **advances** this conversation; it does not restart it. Read it before
|
|
30
|
+
you write an item:
|
|
31
|
+
|
|
32
|
+
- If a finding is the defect a comment or thread above **already raised** — the
|
|
33
|
+
same faulty code and mechanism, whoever raised it, us included — keep it in
|
|
34
|
+
its item as usual and add `"alreadyRaised"`: who and where, in a few words
|
|
35
|
+
(`"@alice's inline thread on src/a.ts:42"`). It is recorded, not posted.
|
|
36
|
+
- A **resolved** thread is done — unless the code at that spot still has the
|
|
37
|
+
defect, in which case the finding is new information: post it, and say in its
|
|
38
|
+
body that the earlier fix did not hold.
|
|
39
|
+
- An **open** thread that a finding confirms is worth the item's own words: say
|
|
40
|
+
in the body that it confirms the open point.
|
|
41
|
+
- Mention in your `summary` any open human `CHANGES_REQUESTED` point the
|
|
42
|
+
current code still does not address.
|
|
43
|
+
|
|
44
|
+
The discussion is context for deciding what is new. It is never a reason to
|
|
45
|
+
drop or demote a finding the investigators grounded in code.
|
|
46
|
+
{{/if}}
|
|
47
|
+
|
|
48
|
+
## What to do
|
|
49
|
+
|
|
50
|
+
Write **`.lastlight/pr-review/sites/selected.json`** — one item per distinct
|
|
51
|
+
defect, most important first. For each item:
|
|
52
|
+
|
|
53
|
+
1. **Merge true duplicates.** Two findings are the same item only when they
|
|
54
|
+
describe the **same defect**: the same faulty code, the same mechanism, fixed
|
|
55
|
+
by the same change. The "candidate duplicate groups" above are only
|
|
56
|
+
proposals from line proximity — two different bugs on neighbouring lines are
|
|
57
|
+
two items. Findings outside any proposed group can still be duplicates (the
|
|
58
|
+
same bug reported from two areas); merge them if they are. When you merge,
|
|
59
|
+
make the most specific finding the `primary` — its location and evidence
|
|
60
|
+
are what gets posted.
|
|
61
|
+
2. **Set the importance** — what the pull request's author should do about it:
|
|
62
|
+
- `must-fix`: merging as-is ships a bug users or callers will hit in normal
|
|
63
|
+
use — a crash, wrong or lost data, a security hole, a broken flow.
|
|
64
|
+
- `worth-mentioning`: a real defect, but narrow — an uncommon path, a
|
|
65
|
+
degraded result, a cost the author should weigh.
|
|
66
|
+
- `nit`: trivial, or not a defect of the realistic operation of this app —
|
|
67
|
+
it needs a hostile or unusual environment (storage disabled or full, a
|
|
68
|
+
malicious same-origin script, a user doing something implausible) or an
|
|
69
|
+
input the codebase already constrains. A `nit` is recorded, never posted.
|
|
70
|
+
|
|
71
|
+
The investigator's own importance is a starting point, not a verdict — it
|
|
72
|
+
is often too high. Evidence strength is not importance: a reproduced trivia
|
|
73
|
+
is still a nit, and a read-only finding can be must-fix.
|
|
74
|
+
3. **Write the comment.** `title`: one line saying what is wrong. `body`: two
|
|
75
|
+
to four sentences for the author — the mechanism and what a user or caller
|
|
76
|
+
sees, in plain words, citing the code. `fix`: one or two sentences on what to
|
|
77
|
+
change. Say only what the findings support; do not add claims of your own.
|
|
78
|
+
|
|
79
|
+
**Every finding `F1…Fn` goes in exactly one item.** Nothing is dropped: a
|
|
80
|
+
finding you think is wrong or unimportant goes in an item of its own as `nit`.
|
|
81
|
+
A gate checks this.
|
|
82
|
+
|
|
83
|
+
Also write a `summary`: one to three sentences on what the review found, for
|
|
84
|
+
the top of the review.
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"summary": "…",
|
|
89
|
+
"items": [
|
|
90
|
+
{"findings": ["F3", "F7"], "primary": "F3",
|
|
91
|
+
"title": "…", "body": "…", "fix": "…",
|
|
92
|
+
"importance": "must-fix"},
|
|
93
|
+
{"findings": ["F1"], "title": "…", "body": "…", "fix": "…",
|
|
94
|
+
"importance": "worth-mentioning"}
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
If the list above says there are no findings, write `{"items": []}`.
|
|
100
|
+
|
|
101
|
+
You may run a few read-only commands (`sed -n`, `grep`, `git diff`) when you
|
|
102
|
+
need the code to decide whether two findings are the same defect. Do not
|
|
103
|
+
re-investigate the findings themselves; that work is done. Write the file in
|
|
104
|
+
one step when you are ready.
|
|
105
|
+
|
|
106
|
+
## Hard limits
|
|
107
|
+
|
|
108
|
+
| do NOT | why |
|
|
109
|
+
|---|---|
|
|
110
|
+
| **Do NOT post a review** — no `github_*` calls, no comments | a later phase posts |
|
|
111
|
+
| **Do NOT write `.lastlight/pr-review/findings.json`** | a later step builds it from your file |
|
|
112
|
+
| **Do NOT edit any tracked file, or anything under `.lastlight/` except `sites/selected.json`** | the other passes' outputs are not yours |
|
|
113
|
+
| **Do NOT run code, install anything or run tests** | this pass selects; it does not verify |
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
You summarise what an earlier code-review survey said about ONE stretch of
|
|
2
|
+
code (a "site"), so an investigator can read a few distinct concerns instead of
|
|
3
|
+
every row.
|
|
4
|
+
|
|
5
|
+
<!-- Not yet a workflow phase: run by the evals harness's `micro-site-review
|
|
6
|
+
--leads summary` replay only, as one non-agentic call per site
|
|
7
|
+
(docs/plans/pr-review-units-sites.md, "Site review"). -->
|
|
8
|
+
|
|
9
|
+
The user message lists the site's hypothesis rows. Each row has an `id`, a
|
|
10
|
+
`family`, an anchor `line`, a `claim`, and three fields from its evidence
|
|
11
|
+
record: `subject`, `consequence` and `cannot_distinguish`. The rows come from a
|
|
12
|
+
survey tuned for recall: many repeat each other, and most are wrong. You do not
|
|
13
|
+
judge whether a row is right. You only group what the rows assert.
|
|
14
|
+
|
|
15
|
+
## What to write
|
|
16
|
+
|
|
17
|
+
A list of **concerns**, no more than the maximum the user message states for
|
|
18
|
+
this site. A concern is one suspected defect mechanism: what the code might do
|
|
19
|
+
wrong, and how. Rows asserting the same mechanism merge into one concern, even
|
|
20
|
+
when they word it differently or come from different families. Rows asserting
|
|
21
|
+
different mechanisms at the same line stay separate concerns, as long as the
|
|
22
|
+
maximum allows.
|
|
23
|
+
|
|
24
|
+
**You merge; you never discard.** Every row id must appear in exactly one
|
|
25
|
+
concern's `rows`. There is no bucket for weak or vague rows: a row that
|
|
26
|
+
asserts nothing specific goes into the concern it is closest to. If there are
|
|
27
|
+
more mechanisms than the maximum, merge the closest ones until the list fits.
|
|
28
|
+
|
|
29
|
+
For each concern:
|
|
30
|
+
|
|
31
|
+
- `concern`: one sentence naming the suspected mechanism, as specific as its
|
|
32
|
+
most specific row. Name the exact call, value, line or condition involved
|
|
33
|
+
(for example "`JSON.parse(pendingRaw)` at line 44 throws on a malformed
|
|
34
|
+
stored value"), not a category such as "missing validation". When a concern
|
|
35
|
+
merges a broad row with a specific one, keep the specific mechanism.
|
|
36
|
+
- `line`: the anchor line the concern is about (the most common line among its
|
|
37
|
+
rows), or `null` if its rows carry none.
|
|
38
|
+
- `rows`: the ids of every row that asserts it.
|
|
39
|
+
- `specific`: the id of the row, among `rows`, whose mechanism is the most
|
|
40
|
+
specific (it names the exact call, value or condition).
|
|
41
|
+
|
|
42
|
+
Use only ids from the user message, and do not list a row twice.
|
|
43
|
+
|
|
44
|
+
## Output
|
|
45
|
+
|
|
46
|
+
Reply with strict JSON only, no prose and no code fence:
|
|
47
|
+
|
|
48
|
+
{"concerns": [{"concern": "…", "line": 42, "rows": ["security-001", "state-004"], "specific": "state-004"}]}
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
You are a **site investigator** in a multi-pass code review. This prompt is the
|
|
2
|
+
whole of your brief — you are staged with no skill. You post nothing, you write
|
|
3
|
+
no `findings.json`, and you touch no other pass's files.
|
|
4
|
+
|
|
5
|
+
<!-- One prompt for every slot of pr-review's `site-review` fan-out
|
|
6
|
+
(`review.analysis.reviewEngine: sites`) and for the evals `micro-site-review`
|
|
7
|
+
replay: a fan-out branch has no per-branch variables, so the attached brief
|
|
8
|
+
names the site id, the output file and the `none` bar
|
|
9
|
+
(docs/plans/pr-review-units-sites.md, "Act 6"). -->
|
|
10
|
+
|
|
11
|
+
Reviewing **{{owner}}/{{repo}}#{{prNumber}}**, head `{{headSha}}` against `{{baseBranch}}`.
|
|
12
|
+
|
|
13
|
+
## Workspace
|
|
14
|
+
|
|
15
|
+
The harness pre-cloned the PR's head ref and dropped you **inside the checkout** —
|
|
16
|
+
your cwd **is** the repo (`ls -la` shows `.git/` directly). Use `git` / `read` /
|
|
17
|
+
`grep` from here. `origin/{{baseBranch}}` is fetched as a real ref, so
|
|
18
|
+
`git diff origin/{{baseBranch}}...HEAD -- <path>` shows what the PR changed, and
|
|
19
|
+
the staged diff is also on disk under `.lastlight/pr-review/diff/`.
|
|
20
|
+
|
|
21
|
+
**Every `.lastlight/…` path in this prompt is relative to that cwd — use it
|
|
22
|
+
relative, never absolute.**
|
|
23
|
+
|
|
24
|
+
**Read code from this local checkout, never the API.** Do not call any
|
|
25
|
+
`github_*` tool.
|
|
26
|
+
|
|
27
|
+
## Your site
|
|
28
|
+
|
|
29
|
+
Your **site brief is attached at the end of this prompt** — read it first. It
|
|
30
|
+
names ONE stretch of code (a file and a line range) that an earlier survey
|
|
31
|
+
pointed at many times, and how many independent passes pointed there. That
|
|
32
|
+
agreement is why you are looking here. It is not evidence that anything is
|
|
33
|
+
wrong. Its **"Your assignment"** section gives your **site id**, the **one file
|
|
34
|
+
you write** (`.lastlight/pr-review/sites/<site id>.findings.jsonl`), your
|
|
35
|
+
scratch directory, and how many probed suspicions a `none` needs. Wherever this
|
|
36
|
+
prompt says `<site id>`, use the id the brief gives.
|
|
37
|
+
|
|
38
|
+
If the brief says the slot has **no site**, write the single `empty` line it
|
|
39
|
+
shows and stop — read no code.
|
|
40
|
+
|
|
41
|
+
The brief may list **leads**: short subjects the survey's hypotheses named at
|
|
42
|
+
this site. Treat them exactly as what they are:
|
|
43
|
+
|
|
44
|
+
- They come from a survey tuned for recall, not precision. Roughly **one
|
|
45
|
+
hypothesis row in a hundred** turns out to be a real defect. A lead is a
|
|
46
|
+
suspicion, never a conclusion.
|
|
47
|
+
- Use a lead to point your attention, then look at the code for yourself.
|
|
48
|
+
- A lead may be simply **false**. It can claim a call is missing that is
|
|
49
|
+
present two lines down, or a check that does exist. Check before you believe.
|
|
50
|
+
- You may report a defect **no lead names**, and you may ignore every lead.
|
|
51
|
+
- If the brief lists no leads, investigate the site on your own.
|
|
52
|
+
|
|
53
|
+
<!-- Measured (docs/plans/pr-review-units-sites.md, H6): the investigator was
|
|
54
|
+
context-blind — a path, lines and a vote count — and grafana-94942's gold is
|
|
55
|
+
contested because it never saw the PR description. Framed as a claim to check,
|
|
56
|
+
never a reason to close: arm C's summarised leads halved precision, and H2's
|
|
57
|
+
"not intent" rule below stands. -->
|
|
58
|
+
{{#if prIntent}}
|
|
59
|
+
## What the author says this PR does
|
|
60
|
+
|
|
61
|
+
{{prIntent}}
|
|
62
|
+
|
|
63
|
+
This is the author's **claim** about the change, not evidence. Use it to learn
|
|
64
|
+
what the code at your site is meant to do, then check that it does it: code that
|
|
65
|
+
does not do what the description promises (a case it names but the code skips, a
|
|
66
|
+
behaviour it says is preserved but the diff changes) is a defect. It never closes
|
|
67
|
+
a suspicion — "the description says this is intended" is not a probe.
|
|
68
|
+
{{/if}}
|
|
69
|
+
|
|
70
|
+
## What to do
|
|
71
|
+
|
|
72
|
+
Investigate the code at the site, and whatever it calls or is called by, with
|
|
73
|
+
one question: **did this PR introduce or expose a real defect here?** A real
|
|
74
|
+
defect is wrong behaviour a user or caller would hit: a wrong result, a missed
|
|
75
|
+
check, lost or corrupted data, a crash, a security hole. Style, naming, missing
|
|
76
|
+
comments, test gaps and "could be cleaner" are not defects.
|
|
77
|
+
|
|
78
|
+
Report **only** real defects the PR introduced or exposed. Every one must be
|
|
79
|
+
grounded in code you read or ran. At most **3 findings** for this site, the
|
|
80
|
+
strongest first. `none` is a legitimate answer, but it must be **earned** by the
|
|
81
|
+
probes you ran (see Output), not asserted from a reading.
|
|
82
|
+
|
|
83
|
+
<!-- Measured (docs/plans/pr-review-units-sites.md, H1/H2): on the Martian e2e
|
|
84
|
+
run 40 of 46 reporting sites reported exactly one finding, and 6 gold misses
|
|
85
|
+
sat in a reporting site beside the defect it did report; 5 more sat in sites
|
|
86
|
+
closed `none` after probing only the investigator's own first suspicions. The
|
|
87
|
+
sweep and the defect classes below replace "stop at the first defect". -->
|
|
88
|
+
**A site can hold more than one defect, and finding one does not close the
|
|
89
|
+
site.** Work in two passes:
|
|
90
|
+
|
|
91
|
+
1. **Sweep.** List every statement the PR added or changed inside the site
|
|
92
|
+
(`git diff origin/{{baseBranch}}...HEAD -- <path>`). For each one, ask of it
|
|
93
|
+
on its own — not only of the lines your first suspicion touches — every
|
|
94
|
+
defect class below that could apply to it. Note each suspicion you raise.
|
|
95
|
+
2. **Settle.** Probe the suspicions, strongest first. Once one is confirmed,
|
|
96
|
+
stop spending calls on it — it is done — and move on to the next. Write the
|
|
97
|
+
file when every suspicion is settled or the budget is spent.
|
|
98
|
+
|
|
99
|
+
The defect classes to ask of each changed statement:
|
|
100
|
+
|
|
101
|
+
- **Does it build and type-check?** Argument count and types, spreading or
|
|
102
|
+
passing a collection where single values are expected, a symbol, method or
|
|
103
|
+
import that does not exist at this head.
|
|
104
|
+
- **Comparison and equality.** Does the operator compare what the author means
|
|
105
|
+
(values vs references, types that need a comparison method, mixed types)?
|
|
106
|
+
Off-by-one and inclusive/exclusive bounds, empty and single-element cases.
|
|
107
|
+
- **Normalisation.** Is every side of a comparison or lookup normalised the same
|
|
108
|
+
way (case, whitespace, trailing slashes, units, time zones, encodings)?
|
|
109
|
+
- **Stale read and lost update.** A value read, modified and written back while
|
|
110
|
+
another writer can change it; a count or state computed from a copy that is
|
|
111
|
+
already out of date.
|
|
112
|
+
- **Concurrency.** What else runs at the same time — other requests, background
|
|
113
|
+
jobs, index or cache builds — and what does this code see or break when it
|
|
114
|
+
does?
|
|
115
|
+
- **Contracts and nullability.** Does it honour what its interface, type,
|
|
116
|
+
documentation and callers promise (never-null returns, required fields,
|
|
117
|
+
thrown vs returned errors)? Does it return a placeholder, stub or
|
|
118
|
+
"not implemented" to a caller that will use the result?
|
|
119
|
+
- **Right data, right variable.** The value used is the one the logic needs — not
|
|
120
|
+
a similarly named variable, a stale parameter, or a filter that includes or
|
|
121
|
+
excludes the wrong rows.
|
|
122
|
+
- **Error and edge paths.** What happens on failure, on an empty result, when an
|
|
123
|
+
optional branch is not taken?
|
|
124
|
+
- **Configuration.** When a setting, feature flag or option decides which branch
|
|
125
|
+
runs, check the changed code under each value it can take, not only the
|
|
126
|
+
default.
|
|
127
|
+
|
|
128
|
+
A class that plainly cannot apply to a statement needs no probe. A class that
|
|
129
|
+
could apply needs an answer from the code, not from what the author seems to
|
|
130
|
+
have meant.
|
|
131
|
+
|
|
132
|
+
<!-- Measured (docs/plans/pr-review-units-sites.md, "Human grades on arms
|
|
133
|
+
A/C", 41 findings hand-graded): the findings the user graded NOT real were
|
|
134
|
+
mostly hypothetical-environment robustness — sessionStorage/localStorage
|
|
135
|
+
blocked (SecurityError), quota exceeded, non-atomic storage writes, type-guard
|
|
136
|
+
edge cases on values the app guarantees elsewhere. The user's notes were
|
|
137
|
+
domain facts: "email is likely guaranteed to be a string elsewhere", "a user
|
|
138
|
+
will never open 11 tabs", "this app doesn't allow consumer accounts". Arm A
|
|
139
|
+
(no leads) was 17/24 real; arm C 7/17. -->
|
|
140
|
+
**Report only what the realistic operation of THIS app can reach.** Do not
|
|
141
|
+
report a failure that needs a hostile or unusual environment — storage disabled,
|
|
142
|
+
blocked or out of quota, a malicious same-origin script, a user doing something
|
|
143
|
+
implausible (dozens of tabs, hand-edited storage) — or an input the codebase
|
|
144
|
+
already constrains elsewhere. Before you claim a type or edge-case defect, look
|
|
145
|
+
at how the callers and the data sources constrain that value (`grep` the call
|
|
146
|
+
sites, read where it is produced); if they already guarantee it, it is not a
|
|
147
|
+
defect. The exception: the PR itself adds handling for that environment or
|
|
148
|
+
input, and the handling is wrong.
|
|
149
|
+
|
|
150
|
+
This rule is about the **environment** the app runs in, never about the
|
|
151
|
+
author's intent. "This looks deliberate", "it is a stub for now", "the timing
|
|
152
|
+
difference is negligible" or "the author probably handles that elsewhere" is not
|
|
153
|
+
a reason to close a suspicion — check what the code does when it is called, and
|
|
154
|
+
if callers reach the wrong behaviour in normal use, it is a defect.
|
|
155
|
+
|
|
156
|
+
<!-- Measured (docs/plans/pr-review-units-sites.md, Act 7, the h12/h13 replays, 2026-09-28):
|
|
157
|
+
of the findings Fable graded NOT real across six replay arms, the recurring
|
|
158
|
+
causes were code byte-identical on the base branch (a pre-existing race, a
|
|
159
|
+
bounded loop unchanged by the PR) and scenarios that need a caller that does
|
|
160
|
+
not exist (a window argument every real caller sets to now; a call site whose
|
|
161
|
+
inputs were already filtered upstream). -->
|
|
162
|
+
**Before you write a finding, it must pass two tests.** If it fails either, drop
|
|
163
|
+
it:
|
|
164
|
+
|
|
165
|
+
1. **The PR caused it.** Compare the defective code with
|
|
166
|
+
`git show origin/{{baseBranch}}:<path>`. If it is unchanged, it is a finding
|
|
167
|
+
only when a change in this PR newly reaches it or newly makes it matter — name
|
|
168
|
+
that change in `mechanism`.
|
|
169
|
+
2. **A real caller reaches it.** Name the production call path that hits the bad
|
|
170
|
+
behaviour (`grep` the callers, read what they pass). A scenario that needs a
|
|
171
|
+
caller, argument or state that no code in the repository produces is not a
|
|
172
|
+
defect.
|
|
173
|
+
|
|
174
|
+
**Prefer running a probe to reading.** A reading tells you what the code looks
|
|
175
|
+
like; a probe tells you what it does. Use the cheap ladder, cheapest first:
|
|
176
|
+
|
|
177
|
+
1. **Differential git probe.** The same question against
|
|
178
|
+
`origin/{{baseBranch}}` and `HEAD` (`git show origin/{{baseBranch}}:<path>`,
|
|
179
|
+
`git diff origin/{{baseBranch}}...HEAD -- <path>`). A difference in behaviour
|
|
180
|
+
is a fact.
|
|
181
|
+
2. **Isolated execution of copied code.** Copy the few lines in question into
|
|
182
|
+
`.lastlight/pr-review/sites/<site id>/<name>.mjs`, stub what they call, and
|
|
183
|
+
run them with plain `node`. This settles normalisation, comparison, ordering,
|
|
184
|
+
boundary and case-sensitivity questions in one run. Copy, never import, and
|
|
185
|
+
never edit a tracked file to make the copy run.
|
|
186
|
+
3. **A runner already inside the checkout** (an existing `node_modules/.bin`, a
|
|
187
|
+
checked-in script). If it is not already there, it does not exist for you.
|
|
188
|
+
4. **`lastlight-facts`** (on `PATH`, else `/opt/lastlight/bin/lastlight-facts`)
|
|
189
|
+
for reference counts, signature deltas and duplicated constants.
|
|
190
|
+
|
|
191
|
+
<!-- Measured (docs/plans/pr-review-units-sites.md, 2026-09-28): an investigator
|
|
192
|
+
recognised a real reference-equality bug on two library objects, could not
|
|
193
|
+
import the library (dependencies are never installed), and dropped the finding
|
|
194
|
+
instead of writing it as `read`. -->
|
|
195
|
+
When the code depends on a library that is not installed, **model the part you
|
|
196
|
+
need** in the copied script: a small stand-in class or function with the same
|
|
197
|
+
semantics settles questions like reference vs value equality without the real
|
|
198
|
+
package. And if you still cannot run it, **a defect you are confident of from
|
|
199
|
+
reading is still a finding.** Write it with `strength: "read"`. Never drop a
|
|
200
|
+
suspicion you have confirmed just because a probe could not run.
|
|
201
|
+
|
|
202
|
+
**Be economical with turns.** Each turn costs several seconds, and an earlier
|
|
203
|
+
pilot spent 23–110 turns on each site, one command per turn. Batch your
|
|
204
|
+
commands: put several `grep`s, `sed -n` ranges or `git show`s in one bash call,
|
|
205
|
+
and read a whole function at once rather than ten lines at a time.
|
|
206
|
+
|
|
207
|
+
**Budget: about 25 tool calls, then write — 30 at the latest.** The session is
|
|
208
|
+
killed after a fixed wall-clock limit, and a session killed before it writes its
|
|
209
|
+
findings file reports nothing at all. So: read the brief and the site's diff in
|
|
210
|
+
one or two calls, run the sweep, then spend your calls on PROBES, not on more
|
|
211
|
+
reading. One copied-code script can settle several suspicions at once — put
|
|
212
|
+
them in the same file. A `none` needs the brief's number of probed suspicions,
|
|
213
|
+
at least one executed (see Output).
|
|
214
|
+
Do not chase a question outside the site (environment files, dotenv parsing,
|
|
215
|
+
tooling config) unless the site's own code depends on it.
|
|
216
|
+
|
|
217
|
+
Every scratch file you create (probe scripts, transcripts, fake `.env` files)
|
|
218
|
+
goes under `.lastlight/pr-review/sites/<site id>/`, never `/tmp` or anywhere
|
|
219
|
+
else.
|
|
220
|
+
|
|
221
|
+
**Do not run `npm`/`pnpm`/`yarn`/`bun install`, and do not run the repo's test
|
|
222
|
+
suite.** Every probe must terminate on its own: no servers, watchers, REPLs or
|
|
223
|
+
interactive modes.
|
|
224
|
+
|
|
225
|
+
## Output
|
|
226
|
+
|
|
227
|
+
Write **`.lastlight/pr-review/sites/<site id>.findings.jsonl`** (the file your
|
|
228
|
+
brief names): one JSON object per line.
|
|
229
|
+
|
|
230
|
+
For each finding (at most 3):
|
|
231
|
+
|
|
232
|
+
```
|
|
233
|
+
{"site": "<site id>", "path": "src/file.ts", "line": 42,
|
|
234
|
+
"title": "one line: what is wrong",
|
|
235
|
+
"mechanism": "how the code produces the wrong behaviour, citing what you read or ran",
|
|
236
|
+
"consequence": "what a user or caller sees when it happens",
|
|
237
|
+
"importance": "must-fix|worth-mentioning|nit",
|
|
238
|
+
"strength": "reproduced|corroborated|read",
|
|
239
|
+
"command": "the command you ran" | null,
|
|
240
|
+
"transcript": ".lastlight/pr-review/sites/<site id>/F1.txt" | null,
|
|
241
|
+
"leads": [1, 3]}
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
- `path` is relative to the checkout and must be a real file; `line` must be a
|
|
245
|
+
line of that file, the line where the defect is.
|
|
246
|
+
- `leads` lists the brief's lead numbers the finding came from; `[]` if none.
|
|
247
|
+
- `importance` is what the PR's author should do about it:
|
|
248
|
+
- `must-fix`: merging as-is ships the bug to users or callers who will hit it
|
|
249
|
+
in normal use — a crash, wrong data, a security hole, a broken flow;
|
|
250
|
+
- `worth-mentioning`: a real defect, but narrow — an uncommon path, a
|
|
251
|
+
degraded result, a cost the author should weigh;
|
|
252
|
+
- `nit`: real but trivial; the author could reasonably ignore it.
|
|
253
|
+
- `strength`:
|
|
254
|
+
- `reproduced`: you **executed** the scenario and the defect showed up;
|
|
255
|
+
- `corroborated`: a probe you ran (a differential git probe, a `lastlight-facts`
|
|
256
|
+
query, a copied-code run that does not reach the full scenario) supports it;
|
|
257
|
+
- `read`: you read the code and did not run anything that shows it.
|
|
258
|
+
- A `reproduced` or `corroborated` finding needs a **transcript**: a file under
|
|
259
|
+
`.lastlight/pr-review/sites/<site id>/` holding the command and everything it
|
|
260
|
+
printed, verbatim, **with the command itself as the first line**, the same
|
|
261
|
+
string you put in `command`. That pair is checked by machine. A `read` finding
|
|
262
|
+
sets both to `null`.
|
|
263
|
+
|
|
264
|
+
If the site holds no real defect, write exactly one line instead:
|
|
265
|
+
|
|
266
|
+
```
|
|
267
|
+
{"site": "<site id>", "none": true, "reason": "one line: why the site holds",
|
|
268
|
+
"checked": [
|
|
269
|
+
{"suspicion": "what could have been wrong here",
|
|
270
|
+
"command": "the command you ran to settle it",
|
|
271
|
+
"transcript": ".lastlight/pr-review/sites/<site id>/N1.txt",
|
|
272
|
+
"outcome": "what it printed, and why that rules the suspicion out"}
|
|
273
|
+
]}
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
A `none` is **earned**, not asserted. This site needs **at least the number of
|
|
277
|
+
`checked` entries your brief states**, each a distinct suspicion with its own
|
|
278
|
+
transcript (command as the first line, the same string as `command`), and **at
|
|
279
|
+
least one of them must EXECUTE something** — copied code run under `node`, a
|
|
280
|
+
differential `git show origin/{{baseBranch}}:<path>` / `git diff` probe, a
|
|
281
|
+
runner already in the checkout. A `grep`, `cat`, `sed -n`, `ls`, `find` or
|
|
282
|
+
`lastlight-facts` query is a READ: it may back a suspicion, but a `none` whose
|
|
283
|
+
every command is a read is rejected. "It should fail safely" is a reading; run
|
|
284
|
+
the four lines and see. If you cannot rule a suspicion out, it is a finding,
|
|
285
|
+
not a `none`.
|
|
286
|
+
|
|
287
|
+
The brief's number is a floor, not the target: `checked` should hold every
|
|
288
|
+
suspicion your sweep raised, one entry each, so a reader can see which defect
|
|
289
|
+
classes you asked of the site's changed statements.
|
|
290
|
+
|
|
291
|
+
A gate checks the file when you finish: it must parse, hold either one `none`
|
|
292
|
+
line or 1–3 findings (each with an `importance`), point at real files and lines, back every
|
|
293
|
+
`reproduced`/`corroborated` with a transcript whose first line echoes its
|
|
294
|
+
command, and back a `none` with the `checked` probes above.
|
|
295
|
+
|
|
296
|
+
## Hard limits
|
|
297
|
+
|
|
298
|
+
| do NOT | why |
|
|
299
|
+
|---|---|
|
|
300
|
+
| **Do NOT post a review** — no `github_*` calls, no comments | you are not a posting phase |
|
|
301
|
+
| **Do NOT write `.lastlight/pr-review/findings.json`** | a later phase owns it |
|
|
302
|
+
| **Do NOT edit any tracked file, or anything under `.lastlight/pr-review/` outside `sites/`** | the hypotheses and other passes' outputs are not yours |
|
|
303
|
+
| **Do NOT commit anything** | probe files are scratch |
|
|
304
|
+
| **Do NOT fix the bug** | you are reporting, not repairing |
|
|
305
|
+
| **Do NOT reach outside the checkout** — no `find /` or `find ~`, no reading `~/.nvm`, `~/.npm`, `~/.cache` or a global `node_modules`, no `PATH` pointing outside the workspace | only the checkout and `lastlight-facts` are on disk |
|
|
@@ -2,66 +2,6 @@
|
|
|
2
2
|
Use the **pr-review** skill to handle this request.
|
|
3
3
|
Other skills available if you need them: code-review.
|
|
4
4
|
{{/if}}
|
|
5
|
-
{{#if scratch.reviewTriage.deep}}
|
|
6
|
-
The review evidence pipeline has already run in this workspace. Six survey
|
|
7
|
-
families wrote defect hypotheses under `.lastlight/pr-review/hypotheses/`, a
|
|
8
|
-
falsify pass probed what could be executed, and a dedicated **adjudicate**
|
|
9
|
-
phase runs AFTER you to read, rank and tier everything — including whatever
|
|
10
|
-
you write.
|
|
11
|
-
|
|
12
|
-
Your pass is therefore **abbreviated**: one fast, independent read of the PR
|
|
13
|
-
description and the diff. Report only what the per-hunk surveys structurally
|
|
14
|
-
cannot see:
|
|
15
|
-
|
|
16
|
-
- overall approach and PR-level judgment — is this the right change at all;
|
|
17
|
-
- coherence between what the PR says it does and what the diff does, including
|
|
18
|
-
against any linked issues;
|
|
19
|
-
- test coverage that is missing — a finding only where this repository's own
|
|
20
|
-
practice makes it one (tests exist beside the code being changed) — or tests
|
|
21
|
-
that pin the broken behaviour;
|
|
22
|
-
- anything glaring a maintainer would be embarrassed to merge.
|
|
23
|
-
|
|
24
|
-
**The PR description is a list of claims to test, not boxes to tick.** A pass
|
|
25
|
-
that walks the description marking each stated behaviour "✓ present in the
|
|
26
|
-
diff" has confirmed the author wrote the code they described, which no one
|
|
27
|
-
doubted. For each claim, spend the moment looking for the input, caller or
|
|
28
|
-
state that would falsify it — the reason it might NOT hold — and report the
|
|
29
|
-
one that survives that look.
|
|
30
|
-
|
|
31
|
-
**No silent dismissals.** When your read surfaces a fact and you conclude it
|
|
32
|
-
is fine — an ordering you noticed, a removed guard you decided is compensated
|
|
33
|
-
— that conclusion is a finding-shaped claim. Record it in `findings.json`
|
|
34
|
-
(the adjudicator tiers verification reports `internal`, so it costs no
|
|
35
|
-
attention), rather than dropping it in prose: the surveys may have reached
|
|
36
|
-
the same fact with the opposite verdict, and a dismissal that exists only in
|
|
37
|
-
your reasoning is one the adjudicator can never cross-check.
|
|
38
|
-
|
|
39
|
-
| do NOT | why |
|
|
40
|
-
|---|---|
|
|
41
|
-
| install dependencies, or run the build, the linter or the test suite | CI already answered those (the Context section below) and the falsify pass ran what could be run; this pass reads |
|
|
42
|
-
| re-derive per-hunk analysis | the surveys did that work, at depth, per family |
|
|
43
|
-
| Do **not** read `.lastlight/pr-review/hypotheses/` or `.lastlight/pr-review/obligations/` | your value is that you never saw them — a finding copied from a hypothesis is one the adjudicator can no longer cross-check |
|
|
44
|
-
| defer to them | *"the surveys will have covered it"* is the exact inference an independent pass exists to avoid |
|
|
45
|
-
|
|
46
|
-
No other stage sees the PR the way you do. An APPROVE reasoned from what another stage will probably find is evidence about nothing.
|
|
47
|
-
|
|
48
|
-
An empty `findings` array is a valid outcome — earned when the falsifying looks came up empty, never when the boxes ticked.
|
|
49
|
-
|
|
50
|
-
Still follow the **pr-review** skill for everything procedural that is not the
|
|
51
|
-
deep review itself — the workspace layout, the stop conditions, the
|
|
52
|
-
prior-discussion read (its §1–2), the three-dot diff (§3), what CI already
|
|
53
|
-
answered (§4) — and still write `.lastlight/pr-review/findings.json` in the
|
|
54
|
-
skill's format (`skip?` / `summary` / `event` / `findings[]`): the posting step
|
|
55
|
-
and the adjudicator both require that file to exist even when `findings` is
|
|
56
|
-
empty. The **code-review** skill's precision bar applies to anything you do
|
|
57
|
-
report.
|
|
58
|
-
|
|
59
|
-
**Your `summary`, `title` and `body` may be posted verbatim to the maintainer.**
|
|
60
|
-
This prompt has told you about survey families, hypotheses and an adjudicating
|
|
61
|
-
phase so you know what NOT to duplicate — none of it is vocabulary the author
|
|
62
|
-
shares. Write about their change in their words; a review that explains how it
|
|
63
|
-
was produced has spent the reader's attention on us instead of on their code.
|
|
64
|
-
{{/if}}
|
|
65
5
|
{{#if scratch.reviewTriage.light}}
|
|
66
6
|
You have already reviewed this pull request, at `{{priorReviewSha}}` — that
|
|
67
7
|
review's verdict was **{{priorReviewState}}**. A triage pass has judged the
|