Skip to content

Commit c76b7d1

Browse files
andrewnesterIsaac
andauthored
pr-review skill: look beyond the diff when collecting context (#7466)
## Changes Adds context checks the skill lacked: distance from main and what moved there, stale generated files outside the diff, unexplained hunks, old values of changed constants and their copies, dead triggers, pinned third-party tools, goroutine fan-out bounds, schema regeneration for new YAML kinds, decision markers as stored values, messages left stale by a lifted restriction, and reading earlier review threads before posting. ## Why Each item was the main finding in a recent review and came from outside the skill. ## Tests Docs only. This pull request and its description were written by Isaac. Co-authored-by: Isaac <no-reply@databricks.com>
1 parent 1d69dfe commit c76b7d1

1 file changed

Lines changed: 50 additions & 5 deletions

File tree

‎.agents/skills/pr-review/SKILL.md‎

Lines changed: 50 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,25 @@ git diff "$BASE" "$TARGET"
2828
```
2929

3030
If the change has a PR, read its title and description to learn the intent.
31-
Do not read existing review comments before forming your own view.
31+
Do not read existing review comments before forming your own view. List the
32+
hunks the description does not explain: a fix riding along with the main
33+
change belongs in its own PR (`AGENTS.md`: one change per PR), so ask for
34+
the split.
35+
36+
Check how far the branch is from main with
37+
`git rev-list --count "$BASE"..origin/main` and
38+
`git merge-tree --write-tree "$TARGET" origin/main`. When the base is far
39+
behind, files the change touches may have moved, split or been deleted on
40+
main, and conventions it follows (changelog location, test matrix variables)
41+
may have changed. Those are judged at merge time, not at `TARGET`, so name
42+
the new location in the review body.
3243

3344
Read every changed non-generated file in full at `TARGET`, not just the hunks
3445
(`git show "$TARGET":path`). Skim generated files (schemas, codegen output,
35-
acceptance test output) only to confirm they follow from the source change.
46+
acceptance test output) only to confirm they follow from the source change;
47+
when the generator is cheap to run, regenerate into a temporary directory and
48+
`diff -r` it against the committed tree, since stale generated files outside
49+
the diff never show up in the hunks.
3650
Read the repo's agent rules that apply to the changed files, under
3751
`.agents/rules/` (testing, comments, language style guides).
3852

@@ -50,6 +64,19 @@ For every new type, function, flag, env var, config field, or code path:
5064
change does by hand: reading env vars, parsing booleans, normalizing paths
5165
or hosts, formatting errors, retrying. In this repo, `libs/env` has `Get`,
5266
`Lookup` and `GetBool`.
67+
- When the change edits a constant, regex or literal, also grep a distinctive
68+
fragment of the old value: copies of a constant do not share its name.
69+
Under a "keep in sync with X" comment, check every copy, not only the ones
70+
the comment lists, and check that the parity test has an input that
71+
exercises the change.
72+
- For every new option, flag or branch, find the concrete input that makes
73+
it do something (a file, a directory, an API response, a config value) and
74+
confirm that input can still be produced at `TARGET`. A mechanism whose
75+
trigger no longer exists is a finding.
76+
- When the change configures a pinned third-party action or tool, read that
77+
tool's README or source at the pinned version
78+
(`gh api repos/<owner>/<repo>/contents/README.md?ref=<sha>`) and verify
79+
each option and default the change relies on.
5380

5481
Note, for yourself, how the new code differs from each existing piece you
5582
find.
@@ -66,7 +93,11 @@ on code the change adds or modifies, not on pre-existing issues next to it.
6693
edge cases: nil or empty values, errors that are dropped or wrapped
6794
inconsistently, loops and early returns, concurrency and shared state,
6895
resources that aren't closed, off-by-one and ordering assumptions, and
69-
behavior that differs between platforms.
96+
behavior that differs between platforms. For a new goroutine fan-out,
97+
write down what bounds the number live at once and what each allocates;
98+
if the change ships a benchmark, run it with `-benchmem`. For bundle
99+
config changes, run the edge inputs through `bundle validate` in a
100+
scratch directory and quote the real output in the comment.
70101
Table: `line | input or state | what happens | is that right?`
71102
2. **One mechanism per job.** Does the change add a second way to do
72103
something the codebase already does, or copy logic that now has to be kept
@@ -104,14 +135,19 @@ on code the change adds or modifies, not on pre-existing issues next to it.
104135
Then check how the value is used: a presence-only check on an on/off
105136
switch means `false` and `0` turn it on. Check that new config fields
106137
follow how similar existing fields are declared, validated and documented.
138+
A field that newly accepts another YAML kind (a sequence where only a
139+
string was allowed) is new config API too: check that
140+
`bundle/schema/jsonschema.json` was regenerated to match.
107141
Table: `line | name | user-facing word or internal term? | how the value is
108142
used | existing precedent`
109143
7. **Stored values over time.** For every value the change writes to state,
110144
files or caches, write down when it is first written, when it is updated,
111145
and who reads it later. Ask whether it goes stale after the first write,
112146
whether comments and output describe that lifecycle correctly, and what
113147
should happen when the stored value disagrees with the source of truth
114-
(often: an error, not a silent fallback).
148+
(often: an error, not a silent fallback). A marker or feature flag the
149+
code reads to decide whether to act is a stored value too: list who
150+
writes it and whether the change's new write path sets it.
115151
Table: `value (line) | written when | updated when | read by | can it
116152
disagree with the source of truth, and what happens then?`
117153
8. **Every new doc comment.** List them. For Go:
@@ -165,7 +201,11 @@ on code the change adds or modifies, not on pre-existing issues next to it.
165201
(`.nextchanges/`), error message, warning and help text. It should be
166202
short, accurate and written for users, follow `.nextchanges/README.md`
167203
for changelog entries, and reuse an existing constant instead of
168-
repeating the same text in several places.
204+
repeating the same text in several places. When the change lifts or
205+
alters a restriction, grep for the existing messages that describe the
206+
old behavior (the refusal, its hint): no hunk touches them, yet the
207+
change makes them wrong. When the change is user-visible and adds no
208+
`.nextchanges/` fragment, ask for one.
169209

170210
Skip formatting, naming of internal identifiers, anything a linter catches,
171211
and questions about defensive checks.
@@ -221,6 +261,11 @@ short list if there are several.
221261
comment on the first and list the other locations in that comment. The
222262
review body doesn't repeat inline comments; use it for cross-cutting asks
223263
(missing tests, a design question that spans files).
264+
5. If the PR already has review threads, yours or another reviewer's, read
265+
them now. Drop a comment that repeats a point already raised there or
266+
that the author already answered (verification evidence often lives in a
267+
thread, not in the description), and add a short one where an earlier
268+
ask was not addressed.
224269

225270
## 5. Output
226271

0 commit comments

Comments
 (0)