Skip to content

Commit 6224394

Browse files
authored
update the rockout command with additional review ummph (#2093)
* update the rockout command with additional review ummph * updated with CI and merge conflict checks
1 parent 9244264 commit 6224394

1 file changed

Lines changed: 161 additions & 15 deletions

File tree

.claude/commands/rockout.md

Lines changed: 161 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -155,44 +155,190 @@ review-pr / follow-up loop runs in parallel. If CI surfaces a failure
155155
later, address it as a separate follow-up commit on the same branch --
156156
do not block the review pass on green CI.
157157

158-
## Step 9 -- Run the Domain-Aware PR Review
158+
## Step 9 -- Run the Domain-Aware PR Review and Post It as a GitHub Review
159+
160+
Every rockout PR MUST receive a review posted to GitHub as a proper review
161+
(not a plain issue comment), regardless of how clean the change looks. The
162+
review is the audit trail.
159163

160164
1. Invoke the `/review-pr` command against the PR number from Step 8:
161165
```
162166
/review-pr <PR_NUMBER>
163167
```
164-
2. Do not pass "post" -- keep the review local so the rockout workflow can act
165-
on the findings before any of it lands as a public comment.
168+
2. Do not pass "post" -- keep `/review-pr` from posting on its own. Rockout
169+
will post the review explicitly in step 5 below so it lands as a GitHub
170+
review event, not a free-form comment.
166171
3. Capture the structured output. It will list findings grouped as:
167172
- **Blockers** -- must fix before merge
168173
- **Suggestions** -- should fix, not blocking
169174
- **Nits** -- optional improvements
170175
4. Run this step regardless of CI status. Do not poll `gh pr checks` or
171176
wait for workflows to finish before invoking `/review-pr`.
177+
5. Post the captured review body to GitHub as a review event of type
178+
`COMMENT` so it shows up under the PR's Reviews tab (not just the
179+
Conversation tab). Use a heredoc to preserve formatting:
180+
```bash
181+
gh pr review <PR_NUMBER> --comment --body "$(cat <<'EOF'
182+
<humanized review body from /review-pr>
183+
EOF
184+
)"
185+
```
186+
- Use `--comment`, never `--approve` or `--request-changes`. Rockout
187+
does not have authority to approve its own work or block it.
188+
- If the review body is empty (no findings at all), still post a short
189+
review of type `--comment` summarizing that no issues were found, so
190+
every rockout PR has a visible review entry.
191+
- Confirm via `gh pr view <PR_NUMBER> --json reviews` that a review of
192+
state `COMMENTED` now exists on the PR before moving on.
172193
173194
## Step 10 -- Follow Up on Review Findings
174195
175-
Address every Blocker, then work through Suggestions and Nits in that order.
196+
Treat the review output as expert input, not a verdict. The reviewer is
197+
another LLM running a checklist -- it catches real issues, but it also
198+
flags false positives, misreads context, and occasionally invents
199+
problems. Your job is to weigh each finding against the actual code, not
200+
to mechanically apply every suggestion.
201+
202+
Address every Blocker first, then work through Suggestions and Nits in
203+
that order.
176204
177205
1. For each finding:
178-
- Read the referenced file at the cited line.
179-
- Decide one of: **fix**, **defer with reason**, or **dismiss with reason**.
180-
- Blockers must be either fixed or explicitly deferred with a written
181-
justification -- do not silently skip them.
182-
- Suggestions and nits may be dismissed when the cost outweighs the value,
183-
but record the reason.
206+
- Read the referenced file at the cited line and understand the
207+
surrounding context before deciding anything.
208+
- Verify the finding describes a real problem. If the reviewer
209+
misread the code, the cited line does not exist, or the
210+
"issue" is actually intended behavior, mark it **dismissed**
211+
and record the reason -- do not fix phantom bugs.
212+
- For Blockers: take them seriously, but they are not automatic.
213+
Confirm the issue is real before fixing. Real blockers must be
214+
either fixed or explicitly deferred with a written justification --
215+
do not silently skip them. A blocker you genuinely believe is
216+
wrong can be dismissed, but the dismissal note must explain why
217+
the reviewer was mistaken.
218+
- For Suggestions: consider each one seriously. Apply when the
219+
change clearly improves correctness, clarity, or performance.
220+
Dismiss when the suggestion conflicts with project conventions,
221+
would regress something else, or the cost outweighs the value.
222+
- For Nits: apply when trivially cheap and clearly an improvement.
223+
Dismiss when stylistic preference, churn for churn's sake, or
224+
not aligned with how the rest of the codebase is written.
225+
- In all cases, record the reason for dismiss / defer so the
226+
summary captures the reasoning, not just the verdict.
184227
2. Group related fixes into focused commits referencing the issue number
185228
(e.g. `Address review nits: fix NaN propagation in dask path (#<NUMBER>)`).
186229
3. After applying fixes:
187230
- Re-run the tests touched by the changes.
188231
- Push the new commits to the PR branch.
189-
4. Re-run `/review-pr <PR_NUMBER>` once after the follow-up commits to confirm
190-
the prior findings are resolved and no new ones surfaced. Stop iterating
191-
once only dismissed-with-reason items remain.
232+
4. Re-run `/review-pr <PR_NUMBER>` once after the follow-up commits, and
233+
post the follow-up review the same way as step 9.5 above
234+
(`gh pr review <PR_NUMBER> --comment --body ...`). Stop iterating once
235+
only dismissed-with-reason items remain.
192236
5. Summarize the disposition of each original finding (fixed / deferred /
193-
dismissed) in the final rockout summary so the trail is visible.
237+
dismissed, with the reason for dismissals) in the final rockout summary
238+
so the trail is visible.
239+
240+
**Do not skip this step.** Even if Step 9 returned no Blockers,
241+
Suggestions, or Nits, the review of type `COMMENTED` from step 9.5 must
242+
still be posted so every rockout PR carries a visible review entry.
194243
195-
**Skip this step** only if Step 9 returned no Blockers, Suggestions, or Nits.
244+
## Step 11 -- Resolve Merge Conflicts With `main`
245+
246+
After review follow-ups are done, sync the branch with `main` and resolve
247+
any conflicts before letting CI have the final word. Stay inside the
248+
worktree from Step 2 -- do NOT switch the main checkout.
249+
250+
1. Confirm you are still in `$ROCKOUT_WT` on branch `issue-<NUMBER>`:
251+
```bash
252+
[ "$(pwd)" = "$ROCKOUT_WT" ] || { echo "CWD drift"; exit 1; }
253+
[ "$(git branch --show-current)" = "issue-<NUMBER>" ] || { echo "branch drift"; exit 1; }
254+
```
255+
2. Fetch the latest `main` and check whether the branch is behind:
256+
```bash
257+
git fetch origin main
258+
git log --oneline HEAD..origin/main | head
259+
```
260+
If there are no new commits on `main`, skip to Step 12.
261+
3. Merge `origin/main` into the feature branch (prefer merge over rebase
262+
so the PR history stays stable for reviewers):
263+
```bash
264+
git merge --no-edit origin/main
265+
```
266+
4. If the merge reports conflicts:
267+
- Run `git status` and list every conflicted path.
268+
- For each conflicted file, read both sides, understand the intent,
269+
and edit the file to a resolution that preserves the feature work
270+
AND the incoming changes from `main`. Do NOT blindly accept one
271+
side with `git checkout --ours/--theirs` unless you have read the
272+
file and confirmed the other side is irrelevant.
273+
- After editing, `git add <file>` for each resolved path.
274+
- When all conflicts are resolved, finalize with `git commit` (no
275+
`-m` flag needed -- git will use the prepared merge message).
276+
5. Re-run the test suite touched by the change to confirm the merge did
277+
not break behaviour. If tests fail because of the merge, fix the
278+
root cause; do not paper over with skips.
279+
6. Push the merge commit to the PR branch:
280+
```bash
281+
git push origin issue-<NUMBER>
282+
```
283+
7. Confirm via `gh pr view <PR_NUMBER> --json mergeable,mergeStateStatus`
284+
that the PR is no longer in a conflicted state before moving on.
285+
286+
If the merge produces no conflicts and no test fallout, this step is a
287+
fast no-op. Run it anyway -- the goal is to know the PR is mergeable
288+
before CI failures get evaluated in Step 12.
289+
290+
## Step 12 -- Fix CI Failures
291+
292+
CI runs asynchronously after the push in Step 8 (and again after the
293+
follow-up pushes in Steps 10 and 11). This is the final gate: drive every
294+
required check to green before declaring the rockout done.
295+
296+
1. Poll the PR's check status until every check has completed (success
297+
or failure -- not pending):
298+
```bash
299+
gh pr checks <PR_NUMBER>
300+
```
301+
If checks are still running, wait and re-poll. Do not declare done
302+
while any required check is pending.
303+
2. For each failing check:
304+
- Pull the failing job's logs:
305+
```bash
306+
gh run view --log-failed --job <JOB_ID>
307+
```
308+
or open the run via `gh pr checks <PR_NUMBER> --watch` and drill
309+
into the failing job.
310+
- Read the actual failure (test name, traceback, lint rule, etc.).
311+
Do not guess from the check name.
312+
- Classify the failure:
313+
- **Real defect in the change** -- fix the code, add or update a
314+
test if coverage was missing, commit the fix.
315+
- **Pre-existing flake unrelated to the change** -- rerun the
316+
failed job once with `gh run rerun <RUN_ID> --failed`. If it
317+
passes, note it in the summary and move on. If it fails again
318+
in the same way, treat it as a real failure and fix it.
319+
- **Environment / infra issue** (cache miss, runner outage, token
320+
expiry) -- rerun the failed job. If it keeps failing for the
321+
same infra reason after one rerun, surface it to the user
322+
rather than hacking around it.
323+
3. For real defects, follow the same isolation rules as earlier steps:
324+
work inside `$ROCKOUT_WT` on `issue-<NUMBER>`, commit with a message
325+
referencing the issue (e.g. `Fix dask path NaN handling for CI (#<NUMBER>)`),
326+
and push to the PR branch.
327+
4. After each push, repeat from step 1 until every required check is
328+
green. Do not merge or hand off while any required check is red.
329+
5. If a check is genuinely not relevant to the change and cannot be
330+
made green (e.g. an unrelated workflow that is broken on `main`),
331+
record the reason in the final summary and flag it to the user --
332+
do not silently ignore red checks.
333+
6. Once all required checks are green, run the Step 11 conflict re-check
334+
one more time (`gh pr view <PR_NUMBER> --json mergeable,mergeStateStatus`)
335+
to confirm nothing landed on `main` while CI was running that would
336+
re-conflict the branch.
337+
338+
The rockout run is only complete when:
339+
- Every required CI check on the PR is green (or explicitly justified).
340+
- The PR reports `mergeable` with no conflicts against `main`.
341+
- The Step 9 / Step 10 review trail is posted.
196342
197343
---
198344

0 commit comments

Comments
 (0)