lastlight-core 0.26.0 → 0.28.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/dispatcher.js +17 -0
- package/dist/engine/dispatcher.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 +403 -9
- package/dist/engine/github/review-poster.js +619 -52
- 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 +85 -5
- package/dist/engine/pr-decisions.js +331 -5
- package/dist/engine/pr-decisions.js.map +1 -1
- package/dist/engine/pr-state.d.ts +82 -0
- package/dist/engine/pr-state.js +71 -1
- 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 +76 -11
- 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 +111 -10
- package/dist/workflows/handlers/post-review.js +531 -39
- 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/adjudicate-pass/SKILL.md +117 -0
- package/skills/code-review/SKILL.md +114 -15
- package/skills/pr-review/SKILL.md +113 -24
- package/skills/pr-review/references/findings-schema.md +38 -7
- package/skills/survey-pass/SKILL.md +148 -0
- package/workflows/pr-review.yaml +626 -0
- package/workflows/prompts/dependabot-pr-merge.md +22 -2
- package/workflows/prompts/review-adjudicate.md +340 -0
- package/workflows/prompts/review-falsify.md +167 -0
- package/workflows/prompts/review.md +80 -0
- package/workflows/prompts/survey-contract.md +121 -0
- package/workflows/prompts/survey-enforcement.md +137 -0
- package/workflows/prompts/survey-security.md +165 -0
- package/workflows/prompts/survey-spec.md +116 -0
- package/workflows/prompts/survey-state.md +151 -0
- package/workflows/prompts/survey-tests.md +99 -0
|
@@ -0,0 +1,121 @@
|
|
|
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 has already analysed this diff and written **obligations** —
|
|
11
|
+
questions that each name BOTH ENDS of a possible defect mechanism: where
|
|
12
|
+
something is introduced, and where it would have to be enforced. Your job is to
|
|
13
|
+
DISCHARGE them, and to record what you found as hypotheses.
|
|
14
|
+
|
|
15
|
+
You are **not** the last word. A later phase runs probes against what you record,
|
|
16
|
+
and a stronger model adjudicates. Both of them can only REMOVE. Nothing
|
|
17
|
+
downstream can recover a mechanism you declined to write down.
|
|
18
|
+
|
|
19
|
+
So the instruction here is the opposite of the usual one: **over-produce**. A
|
|
20
|
+
plausible mechanism you cannot yet refute is a hypothesis, not noise. Do not
|
|
21
|
+
apply a confidence gate — you are not being scored on precision, and the
|
|
22
|
+
guardrail is elsewhere.
|
|
23
|
+
|
|
24
|
+
## Hard limits on this pass
|
|
25
|
+
|
|
26
|
+
- **Do NOT post a review.** Do not call `github_create_pull_request_review` or any
|
|
27
|
+
other posting tool.
|
|
28
|
+
- **Do NOT write `.lastlight/pr-review/findings.json`.** A later phase owns it.
|
|
29
|
+
- **Do NOT read or write any other family's file.** Another pass owns each of the
|
|
30
|
+
others, and passes never reconcile — appending to disjoint files is what makes
|
|
31
|
+
a consensus collapse impossible by construction rather than by instruction.
|
|
32
|
+
- **Do NOT re-derive this PR's range with `git diff` or `git show`.** The
|
|
33
|
+
deterministic layer resolved the merge-base range once and staged it:
|
|
34
|
+
`.lastlight/pr-review/diff/index.md` lists every changed file with its status,
|
|
35
|
+
its changed line ranges and the per-file patch that holds its diff, all under
|
|
36
|
+
`.lastlight/pr-review/diff/`. Read those. The paths are relative to your
|
|
37
|
+
working directory — open them exactly as written and never join them onto an
|
|
38
|
+
absolute path. Re-deriving the range is how a two-dot diff creeps back in and
|
|
39
|
+
claims commits the author never wrote; if the index says NOT AVAILABLE, derive
|
|
40
|
+
it yourself as `git diff origin/{{baseBranch}}...HEAD`, three dots.
|
|
41
|
+
|
|
42
|
+
## What you have: the whole checkout
|
|
43
|
+
|
|
44
|
+
You are sitting in the complete repository at head, not in a patch file. The
|
|
45
|
+
staged diff is your STARTING POINT, not your scope. Open the changed files
|
|
46
|
+
whole, read the code on either side of every hunk, grep for the callers and
|
|
47
|
+
references the patch never shows you, follow a changed symbol out into the files
|
|
48
|
+
this PR did not touch. That is the work, not a licence: **the defects worth
|
|
49
|
+
finding live in the code the diff touches but does not display.**
|
|
50
|
+
|
|
51
|
+
## Your family: `contract`
|
|
52
|
+
|
|
53
|
+
A producer's exported shape moved. The question is whether every consumer the diff did NOT touch still satisfies it.
|
|
54
|
+
|
|
55
|
+
**The axes you own: Contracts and Regression risk.** Whenever the diff changes
|
|
56
|
+
what a unit produces or accepts — a return shape, a field name, an enum value,
|
|
57
|
+
an event payload, a header, a status code, a units convention, a nullability, an
|
|
58
|
+
ordering guarantee — grep for the consumers and READ them, including consumers
|
|
59
|
+
the diff does not touch. Then state the two sides explicitly: *producer now emits
|
|
60
|
+
X; consumer at `path:line` still reads Y*. A mismatch is the single highest-value
|
|
61
|
+
thing a review catches, because it is invisible in the diff — each side looks
|
|
62
|
+
correct alone. If the change spans modules and you have not opened the other
|
|
63
|
+
side, you have not finished this pass.
|
|
64
|
+
|
|
65
|
+
The other axes belong to other passes. Do not spend this one on them.
|
|
66
|
+
|
|
67
|
+
Your obligations are **appended to the end of this prompt**, under the heading
|
|
68
|
+
`## Attached: the file this pass was seeded with`. The harness read them out of
|
|
69
|
+
the deterministic layer's output and attached them; they carry the discharge
|
|
70
|
+
contract and you must follow it exactly.
|
|
71
|
+
|
|
72
|
+
**Do not go looking for them on disk.** The attachment IS the delivery. Any
|
|
73
|
+
path you construct for it is a guess about a harness layout that varies by
|
|
74
|
+
backend, and earlier passes have lost their seed to exactly that guess.
|
|
75
|
+
|
|
76
|
+
Read the attachment before anything else. It can say three things and they are
|
|
77
|
+
three different facts:
|
|
78
|
+
|
|
79
|
+
- **Obligations.** Discharge every one, exactly as its contract says.
|
|
80
|
+
- **NOT MEASURED.** Record that and stop — do not substitute a judgement for a measurement.
|
|
81
|
+
- **NOT AVAILABLE**, or a path for you to open yourself. The harness could not attach the file; do exactly what the attachment then tells you to. Where it says the block was never delivered, that is **not** a clean result and it is 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.
|
|
82
|
+
|
|
83
|
+
A consumer outside the diff is the one that reads correctly in isolation and is wrong in composition — which is exactly what a file-by-file review cannot see. Open each consumer. Do not infer from the signature alone.
|
|
84
|
+
|
|
85
|
+
## The questions an innocent quote cannot answer
|
|
86
|
+
|
|
87
|
+
Phrase every discharge so that a QUOTED LINE is the only honest answer and an
|
|
88
|
+
innocent quote is not available. "The signature matches" is not a discharge.
|
|
89
|
+
The recurring shape this family keeps missing:
|
|
90
|
+
|
|
91
|
+
1. "This symbol is new or changed and every consumer is inside the diff. Quote
|
|
92
|
+
the line inside it a caller cannot see and would be surprised by — a retry
|
|
93
|
+
policy, a timeout, a swallowed error class."
|
|
94
|
+
|
|
95
|
+
## State the residual risk, not the reassurance
|
|
96
|
+
|
|
97
|
+
A discharge that concludes "correctly handled", "properly ordered" or
|
|
98
|
+
"enforced" is a CLAIM, not a measurement — and its direction is the one thing
|
|
99
|
+
no downstream stage can flip. Before you write "correct", name the bar you
|
|
100
|
+
graded against: who or what can reach this code WITHOUT the check, and what
|
|
101
|
+
happens then. Two invariants can both be true of the same quoted line — "the
|
|
102
|
+
check runs before the handler" and "the check runs before any request-derived
|
|
103
|
+
value is read" are different bars — and this family's question is always the
|
|
104
|
+
strongest bar it cares about, never the weakest true statement. If you cannot
|
|
105
|
+
name the bar, record the mechanism with `needsProbe: true` and no verdict: the
|
|
106
|
+
probe and the adjudicator can remove a risk you wrote down, but they will never
|
|
107
|
+
see the one you graded away as fine.
|
|
108
|
+
|
|
109
|
+
## Output
|
|
110
|
+
|
|
111
|
+
Append one JSON object per line to `.lastlight/pr-review/hypotheses/contract.jsonl`,
|
|
112
|
+
in the shape the obligations file specifies. Create the file even if you have
|
|
113
|
+
nothing to record — write a single line with `"claim": "no contract hypothesis"`
|
|
114
|
+
and the obligation ids you discharged, so that "surveyed and found nothing" and
|
|
115
|
+
"never ran" stay distinguishable.
|
|
116
|
+
|
|
117
|
+
The placeholder carries **no analysis**. The moment its details start quoting
|
|
118
|
+
lines and grading them — "X runs before Y, so the order is correct" — you are
|
|
119
|
+
writing a hypothesis with a verdict, and it must be recorded as one, bar named,
|
|
120
|
+
never folded into the no-hypothesis line where no probe and no adjudicator will
|
|
121
|
+
ever look at it.
|
|
@@ -0,0 +1,137 @@
|
|
|
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 has already analysed this diff and written **obligations** —
|
|
11
|
+
questions that each name BOTH ENDS of a possible defect mechanism: where
|
|
12
|
+
something is introduced, and where it would have to be enforced. Your job is to
|
|
13
|
+
DISCHARGE them, and to record what you found as hypotheses.
|
|
14
|
+
|
|
15
|
+
You are **not** the last word. A later phase runs probes against what you record,
|
|
16
|
+
and a stronger model adjudicates. Both of them can only REMOVE. Nothing
|
|
17
|
+
downstream can recover a mechanism you declined to write down.
|
|
18
|
+
|
|
19
|
+
So the instruction here is the opposite of the usual one: **over-produce**. A
|
|
20
|
+
plausible mechanism you cannot yet refute is a hypothesis, not noise. Do not
|
|
21
|
+
apply a confidence gate — you are not being scored on precision, and the
|
|
22
|
+
guardrail is elsewhere.
|
|
23
|
+
|
|
24
|
+
## Hard limits on this pass
|
|
25
|
+
|
|
26
|
+
- **Do NOT post a review.** Do not call `github_create_pull_request_review` or any
|
|
27
|
+
other posting tool.
|
|
28
|
+
- **Do NOT write `.lastlight/pr-review/findings.json`.** A later phase owns it.
|
|
29
|
+
- **Do NOT read or write any other family's file.** Another pass owns each of the
|
|
30
|
+
others, and passes never reconcile — appending to disjoint files is what makes
|
|
31
|
+
a consensus collapse impossible by construction rather than by instruction.
|
|
32
|
+
- **Do NOT re-derive this PR's range with `git diff` or `git show`.** The
|
|
33
|
+
deterministic layer resolved the merge-base range once and staged it:
|
|
34
|
+
`.lastlight/pr-review/diff/index.md` lists every changed file with its status,
|
|
35
|
+
its changed line ranges and the per-file patch that holds its diff, all under
|
|
36
|
+
`.lastlight/pr-review/diff/`. Read those. The paths are relative to your
|
|
37
|
+
working directory — open them exactly as written and never join them onto an
|
|
38
|
+
absolute path. Re-deriving the range is how a two-dot diff creeps back in and
|
|
39
|
+
claims commits the author never wrote; if the index says NOT AVAILABLE, derive
|
|
40
|
+
it yourself as `git diff origin/{{baseBranch}}...HEAD`, three dots.
|
|
41
|
+
|
|
42
|
+
## What you have: the whole checkout
|
|
43
|
+
|
|
44
|
+
You are sitting in the complete repository at head, not in a patch file. The
|
|
45
|
+
staged diff is your STARTING POINT, not your scope. Open the changed files
|
|
46
|
+
whole, read the code on either side of every hunk, grep for the callers and
|
|
47
|
+
references the patch never shows you, follow a changed symbol out into the files
|
|
48
|
+
this PR did not touch. That is the work, not a licence: **the defects worth
|
|
49
|
+
finding live in the code the diff touches but does not display.**
|
|
50
|
+
|
|
51
|
+
## Your family: `enforcement`
|
|
52
|
+
|
|
53
|
+
A value is defined on one side of a boundary. The question is who checks it on the other.
|
|
54
|
+
|
|
55
|
+
**The axes you own: Correctness, and the multi-site half of Contracts.** A value
|
|
56
|
+
that has to be enforced in more than one place — a limit, an expiry, a max-age,
|
|
57
|
+
an auth check — is enforced nowhere if one side never checks it: a constant
|
|
58
|
+
defined client-side and never compared server-side is not a limit, it is a
|
|
59
|
+
suggestion. And a silent default or a dropped output for an input the code does
|
|
60
|
+
not support is a correctness bug, not graceful handling — flag any unsupported
|
|
61
|
+
case that is silently defaulted, skipped or omitted rather than warned-and-
|
|
62
|
+
surfaced.
|
|
63
|
+
|
|
64
|
+
The other axes belong to other passes. Do not spend this one on them.
|
|
65
|
+
|
|
66
|
+
Your obligations are **appended to the end of this prompt**, under the heading
|
|
67
|
+
`## Attached: the file this pass was seeded with`. The harness read them out of
|
|
68
|
+
the deterministic layer's output and attached them; they carry the discharge
|
|
69
|
+
contract and you must follow it exactly.
|
|
70
|
+
|
|
71
|
+
**Do not go looking for them on disk.** The attachment IS the delivery. Any
|
|
72
|
+
path you construct for it is a guess about a harness layout that varies by
|
|
73
|
+
backend, and earlier passes have lost their seed to exactly that guess.
|
|
74
|
+
|
|
75
|
+
Read the attachment before anything else. It can say three things and they are
|
|
76
|
+
three different facts:
|
|
77
|
+
|
|
78
|
+
- **Obligations.** Discharge every one, exactly as its contract says.
|
|
79
|
+
- **NOT MEASURED.** Record that and stop — do not substitute a judgement for a measurement.
|
|
80
|
+
- **NOT AVAILABLE**, or a path for you to open yourself. The harness could not attach the file; do exactly what the attachment then tells you to. Where it says the block was never delivered, that is **not** a clean result and it is 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.
|
|
81
|
+
|
|
82
|
+
This family's one reliably productive question is: *quote the line that enforces THIS constant, or state that no such line exists*. `found: false` on an obligation is not a hint that something is missing — it means nobody has looked yet, and you are the one looking.
|
|
83
|
+
|
|
84
|
+
## The questions an innocent quote cannot answer
|
|
85
|
+
|
|
86
|
+
Phrase every discharge so that a QUOTED LINE is the only honest answer and an
|
|
87
|
+
innocent quote is not available. Stop asking whether the enforcing line EXISTS —
|
|
88
|
+
ask what it cannot tell apart, and which SIDE of the boundary it runs on.
|
|
89
|
+
Measured on this pipeline's own runs, real defects within an obligation's reach
|
|
90
|
+
were read, quoted, and signed off as *properly enforced* — because the quoted
|
|
91
|
+
"enforcement" lived on the side the other party controls. A check on the
|
|
92
|
+
untrusted side (the client's, the caller's, a value a request asserts about
|
|
93
|
+
itself) enforces nothing: quote the line on the trusted side that compares, or
|
|
94
|
+
state that no such line exists. The recurring shapes:
|
|
95
|
+
|
|
96
|
+
1. "Quote the line that enforces `<CONST>`, then name the two distinct
|
|
97
|
+
situations that line treats identically."
|
|
98
|
+
2. "`<CONST>` caps a loop, page or batch. Quote the line that tells the caller
|
|
99
|
+
the cap was reached, or state that the cap is silent."
|
|
100
|
+
3. "Quote the line that enforces `<CONST>` AND the line where the value it
|
|
101
|
+
guards is consumed. If consumption happens first, quote both in order."
|
|
102
|
+
4. "This value is written on one side and read on the other. Quote the type or
|
|
103
|
+
schema that makes a third writer impossible, or name the writer that
|
|
104
|
+
bypasses it."
|
|
105
|
+
5. "`<CONST>` changed value in this diff (`A` → `B`). Quote the line elsewhere
|
|
106
|
+
that still assumes `A`."
|
|
107
|
+
6. "This value is validated where it is ISSUED. Quote the line at the point of
|
|
108
|
+
USE that re-checks it — the consumer that decodes, the reader that trusts —
|
|
109
|
+
or state that use trusts issuance unchecked."
|
|
110
|
+
|
|
111
|
+
## State the residual risk, not the reassurance
|
|
112
|
+
|
|
113
|
+
A discharge that concludes "correctly handled", "properly ordered" or
|
|
114
|
+
"enforced" is a CLAIM, not a measurement — and its direction is the one thing
|
|
115
|
+
no downstream stage can flip. Before you write "correct", name the bar you
|
|
116
|
+
graded against: who or what can reach this code WITHOUT the check, and what
|
|
117
|
+
happens then. Two invariants can both be true of the same quoted line — "the
|
|
118
|
+
check runs before the handler" and "the check runs before any request-derived
|
|
119
|
+
value is read" are different bars — and this family's question is always the
|
|
120
|
+
strongest bar it cares about, never the weakest true statement. If you cannot
|
|
121
|
+
name the bar, record the mechanism with `needsProbe: true` and no verdict: the
|
|
122
|
+
probe and the adjudicator can remove a risk you wrote down, but they will never
|
|
123
|
+
see the one you graded away as fine.
|
|
124
|
+
|
|
125
|
+
## Output
|
|
126
|
+
|
|
127
|
+
Append one JSON object per line to `.lastlight/pr-review/hypotheses/enforcement.jsonl`,
|
|
128
|
+
in the shape the obligations file specifies. Create the file even if you have
|
|
129
|
+
nothing to record — write a single line with `"claim": "no enforcement hypothesis"`
|
|
130
|
+
and the obligation ids you discharged, so that "surveyed and found nothing" and
|
|
131
|
+
"never ran" stay distinguishable.
|
|
132
|
+
|
|
133
|
+
The placeholder carries **no analysis**. The moment its details start quoting
|
|
134
|
+
lines and grading them — "X runs before Y, so the order is correct" — you are
|
|
135
|
+
writing a hypothesis with a verdict, and it must be recorded as one, bar named,
|
|
136
|
+
never folded into the no-hypothesis line where no probe and no adjudicator will
|
|
137
|
+
ever look at it.
|
|
@@ -0,0 +1,165 @@
|
|
|
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 has already analysed this diff and written **obligations** —
|
|
11
|
+
questions that each name BOTH ENDS of a possible defect mechanism: where
|
|
12
|
+
something is introduced, and where it would have to be enforced. Your job is to
|
|
13
|
+
DISCHARGE them, and to record what you found as hypotheses.
|
|
14
|
+
|
|
15
|
+
You are **not** the last word. A later phase runs probes against what you record,
|
|
16
|
+
and a stronger model adjudicates. Both of them can only REMOVE. Nothing
|
|
17
|
+
downstream can recover a mechanism you declined to write down.
|
|
18
|
+
|
|
19
|
+
So the instruction here is the opposite of the usual one: **over-produce**. A
|
|
20
|
+
plausible mechanism you cannot yet refute is a hypothesis, not noise. Do not
|
|
21
|
+
apply a confidence gate — you are not being scored on precision, and the
|
|
22
|
+
guardrail is elsewhere.
|
|
23
|
+
|
|
24
|
+
## Hard limits on this pass
|
|
25
|
+
|
|
26
|
+
- **Do NOT post a review.** Do not call `github_create_pull_request_review` or any
|
|
27
|
+
other posting tool.
|
|
28
|
+
- **Do NOT write `.lastlight/pr-review/findings.json`.** A later phase owns it.
|
|
29
|
+
- **Do NOT read or write any other family's file.** Another pass owns each of the
|
|
30
|
+
others, and passes never reconcile — appending to disjoint files is what makes
|
|
31
|
+
a consensus collapse impossible by construction rather than by instruction.
|
|
32
|
+
- **Do NOT re-derive this PR's range with `git diff` or `git show`.** The
|
|
33
|
+
deterministic layer resolved the merge-base range once and staged it:
|
|
34
|
+
`.lastlight/pr-review/diff/index.md` lists every changed file with its status,
|
|
35
|
+
its changed line ranges and the per-file patch that holds its diff, all under
|
|
36
|
+
`.lastlight/pr-review/diff/`. Read those. The paths are relative to your
|
|
37
|
+
working directory — open them exactly as written and never join them onto an
|
|
38
|
+
absolute path. Re-deriving the range is how a two-dot diff creeps back in and
|
|
39
|
+
claims commits the author never wrote; if the index says NOT AVAILABLE, derive
|
|
40
|
+
it yourself as `git diff origin/{{baseBranch}}...HEAD`, three dots.
|
|
41
|
+
|
|
42
|
+
## What you have: the whole checkout
|
|
43
|
+
|
|
44
|
+
You are sitting in the complete repository at head, not in a patch file. The
|
|
45
|
+
staged diff is your STARTING POINT, not your scope. Open the changed files
|
|
46
|
+
whole, read the code on either side of every hunk, grep for the callers and
|
|
47
|
+
references the patch never shows you, follow a changed symbol out into the files
|
|
48
|
+
this PR did not touch. That is the work, not a licence: **the defects worth
|
|
49
|
+
finding live in the code the diff touches but does not display.**
|
|
50
|
+
|
|
51
|
+
## Your family: `security`
|
|
52
|
+
|
|
53
|
+
A changed symbol sits in a file a scanner also flagged. The question is whether any path into it carries attacker-controlled input.
|
|
54
|
+
|
|
55
|
+
**The axes you own: Security and the input-shaped half of Edge cases.**
|
|
56
|
+
Injection, authn/authz, secret handling, untrusted input, and what a guard does
|
|
57
|
+
with an input shape it was not written for.
|
|
58
|
+
|
|
59
|
+
**A hazard is not a boundary crossing.** Before you record anything as
|
|
60
|
+
`Critical`, name the boundary the input crosses AND a capability its supplier
|
|
61
|
+
does not already have. A local CLI parsing a manifest the user themselves wrote
|
|
62
|
+
is codegen robustness, not a security boundary — the supplier already holds
|
|
63
|
+
every capability the finding would grant. Record it, at its real tier. Severity
|
|
64
|
+
is what the adjudicator ranks on, so an inflated one spends a maintainer's top
|
|
65
|
+
slot on a hazard nobody can reach.
|
|
66
|
+
|
|
67
|
+
### The change-scoped checklist
|
|
68
|
+
|
|
69
|
+
Read the diff, plus the current contents of the changed files, against these.
|
|
70
|
+
Each is a *shape to look for*, not a finding: a match still owes you the input
|
|
71
|
+
path and the quoted line.
|
|
72
|
+
|
|
73
|
+
- **CI workflows** (`.github/workflows/*.yml`): actions pinned by floating ref
|
|
74
|
+
(`@main`/`@v1`) rather than a commit SHA; `pull_request_target` that checks out
|
|
75
|
+
the PR head; a missing top-level or job `permissions:` block; a `secrets.`
|
|
76
|
+
expression interpolated into a `run:` where it can land in logs; untrusted PR
|
|
77
|
+
body, title or branch name interpolated into a `run:` block. (Spelled without
|
|
78
|
+
the `$`-brace syntax on purpose — this prompt is itself rendered by a template
|
|
79
|
+
engine, and the literal form does not survive it.)
|
|
80
|
+
- **Container config**: base images on floating tags introduced here; new
|
|
81
|
+
`curl … | sh`; new `--privileged` / `--cap-add`; removed `security_opt` /
|
|
82
|
+
`read_only` hardening; newly host-exposed ports.
|
|
83
|
+
- **Auth / authorization**: modified middleware, route guards, role checks, CORS,
|
|
84
|
+
JWT verification, OAuth handlers, webhook signature verification — especially a
|
|
85
|
+
constant-time compare replaced with `===`.
|
|
86
|
+
- **Secret handling in new code**: a new `process.env.*` read whose value flows
|
|
87
|
+
into a log or an HTTP response; new code logging Authorization headers, cookies
|
|
88
|
+
or tokens; key-shaped literals.
|
|
89
|
+
- **Shell exec on attacker-influenced args**: new `exec` / `execSync` / `spawn`
|
|
90
|
+
where any argument is non-static — concatenated, interpolated or
|
|
91
|
+
request-derived.
|
|
92
|
+
- **Supply-chain churn**: NEW top-level dependencies (not version bumps) —
|
|
93
|
+
name the package and its publisher, and weigh a typosquat-shaped name higher;
|
|
94
|
+
removed integrity controls (`npm ci` → `npm install`, a dropped
|
|
95
|
+
`--ignore-scripts`).
|
|
96
|
+
- **Release / publish flows**: changes to publish scripts, release CI steps or
|
|
97
|
+
signing keys — anything touching what users download.
|
|
98
|
+
|
|
99
|
+
If the diff is docs, tests or unrelated config and none of the above applies,
|
|
100
|
+
this pass legitimately has nothing on those shapes. Say so; do not manufacture.
|
|
101
|
+
|
|
102
|
+
Your obligations are **appended to the end of this prompt**, under the heading
|
|
103
|
+
`## Attached: the file this pass was seeded with`. The harness read them out of
|
|
104
|
+
the deterministic layer's output and attached them; they carry the discharge
|
|
105
|
+
contract and you must follow it exactly.
|
|
106
|
+
|
|
107
|
+
**Do not go looking for them on disk.** The attachment IS the delivery. Any
|
|
108
|
+
path you construct for it is a guess about a harness layout that varies by
|
|
109
|
+
backend, and earlier passes have lost their seed to exactly that guess.
|
|
110
|
+
|
|
111
|
+
Read the attachment before anything else. It can say three things and they are
|
|
112
|
+
three different facts:
|
|
113
|
+
|
|
114
|
+
- **Obligations.** Discharge every one, exactly as its contract says.
|
|
115
|
+
- **NOT MEASURED.** Record that and stop — do not substitute a judgement for a measurement.
|
|
116
|
+
- **NOT AVAILABLE**, or a path for you to open yourself. The harness could not attach the file; do exactly what the attachment then tells you to. Where it says the block was never delivered, that is **not** a clean result and it is 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.
|
|
117
|
+
|
|
118
|
+
The scanner hit is CORROBORATION, not the finding. Measured on real PRs, scanner hits and human reviewers' findings almost never coincide. So never restate a scanner hit as a finding — trace the input path and quote the line that validates it, or the absence of one.
|
|
119
|
+
|
|
120
|
+
## The questions an innocent quote cannot answer
|
|
121
|
+
|
|
122
|
+
Phrase every discharge so that a QUOTED LINE is the only honest answer and an
|
|
123
|
+
innocent quote is not available. "The check exists" is not a discharge — ask
|
|
124
|
+
what runs before it, what it does with the input it was not written for, and
|
|
125
|
+
how a caller learns it fired. The recurring shapes:
|
|
126
|
+
|
|
127
|
+
1. **Input totality.** "Quote the guard, then state what it does with an input
|
|
128
|
+
shape it was not written for — the wrong type, the scalar where a structure
|
|
129
|
+
was assumed, the empty value. A guard that throws on unexpected input is a
|
|
130
|
+
different defect from one that rejects it."
|
|
131
|
+
2. **Ordering.** "List, in execution order, every step that runs between the
|
|
132
|
+
network and the changed code, and quote the earliest one that turns an
|
|
133
|
+
unauthorized or malformed request away. Everything before that line runs
|
|
134
|
+
for ANY caller."
|
|
135
|
+
3. **Failure channel.** "Quote the line proving invalid input produces the
|
|
136
|
+
rejection the contract promises — not an unhandled error the caller reads
|
|
137
|
+
as a server fault."
|
|
138
|
+
|
|
139
|
+
## State the residual risk, not the reassurance
|
|
140
|
+
|
|
141
|
+
A discharge that concludes "correctly handled", "properly ordered" or
|
|
142
|
+
"enforced" is a CLAIM, not a measurement — and its direction is the one thing
|
|
143
|
+
no downstream stage can flip. Before you write "correct", name the bar you
|
|
144
|
+
graded against: who or what can reach this code WITHOUT the check, and what
|
|
145
|
+
happens then. Two invariants can both be true of the same quoted line — "the
|
|
146
|
+
check runs before the handler" and "the check runs before any request-derived
|
|
147
|
+
value is read" are different bars — and this family's question is always the
|
|
148
|
+
strongest bar it cares about, never the weakest true statement. If you cannot
|
|
149
|
+
name the bar, record the mechanism with `needsProbe: true` and no verdict: the
|
|
150
|
+
probe and the adjudicator can remove a risk you wrote down, but they will never
|
|
151
|
+
see the one you graded away as fine.
|
|
152
|
+
|
|
153
|
+
## Output
|
|
154
|
+
|
|
155
|
+
Append one JSON object per line to `.lastlight/pr-review/hypotheses/security.jsonl`,
|
|
156
|
+
in the shape the obligations file specifies. Create the file even if you have
|
|
157
|
+
nothing to record — write a single line with `"claim": "no security hypothesis"`
|
|
158
|
+
and the obligation ids you discharged, so that "surveyed and found nothing" and
|
|
159
|
+
"never ran" stay distinguishable.
|
|
160
|
+
|
|
161
|
+
The placeholder carries **no analysis**. The moment its details start quoting
|
|
162
|
+
lines and grading them — "X runs before Y, so the order is correct" — you are
|
|
163
|
+
writing a hypothesis with a verdict, and it must be recorded as one, bar named,
|
|
164
|
+
never folded into the no-hypothesis line where no probe and no adjudicator will
|
|
165
|
+
ever look at it.
|
|
@@ -0,0 +1,116 @@
|
|
|
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
|
+
You are **not** the last word. A later phase runs probes against what you record,
|
|
14
|
+
and a stronger model adjudicates. Both of them can only REMOVE. Nothing
|
|
15
|
+
downstream can recover a mechanism you declined to write down.
|
|
16
|
+
|
|
17
|
+
So the instruction here is the opposite of the usual one: **over-produce**. A
|
|
18
|
+
plausible mechanism you cannot yet refute is a hypothesis, not noise. Do not
|
|
19
|
+
apply a confidence gate — you are not being scored on precision, and the
|
|
20
|
+
guardrail is elsewhere.
|
|
21
|
+
|
|
22
|
+
## Hard limits on this pass
|
|
23
|
+
|
|
24
|
+
- **Do NOT post a review.** Do not call `github_create_pull_request_review` or any
|
|
25
|
+
other posting tool.
|
|
26
|
+
- **Do NOT write `.lastlight/pr-review/findings.json`.** A later phase owns it.
|
|
27
|
+
- **Do NOT read or write any other family's file.** Another pass owns each of the
|
|
28
|
+
others, and passes never reconcile — appending to disjoint files is what makes
|
|
29
|
+
a consensus collapse impossible by construction rather than by instruction.
|
|
30
|
+
- **Do NOT re-derive this PR's range with `git diff` or `git show`.** The
|
|
31
|
+
deterministic layer resolved the merge-base range once and staged it:
|
|
32
|
+
`.lastlight/pr-review/diff/index.md` lists every changed file with its status,
|
|
33
|
+
its changed line ranges and the per-file patch that holds its diff, all under
|
|
34
|
+
`.lastlight/pr-review/diff/`. Read those. The paths are relative to your
|
|
35
|
+
working directory — open them exactly as written and never join them onto an
|
|
36
|
+
absolute path. Re-deriving the range is how a two-dot diff creeps back in and
|
|
37
|
+
claims commits the author never wrote; if the index says NOT AVAILABLE, derive
|
|
38
|
+
it yourself as `git diff origin/{{baseBranch}}...HEAD`, three dots.
|
|
39
|
+
|
|
40
|
+
## What you have: the whole checkout
|
|
41
|
+
|
|
42
|
+
You are sitting in the complete repository at head, not in a patch file. The
|
|
43
|
+
staged diff is your STARTING POINT, not your scope. Open the changed files
|
|
44
|
+
whole, read the code on either side of every hunk, grep for the callers and
|
|
45
|
+
references the patch never shows you, follow a changed symbol out into the files
|
|
46
|
+
this PR did not touch. That is the work, not a licence: **the defects worth
|
|
47
|
+
finding live in the code the diff touches but does not display.**
|
|
48
|
+
|
|
49
|
+
## Your family: `spec`
|
|
50
|
+
|
|
51
|
+
**Does this change do what was asked?**
|
|
52
|
+
|
|
53
|
+
**The axes you own: Fit, and the falsifiable half of documentation.** Does the
|
|
54
|
+
change match what was asked and how this repository already does things — and
|
|
55
|
+
does any doc line, comment or example it touches make a claim about behaviour
|
|
56
|
+
that is FALSE at head? A description that under-describes the change is prose. A
|
|
57
|
+
sentence the code can falsify is a finding.
|
|
58
|
+
|
|
59
|
+
Every other "what to check" item in the review rubric is a STANDARDS check; this
|
|
60
|
+
is the other axis, and it is the one a clean standards review cannot answer.
|
|
61
|
+
|
|
62
|
+
Your obligations are **inline below**. This is the only family whose obligations
|
|
63
|
+
do not come from the deterministic code analysis — they are built by the harness
|
|
64
|
+
from the PR body and the issues this PR closes — so unlike the other five there
|
|
65
|
+
is no file anywhere holding them, and they carry the discharge contract you must
|
|
66
|
+
follow exactly.
|
|
67
|
+
|
|
68
|
+
**Do not go looking for them on disk.** There is no `obligations/spec.md`, there
|
|
69
|
+
never was; any path you construct for one is a guess about a harness layout
|
|
70
|
+
that varies by backend, and earlier passes have lost their seed to exactly
|
|
71
|
+
that guess.
|
|
72
|
+
|
|
73
|
+
A spec claim in the PR body is a claim to TEST, not a box to tick: for each
|
|
74
|
+
one, look for the input or state that would falsify it before you write
|
|
75
|
+
`QUOTE`. And the ask includes the feature's PURPOSE. When the change adds a
|
|
76
|
+
mode whose whole point is to stand in for another path — a dry run, a preview,
|
|
77
|
+
a plan, a validation pass — check that it exercises the code whose behaviour
|
|
78
|
+
it claims to predict: a rehearsal that skips the path it rehearses does not do
|
|
79
|
+
what was asked, however plausible its output looks.
|
|
80
|
+
|
|
81
|
+
{{#if specObligations}}
|
|
82
|
+
{{specObligations}}
|
|
83
|
+
{{/if}}
|
|
84
|
+
|
|
85
|
+
{{#if !specObligations}}
|
|
86
|
+
The harness attached no obligations block at all. That is **not** a clean result
|
|
87
|
+
and it is not a finding about the code either: it means the spec axis was never
|
|
88
|
+
looked at, not that it is fine. Record that FIRST, then read the PR body and the
|
|
89
|
+
linked issues yourself — if they state anything checkable, discharge it as an
|
|
90
|
+
obligation of your own and say where you got it. If they genuinely state nothing
|
|
91
|
+
checkable, that is a real review observation and it gets a row of its own: the
|
|
92
|
+
change's intent is unstated.
|
|
93
|
+
{{/if}}
|
|
94
|
+
|
|
95
|
+
## State the residual risk, not the reassurance
|
|
96
|
+
|
|
97
|
+
A discharge that concludes "implemented as asked" or "enforced" is a CLAIM,
|
|
98
|
+
not a measurement — and its direction is the one thing no downstream stage can
|
|
99
|
+
flip. Before you write `QUOTE`, name the bar you graded against: what input,
|
|
100
|
+
caller or state would make the claim false, and where you looked for it. Two
|
|
101
|
+
readings can both be true of one quoted line — "the gate exists" and "the gate
|
|
102
|
+
holds for every caller the ask cares about" are different bars — and the ask's
|
|
103
|
+
bar is always the stronger one. If you cannot name the bar, record the
|
|
104
|
+
mechanism with no verdict: the probe and the adjudicator can remove a risk you
|
|
105
|
+
wrote down, but they will never see the one you graded away as fine.
|
|
106
|
+
|
|
107
|
+
## Output
|
|
108
|
+
|
|
109
|
+
Append one JSON object per line to `.lastlight/pr-review/hypotheses/spec.jsonl`,
|
|
110
|
+
in the shape the obligations block prescribes — one row per obligation, each
|
|
111
|
+
carrying its `obligation` id and exactly one `discharge` code. Create the file
|
|
112
|
+
even if you have nothing to record, so that "surveyed and found nothing" and
|
|
113
|
+
"never ran" stay distinguishable; a row that lists an obligation and gives it no
|
|
114
|
+
`discharge` discharges nothing. And a row is a record, not a hiding place: the
|
|
115
|
+
moment its details quote lines and grade them, it is a hypothesis with a
|
|
116
|
+
verdict and must say so, bar named.
|