lastlight-core 0.26.0 → 0.27.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 +302 -5
- package/dist/admin/docker.js.map +1 -1
- package/dist/admin/sessions.js.map +1 -1
- package/dist/admin/tail.js.map +1 -1
- package/dist/config/config.d.ts +18 -4
- package/dist/config/config.js +122 -9
- package/dist/config/config.js.map +1 -1
- package/dist/config/repo-config.js.map +1 -1
- package/dist/connectors/messaging/session-manager.js.map +1 -1
- package/dist/connectors/slack/connector.js.map +1 -1
- package/dist/cron/dependabot-discovery.js.map +1 -1
- package/dist/cron/review-discovery.js.map +1 -1
- package/dist/engine/agent-executor.d.ts +25 -1
- package/dist/engine/agent-executor.js +41 -1
- package/dist/engine/agent-executor.js.map +1 -1
- package/dist/engine/chat/chat-prompt.js.map +1 -1
- package/dist/engine/chat/chat-runner.js.map +1 -1
- package/dist/engine/event-shim.d.ts +18 -0
- package/dist/engine/event-shim.js +2 -0
- package/dist/engine/event-shim.js.map +1 -1
- package/dist/engine/executors/orchestrator.d.ts +92 -1
- package/dist/engine/executors/orchestrator.js +144 -46
- package/dist/engine/executors/orchestrator.js.map +1 -1
- package/dist/engine/executors/shared.js.map +1 -1
- package/dist/engine/fix-harvest.js.map +1 -1
- package/dist/engine/github/github.d.ts +59 -0
- package/dist/engine/github/github.js +72 -0
- package/dist/engine/github/github.js.map +1 -1
- package/dist/engine/github/installations.js.map +1 -1
- package/dist/engine/github/review-poster.d.ts +388 -9
- package/dist/engine/github/review-poster.js +550 -50
- package/dist/engine/github/review-poster.js.map +1 -1
- package/dist/engine/github/team-visibility.js.map +1 -1
- package/dist/engine/llm.js.map +1 -1
- package/dist/engine/pr-decisions.d.ts +13 -5
- package/dist/engine/pr-decisions.js +204 -5
- package/dist/engine/pr-decisions.js.map +1 -1
- package/dist/engine/pr-state.d.ts +58 -0
- package/dist/engine/pr-state.js +64 -0
- package/dist/engine/pr-state.js.map +1 -1
- package/dist/engine/review-spec.d.ts +264 -0
- package/dist/engine/review-spec.js +723 -0
- package/dist/engine/review-spec.js.map +1 -0
- package/dist/engine/router.js.map +1 -1
- package/dist/engine/screen/classifier.js.map +1 -1
- package/dist/engine/screen/screen.js.map +1 -1
- package/dist/evals-api.d.ts +3 -0
- package/dist/evals-api.js +20 -0
- package/dist/evals-api.js.map +1 -1
- package/dist/index.js +39 -4
- package/dist/index.js.map +1 -1
- package/dist/notify/digest-blocks.js.map +1 -1
- package/dist/notify/model.js.map +1 -1
- package/dist/notify/transports/github.js.map +1 -1
- package/dist/notify/transports/slack.js.map +1 -1
- package/dist/sandbox/artifact-backend.js.map +1 -1
- package/dist/sandbox/artifact-store.js.map +1 -1
- package/dist/sandbox/docker.d.ts +23 -4
- package/dist/sandbox/docker.js +1 -1
- package/dist/sandbox/docker.js.map +1 -1
- package/dist/sandbox/egress-allowlist.js.map +1 -1
- package/dist/sandbox/k8s/agent-context-registry.js.map +1 -1
- package/dist/sandbox/k8s/client.js.map +1 -1
- package/dist/sandbox/k8s/kubernetes-sandbox.js.map +1 -1
- package/dist/sandbox/k8s/resource-name.js.map +1 -1
- package/dist/sandbox/k8s/run-id.js.map +1 -1
- package/dist/sandbox/k8s/run-secrets.js.map +1 -1
- package/dist/sandbox/k8s/skill-bundle.js.map +1 -1
- package/dist/sandbox/k8s/workspace-provisioner.js +10 -2
- package/dist/sandbox/k8s/workspace-provisioner.js.map +1 -1
- package/dist/sandbox/sandbox.d.ts +20 -0
- package/dist/sandbox/sandbox.js +27 -6
- package/dist/sandbox/sandbox.js.map +1 -1
- package/dist/session-log.js.map +1 -1
- package/dist/state/approval-store.js.map +1 -1
- package/dist/state/build-assets.js.map +1 -1
- package/dist/state/cron-run-store.js.map +1 -1
- package/dist/state/data-migrate.d.ts +135 -0
- package/dist/state/data-migrate.js +309 -0
- package/dist/state/data-migrate.js.map +1 -0
- package/dist/state/db.d.ts +24 -3
- package/dist/state/db.js +41 -11
- package/dist/state/db.js.map +1 -1
- package/dist/state/execution-store.js.map +1 -1
- package/dist/state/feedback-store.js.map +1 -1
- package/dist/state/pg-client.d.ts +44 -0
- package/dist/state/pg-client.js +81 -0
- package/dist/state/pg-client.js.map +1 -0
- package/dist/state/schema/pg.d.ts +15 -15
- package/dist/state/schema/sqlite.d.ts +15 -15
- package/dist/state/state-cli.d.ts +8 -0
- package/dist/state/state-cli.js +247 -0
- package/dist/state/state-cli.js.map +1 -0
- package/dist/state/team-store.js.map +1 -1
- package/dist/state/user-store.js.map +1 -1
- package/dist/state/workflow-run-store.js.map +1 -1
- package/dist/telemetry/index.js.map +1 -1
- package/dist/workflows/handlers/fanout.d.ts +157 -0
- package/dist/workflows/handlers/fanout.js +663 -0
- package/dist/workflows/handlers/fanout.js.map +1 -0
- package/dist/workflows/handlers/post-review.d.ts +98 -8
- package/dist/workflows/handlers/post-review.js +391 -20
- package/dist/workflows/handlers/post-review.js.map +1 -1
- package/dist/workflows/runner.js +33 -0
- package/dist/workflows/runner.js.map +1 -1
- package/dist/workflows/simple.js.map +1 -1
- package/docker-compose.yml +50 -0
- package/package.json +22 -12
- package/sandbox.Dockerfile +54 -0
- package/skills/code-review/SKILL.md +98 -13
- package/skills/pr-review/SKILL.md +97 -21
- package/skills/pr-review/references/findings-schema.md +37 -6
- package/workflows/pr-review.yaml +567 -0
- package/workflows/prompts/dependabot-pr-merge.md +22 -2
- package/workflows/prompts/review-adjudicate.md +323 -0
- package/workflows/prompts/review-falsify.md +149 -0
- package/workflows/prompts/review.md +80 -0
- package/workflows/prompts/survey-contract.md +109 -0
- package/workflows/prompts/survey-enforcement.md +126 -0
- package/workflows/prompts/survey-security.md +118 -0
- package/workflows/prompts/survey-spec.md +110 -0
- package/workflows/prompts/survey-state.md +143 -0
- package/workflows/prompts/survey-tests.md +99 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: code-review
|
|
3
|
-
description: The shared rubric for reviewing a code change — precision-first, high-signal findings only (Critical/Important),
|
|
4
|
-
version: 2.
|
|
3
|
+
description: The shared rubric for reviewing a code change — precision-first, high-signal findings only (Critical/Important), what to check (correctness, contracts between producer and consumer, security, edge cases, regression risk, test coverage), and what is NOT a finding (pre-existing issues, linter territory, aspirational conventions the repo does not follow). Use when reviewing a PR or a branch diff.
|
|
4
|
+
version: 2.4.0
|
|
5
5
|
tags: [review, code-quality]
|
|
6
6
|
---
|
|
7
7
|
|
|
@@ -21,25 +21,58 @@ not just the happy path.
|
|
|
21
21
|
|
|
22
22
|
A review is only useful if people trust it. A noisy reviewer gets muted; every
|
|
23
23
|
low-value comment you post spends the credibility of the ones that matter. So
|
|
24
|
-
the bar is **high-signal only
|
|
24
|
+
the bar is **high-signal only** — on what you **post**. Read "Where the gate
|
|
25
|
+
applies" below first: if your output is consumed by a later stage rather than by
|
|
26
|
+
a human, none of the filtering in this section is yours to do.
|
|
25
27
|
|
|
26
28
|
- **Post only Critical and Important findings.** Suggestions and Nits (below)
|
|
27
29
|
are *not* worth a formal review comment on their own — drop them, or fold at
|
|
28
|
-
most one genuinely valuable line into the summary. When in doubt
|
|
30
|
+
most one genuinely valuable line into the summary. When in doubt about a
|
|
31
|
+
finding's **tier**, leave it out of the review.
|
|
29
32
|
- **If you cannot name the concrete impact — what breaks, and for which input or
|
|
30
33
|
caller — do not post it.** "This could be cleaner" is not a finding; "this
|
|
31
34
|
crashes when `items` is empty because line 42 indexes `[0]`" is.
|
|
32
|
-
- **
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
- **One defect per comment, and distinct claims stay distinct.** Never fold a
|
|
36
|
+
second, independent defect into an "Additionally, …" sentence of the first —
|
|
37
|
+
two defects sharing a comment get read, answered and tracked as one, and one
|
|
38
|
+
of them is lost. Two comments may share a line. Keep each claim's precision
|
|
39
|
+
too: "out of date" is not "wrong", and collapsing distinct claims into the
|
|
40
|
+
harsher one overstates the review's case.
|
|
41
|
+
- **Confidence gate — refute, don't doubt, and only at the end.** Before you
|
|
42
|
+
finalise, re-read each finding against the actual code and try to *refute your
|
|
43
|
+
own claim*. Dropping it requires naming the specific thing that makes it
|
|
44
|
+
wrong: the guard you missed, the caller that already validates, the type that
|
|
45
|
+
makes the case unreachable. **Unease is not a refutation.** "I'm not certain"
|
|
46
|
+
is an instruction to go and read the other side of the contract, not to delete
|
|
47
|
+
the finding.
|
|
48
|
+
|
|
49
|
+
### Where the gate applies
|
|
50
|
+
|
|
51
|
+
The confidence gate filters what you **post**. It is not a filter on what you
|
|
52
|
+
are allowed to notice, to write down, or to hand to a later stage — and which of
|
|
53
|
+
those you are doing decides whether it fires at all.
|
|
54
|
+
|
|
55
|
+
- **You are producing the review** — writing `findings.json`, submitting a
|
|
56
|
+
formal review, or recording a verdict on a branch diff. **The gate fires.**
|
|
57
|
+
Everything in this section applies: yours is the last hand on the work before
|
|
58
|
+
a human reads it, so an ungrounded finding costs real credibility.
|
|
59
|
+
- **You are one pass of a multi-pass review** — discharging obligations and
|
|
60
|
+
appending hypotheses to a per-family file for a later phase to probe and
|
|
61
|
+
adjudicate. **The gate does not fire.** Record the mechanism you cannot yet
|
|
62
|
+
refute. Every downstream stage can only *remove*, so nothing there can recover
|
|
63
|
+
a hypothesis you declined to write down, and a pass that self-censors is
|
|
64
|
+
deleting evidence on behalf of a stage that has not run yet.
|
|
65
|
+
|
|
66
|
+
The split is measured, not stylistic. Google's AutoCommenter found a single
|
|
67
|
+
**global** confidence threshold (`t = 0.98`) catastrophic: roughly **80% of the
|
|
68
|
+
predictions it discarded as below-threshold were correct anyway**. Replacing it
|
|
69
|
+
with per-check thresholds raised recall without costing precision. So the gate
|
|
70
|
+
is worth having at the one point where a wrong finding is actually paid for, and
|
|
71
|
+
is expensive everywhere upstream of it.
|
|
39
72
|
|
|
40
73
|
### The gate cuts both ways
|
|
41
74
|
|
|
42
|
-
The gate
|
|
75
|
+
The confidence gate exists to stop *speculative* findings. It is not a reason to
|
|
43
76
|
approve a change you have not actually checked. Two failure modes, equally bad:
|
|
44
77
|
|
|
45
78
|
| Failure | What it looks like | Cost |
|
|
@@ -104,7 +137,11 @@ what makes a comment actionable rather than a vague worry.
|
|
|
104
137
|
parse/validate/emit responsibilities; ask for helper extraction. This is an
|
|
105
138
|
**Important** finding, not a nit.
|
|
106
139
|
- **Duplication** — flag avoidable duplicated logic (two or more clone groups of
|
|
107
|
-
the same code/branching). DRY is **should-fix** here, not merely "nice to
|
|
140
|
+
the same code/branching). DRY is **should-fix** here, not merely "nice to
|
|
141
|
+
have." This is about *logic*: a repeated **literal** — a constant, a URL, a
|
|
142
|
+
storage key appearing in source and its test, or on both sides of a stack —
|
|
143
|
+
is a finding only when this change makes the copies diverge in behaviour
|
|
144
|
+
(see "Not findings").
|
|
108
145
|
- **Type safety** — flag `as any`, unchecked `as`-casts, or `@ts-ignore` used to
|
|
109
146
|
silence the compiler or to bypass a validator the same code path defines.
|
|
110
147
|
- **Regression risk** — existing callers of changed functions; behaviour changes
|
|
@@ -117,6 +154,54 @@ what makes a comment actionable rather than a vague worry.
|
|
|
117
154
|
Say so explicitly, quoting the assertion.
|
|
118
155
|
- **Fit** — does it match the codebase's existing patterns and conventions?
|
|
119
156
|
|
|
157
|
+
## Not findings
|
|
158
|
+
|
|
159
|
+
The list above is what *counts*. This is what does **not**, however real it may
|
|
160
|
+
be. It is a **category** rule, not a confidence bar: "I am not certain this is
|
|
161
|
+
enforced" is not on it. Read it with "Where the gate applies" — a survey pass is
|
|
162
|
+
still told to over-produce, and the only thing this removes from that output is
|
|
163
|
+
noise it was never supposed to produce, never a mechanism it could not refute.
|
|
164
|
+
|
|
165
|
+
- **Pre-existing issues.** The change is adjacent to them; it did not cause them.
|
|
166
|
+
- **Anything a linter, typechecker or compiler would catch.** They already run,
|
|
167
|
+
and they are right more often than you are. The exception is an assertion that
|
|
168
|
+
*silences* one — `as any`, `@ts-ignore` — which is by definition something the
|
|
169
|
+
compiler does not catch (see Type safety).
|
|
170
|
+
- **Real issues on lines this PR did not touch — unless this PR is what makes
|
|
171
|
+
them wrong.** A consumer the diff never opened, now reading a shape the diff
|
|
172
|
+
moved, IS a finding and is the highest-value one there is (see Contracts).
|
|
173
|
+
What is excluded is a defect that was already there and still is.
|
|
174
|
+
- **Changes that are clearly intentional and part of the broader change.** If
|
|
175
|
+
the diff is doing X on purpose, "this does X" is a restatement, not a finding.
|
|
176
|
+
- **Points already deliberately silenced in the code** — an explicit
|
|
177
|
+
suppression, an ignore directive, a comment saying why. Someone already
|
|
178
|
+
decided; re-raising it costs the review's credibility and settles nothing.
|
|
179
|
+
- **Conventions the reviewed repository does not actually follow.** **The
|
|
180
|
+
repository's conventions govern — not yours, and not the ones it aspires
|
|
181
|
+
to.** If the merged code does not follow a convention, that convention is
|
|
182
|
+
aspirational and departing from it is not a finding. Do not flag missing
|
|
183
|
+
optional or "encouraged" fields. Read the surrounding code and the neighbours
|
|
184
|
+
of the file you are reviewing; they are the standard, not the style guide.
|
|
185
|
+
- **A repeated literal the merged code already repeats.** "This value is
|
|
186
|
+
hardcoded in two places" — a source file and its test, a frontend and its
|
|
187
|
+
backend — is the aspirational-convention rule in its most common costume.
|
|
188
|
+
If the copies agree and this change does not make them observably diverge,
|
|
189
|
+
sharing the constant is a Suggestion, not a finding. The moment this change
|
|
190
|
+
DOES let the copies disagree in behaviour it becomes a real finding — but
|
|
191
|
+
then say what diverges and for whom, not that a future edit needs two
|
|
192
|
+
keystrokes.
|
|
193
|
+
- **"X is never validated" with no consumer that misbehaves.** A missing check
|
|
194
|
+
is a finding when some input or caller reaches code that then does the wrong
|
|
195
|
+
thing — name that path. Validation nobody's misbehaviour depends on is a
|
|
196
|
+
design note.
|
|
197
|
+
- **Description staleness — though a doc's claims are checkable.** A PR
|
|
198
|
+
description that under- or over-describes the change's scope is a note for
|
|
199
|
+
the summary, not a finding. But a doc line, comment or example that asserts
|
|
200
|
+
something checkable about the code's behaviour which is **false at head** IS
|
|
201
|
+
a finding — the next reader will act on it — and so is an example that
|
|
202
|
+
contradicts the same file's guidance. The test: does the sentence make a
|
|
203
|
+
claim the code can falsify? Then check it like code; otherwise it is prose.
|
|
204
|
+
|
|
120
205
|
## Calibration
|
|
121
206
|
|
|
122
207
|
- Don't nitpick generated files (lockfiles, compiled assets).
|
|
@@ -1,19 +1,40 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: pr-review
|
|
3
|
-
description: Review a GitHub pull request and post one formal review — advance the existing discussion and give precision-first, high-signal feedback.
|
|
4
|
-
version: 7.
|
|
3
|
+
description: Review a GitHub pull request and post one formal review — advance the existing discussion and give precision-first, high-signal feedback. Judgement on the diff, not a build gate — CI validates that it builds, and a targeted probe is allowed as evidence. Use when asked to review a PR or on a cron PR scan.
|
|
4
|
+
version: 7.4.0
|
|
5
5
|
tags: [github, review, code-quality]
|
|
6
6
|
chat: true
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
# PR Review
|
|
10
10
|
|
|
11
|
-
Review an open PR — high-signal findings only.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
Review an open PR — high-signal findings only. Read the change and reason about
|
|
12
|
+
it; where reasoning cannot settle a question, **run something**. Installing the
|
|
13
|
+
repo's dependencies, opening the installed library source, and writing the
|
|
14
|
+
smallest file that exercises the behaviour and executing it are all **allowed
|
|
15
|
+
and expected** — that is a *probe*, and it is how a question about how code
|
|
16
|
+
actually behaves gets settled instead of guessed.
|
|
17
|
+
|
|
18
|
+
Two limits on a probe, and they are what keep it from becoming a second CI:
|
|
19
|
+
|
|
20
|
+
- **It must produce evidence you can quote.** Keep the command and its output,
|
|
21
|
+
and cite them in the finding that rests on them. "I ran it and it fails" with
|
|
22
|
+
nothing to quote is worth exactly what a guess is worth.
|
|
23
|
+
- **It is targeted at one question, never a re-derivation of CI.** Whether the
|
|
24
|
+
change builds and whether the suite is green are already answered — see §4.
|
|
25
|
+
Never spend a probe on those.
|
|
26
|
+
|
|
27
|
+
> **Why this is spelled out rather than left implicit.** An earlier version of
|
|
28
|
+
> this skill forbade installing dependencies, and the measured failure was not
|
|
29
|
+
> disobedience — it was the opposite. The reviewer referred to `WebClient` 32
|
|
30
|
+
> times and never once opened `node_modules/@slack`, because the workspace it
|
|
31
|
+
> was given had no `node_modules` at all. "Open the library source" was not
|
|
32
|
+
> ignored; it was structurally impossible. **An affordance you do not have reads
|
|
33
|
+
> to you as an instruction you cannot follow**, so what you *can* run is part of
|
|
34
|
+
> the contract, not an implementation detail.
|
|
35
|
+
|
|
36
|
+
Your job is judgement on the diff, not a build gate. A noisy review gets muted,
|
|
37
|
+
so precision matters more than volume.
|
|
17
38
|
|
|
18
39
|
You do **not** post the review yourself. You write your findings to a JSON file
|
|
19
40
|
(`.lastlight/pr-review/findings.json`) and a deterministic follow-up step posts
|
|
@@ -28,8 +49,17 @@ the precision bar and what-to-check rubric.
|
|
|
28
49
|
The harness pre-clones the PR's head ref and drops you **inside the checkout** —
|
|
29
50
|
your cwd **is** the repo (`ls -la` shows `.git/` directly; `AGENTS.md` is the
|
|
30
51
|
sibling one level up at `../`). Use `git`/`read`/`grep` from here. To refresh:
|
|
31
|
-
`git fetch origin <branch>
|
|
32
|
-
checkout is somehow missing,
|
|
52
|
+
`git fetch origin <branch> && git reset --hard FETCH_HEAD` — **no `--depth`**,
|
|
53
|
+
for the reason in §3. If the checkout is somehow missing,
|
|
54
|
+
`git clone https://github.com/{{owner}}/{{repo}}.git .`.
|
|
55
|
+
|
|
56
|
+
**Every `.lastlight/…` path in this skill and in any prompt is relative to that
|
|
57
|
+
cwd — use it relative, never absolute.** The skill files you were handed are
|
|
58
|
+
absolute paths under `…/.lastlight-skills/`, and that directory is a sibling of
|
|
59
|
+
the checkout, one level ABOVE you. Joining a `.lastlight/…` path onto the
|
|
60
|
+
directory your skills came from lands outside the repo and reads nothing. This
|
|
61
|
+
is measured, not hypothetical: it cost 23 of 120 survey branches their seeded
|
|
62
|
+
obligations across three runs on 2026-08-22.
|
|
33
63
|
|
|
34
64
|
**Read code from this local checkout, never the API.** Use `git`/`read`/`grep`
|
|
35
65
|
on disk for the diff and file contents. Do **not** call
|
|
@@ -103,13 +133,49 @@ contains a problem you raised, the correct `event` is still
|
|
|
103
133
|
|
|
104
134
|
### 3. Get the diff
|
|
105
135
|
|
|
136
|
+
**First, check whether it is already staged.** When the review evidence pipeline
|
|
137
|
+
is on, the deterministic `facts` phase resolves this range once and writes it
|
|
138
|
+
down: `.lastlight/pr-review/diff/index.md` lists every changed file with its
|
|
139
|
+
status, its changed line ranges and a per-file patch beside it under
|
|
140
|
+
`.lastlight/pr-review/diff/`. If that index is there, read it and the patches
|
|
141
|
+
instead of running the commands below — the range is already settled, and every
|
|
142
|
+
re-derivation is another chance to spell it two-dot. Those paths are relative to
|
|
143
|
+
this checkout; open them exactly as written. (If the index says NOT AVAILABLE, or
|
|
144
|
+
there is no `.lastlight/pr-review/diff/` at all, carry on here.)
|
|
145
|
+
|
|
106
146
|
From inside `<repo>/`:
|
|
107
147
|
```
|
|
108
|
-
|
|
148
|
+
# The harness already materialized origin/<baseRef>, deepening base AND head
|
|
149
|
+
# until they share a merge base. Verify that — do NOT re-fetch with --depth.
|
|
150
|
+
# Repair only if it's actually missing: deepen BOTH sides, because unshallowing
|
|
151
|
+
# the base alone leaves HEAD with no reachable ancestor and merge-base still fails.
|
|
152
|
+
git merge-base origin/<baseRef> HEAD >/dev/null 2>&1 || {
|
|
153
|
+
git fetch origin --unshallow || true
|
|
154
|
+
git fetch origin "+refs/heads/<baseRef>:refs/remotes/origin/<baseRef>" --unshallow || true
|
|
155
|
+
}
|
|
156
|
+
|
|
109
157
|
git diff --stat origin/<baseRef>...HEAD # churn
|
|
110
158
|
git diff origin/<baseRef>...HEAD # the patch
|
|
111
159
|
```
|
|
112
160
|
|
|
161
|
+
**Never `git fetch --depth N` in this checkout.** A depth-limited fetch writes
|
|
162
|
+
`.git/shallow` even into an already-complete clone, re-cutting history N commits
|
|
163
|
+
back from the base tip — which severs the merge base on any PR that forked
|
|
164
|
+
further back than that, and undoes the deepening the harness already paid for.
|
|
165
|
+
|
|
166
|
+
**Three dots, always.** `origin/<baseRef>...HEAD` is the merge-base diff and
|
|
167
|
+
matches GitHub's own PR diff. Two-dot (`git diff origin/<baseRef> HEAD`)
|
|
168
|
+
additionally contains every commit the base branch picked up since the PR
|
|
169
|
+
forked, and the author wrote none of it — measured across 50 real PRs, 9
|
|
170
|
+
diverge, one of them 6125 files against 3.
|
|
171
|
+
|
|
172
|
+
**If `merge-base` still fails after the repair**, the diff range could not be
|
|
173
|
+
established and you have nothing to review. Do not quietly fall back to two-dot
|
|
174
|
+
and review that instead. Write `event: "COMMENT"` — never `APPROVE` — with
|
|
175
|
+
`findings: []` and a `summary` saying the base and head share no reachable
|
|
176
|
+
history, then stop. Reviewing the wrong range and reporting success is the exact
|
|
177
|
+
failure this instruction exists to prevent.
|
|
178
|
+
|
|
113
179
|
### 4. Read what CI said
|
|
114
180
|
|
|
115
181
|
Your Context block carries `checksState` — `passing` / `failing` / `pending` /
|
|
@@ -125,16 +191,21 @@ speculate about whether this builds.**
|
|
|
125
191
|
line 42, which is the same issue as finding 2"* — and let it steer you toward
|
|
126
192
|
the part of the diff that is actually wrong.
|
|
127
193
|
- `checksState: pending` / `none` — no CI evidence either way. Review the code
|
|
128
|
-
as written
|
|
194
|
+
as written, and do **not** stand in for CI by building it or running the
|
|
195
|
+
suite — a matrix you cannot reproduce on one machine is not yours to guess at.
|
|
196
|
+
A targeted probe for one specific question is still fair game.
|
|
129
197
|
|
|
130
198
|
### 5. Assess and write your findings
|
|
131
199
|
|
|
132
200
|
Apply the **code-review** skill's rubric — read each changed file in context;
|
|
133
201
|
check correctness / **contracts** / edge-cases / security / regression-risk /
|
|
134
202
|
test-coverage.
|
|
135
|
-
Reason about the code statically
|
|
136
|
-
gate and it has already spoken (§4)
|
|
137
|
-
|
|
203
|
+
Reason about the code statically first, and spend nothing re-deriving whether it
|
|
204
|
+
builds — CI is the build gate and it has already spoken (§4). When a finding
|
|
205
|
+
turns on how the code *behaves* rather than on how it reads — library or
|
|
206
|
+
framework semantics, a lifecycle, an option interaction, an input the code does
|
|
207
|
+
not expect — settle it with a probe (see the top of this skill) and quote the
|
|
208
|
+
transcript in the finding's body.
|
|
138
209
|
Follow that skill's **precision-first** rule: keep **only Critical and Important**
|
|
139
210
|
findings, each anchored to a `path:line` with a one-line concrete impact (what
|
|
140
211
|
breaks, for which input or caller). Drop Suggestions and Nits.
|
|
@@ -173,8 +244,8 @@ the shape is:
|
|
|
173
244
|
"findings": [
|
|
174
245
|
{
|
|
175
246
|
"path": "src/foo.ts",
|
|
247
|
+
"existingCode": "the verbatim line(s) this finding is about",
|
|
176
248
|
"line": 42,
|
|
177
|
-
"side": "RIGHT",
|
|
178
249
|
"severity": "Critical",
|
|
179
250
|
"title": "Short label for the finding",
|
|
180
251
|
"body": "Concrete impact — what breaks, for which input or caller.",
|
|
@@ -190,11 +261,16 @@ SHA and diff from the harness's own context and the checkout, so you do **not**
|
|
|
190
261
|
record any of that metadata (that reliance was a footgun — omit it).
|
|
191
262
|
|
|
192
263
|
Rules:
|
|
193
|
-
- **
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
264
|
+
- **Quote the code; do not count the lines.** `existingCode` is the anchor of
|
|
265
|
+
record: copy the line(s) the finding is about character-for-character and the
|
|
266
|
+
harness finds them for you — in the file's own hunks, then the whole file, then
|
|
267
|
+
(on a *unique* match) elsewhere in the diff, which is how a finding filed
|
|
268
|
+
against the wrong half of a declaration/implementation pair still lands. `line`
|
|
269
|
+
and `side` are **advisory hints** that get overwritten; `start_line` is derived,
|
|
270
|
+
so do not set it. `path` should still match the diff path. An excerpt that
|
|
271
|
+
cannot be found is demoted to the summary body — nothing is lost, but an inline
|
|
272
|
+
comment at the defect site is worth much more, so copy carefully rather than
|
|
273
|
+
paraphrasing.
|
|
198
274
|
- `severity` is `Critical` or `Important` only.
|
|
199
275
|
- `suggestion` is optional — include it only when a concrete one-to-few-line fix
|
|
200
276
|
is obvious. It must be the exact replacement text for the anchored line(s),
|
|
@@ -4,7 +4,8 @@ The `pr-review` skill writes its findings to `.lastlight/pr-review/findings.json
|
|
|
4
4
|
(relative to the repo checkout — your cwd). The first-class `post-review` action
|
|
5
5
|
reads this file and posts **one** formal GitHub review:
|
|
6
6
|
|
|
7
|
-
- Each finding
|
|
7
|
+
- Each finding is anchored by matching its **`existingCode`** excerpt against the
|
|
8
|
+
diff. If the excerpt resolves to a line that appears in the PR diff, the finding
|
|
8
9
|
becomes an **inline comment** on that exact line.
|
|
9
10
|
- Any finding whose anchor isn't in the diff is **demoted** into the review body
|
|
10
11
|
under an "Additional findings" heading (GitHub rejects comments off the diff).
|
|
@@ -17,6 +18,12 @@ own run context and the checkout, so you do **not** record any of that metadata.
|
|
|
17
18
|
You never call `github_create_pull_request_review` yourself; writing this file is
|
|
18
19
|
how you submit.
|
|
19
20
|
|
|
21
|
+
> **Analysis mode writes a superset.** When the review evidence pipeline is on,
|
|
22
|
+
> the adjudicate phase owns this file and adds `tier` / `family` / `hypotheses` /
|
|
23
|
+
> `confidence` per finding and a `dropped[]` list. That contract lives in the
|
|
24
|
+
> adjudicate prompt (`workflows/prompts/review-adjudicate.md`); everything below
|
|
25
|
+
> is the shape both modes share.
|
|
26
|
+
|
|
20
27
|
## Top-level object
|
|
21
28
|
|
|
22
29
|
| Field | Type | Required | Meaning |
|
|
@@ -31,14 +38,38 @@ how you submit.
|
|
|
31
38
|
| Field | Type | Required | Meaning |
|
|
32
39
|
|---|---|---|---|
|
|
33
40
|
| `path` | string | yes | Repo-relative file path, matching the diff path exactly. |
|
|
34
|
-
| `
|
|
35
|
-
| `
|
|
36
|
-
| `
|
|
41
|
+
| `existingCode` | string | **yes** | The **verbatim excerpt** the finding is about, copied character-for-character out of the code. This is the anchor of record — see below. |
|
|
42
|
+
| `line` | number | no | **Advisory.** A hint at where the excerpt is; the harness derives the real line and overwrites this. Wrong is survivable, absent is fine. |
|
|
43
|
+
| `side` | string | no | `RIGHT` (added/context line — default) or `LEFT` (removed/context line). Also derived. |
|
|
44
|
+
| `start_line` | number | no | Derived for you from a multi-line `existingCode`. Do not set it. |
|
|
37
45
|
| `severity` | string | yes | `Critical` or `Important` only. |
|
|
38
46
|
| `title` | string | yes | Short label for the finding. |
|
|
39
47
|
| `body` | string | yes | Concrete impact — what breaks, for which input or caller. |
|
|
40
48
|
| `suggestion` | string | no | Exact replacement text for the anchored line(s). Rendered as an applyable ```suggestion block. Include only when a concrete one-to-few-line fix is obvious. |
|
|
41
49
|
|
|
50
|
+
## Quote the code; do not count the lines
|
|
51
|
+
|
|
52
|
+
**`existingCode` is how a finding gets anchored, and it is the field to get
|
|
53
|
+
right.** Models quote code accurately and count lines badly, so the harness stops
|
|
54
|
+
asking you to count: it takes your excerpt and finds it, in this order — the
|
|
55
|
+
file's own diff hunks, then the whole head-side file, then (on a *unique* match)
|
|
56
|
+
any other file in the diff, which is how a finding you filed against the wrong
|
|
57
|
+
file of a declaration/implementation pair still lands correctly.
|
|
58
|
+
|
|
59
|
+
Two rules follow:
|
|
60
|
+
|
|
61
|
+
- **Copy, never paraphrase.** Leading and trailing whitespace is ignored, nothing
|
|
62
|
+
else is. A reconstructed-from-memory excerpt does not match and the finding is
|
|
63
|
+
demoted to the review body.
|
|
64
|
+
- **Quote enough to be unique, and no more.** One distinctive line is usually
|
|
65
|
+
right. An excerpt that appears in two files is ambiguous and the harness
|
|
66
|
+
declines to guess rather than anchoring you to the wrong one.
|
|
67
|
+
|
|
68
|
+
A finding whose excerpt cannot be found is still **posted**, in the review body.
|
|
69
|
+
Nothing is lost by an excerpt that fails to resolve — but an inline comment at
|
|
70
|
+
the defect site is worth substantially more than a body entry, so it is worth
|
|
71
|
+
copying carefully.
|
|
72
|
+
|
|
42
73
|
## Example — findings with an inline suggestion
|
|
43
74
|
|
|
44
75
|
```json
|
|
@@ -49,8 +80,8 @@ how you submit.
|
|
|
49
80
|
"findings": [
|
|
50
81
|
{
|
|
51
82
|
"path": "src/cli.ts",
|
|
83
|
+
"existingCode": "const host = cfg.host;",
|
|
52
84
|
"line": 42,
|
|
53
|
-
"side": "RIGHT",
|
|
54
85
|
"severity": "Critical",
|
|
55
86
|
"title": "Null deref when --config is omitted",
|
|
56
87
|
"body": "`cfg.host` is undefined when no config file is passed, so every default-path invocation throws before connecting.",
|
|
@@ -58,8 +89,8 @@ how you submit.
|
|
|
58
89
|
},
|
|
59
90
|
{
|
|
60
91
|
"path": "src/connect.ts",
|
|
92
|
+
"existingCode": " disconnect();",
|
|
61
93
|
"line": 88,
|
|
62
|
-
"side": "RIGHT",
|
|
63
94
|
"severity": "Important",
|
|
64
95
|
"title": "Missing await on disconnect()",
|
|
65
96
|
"body": "`disconnect()` returns a promise that's never awaited, so the socket can leak if the caller exits immediately after."
|