Repository navigation
feat(review): wait for pushes to settle before reviewing a push - #56
cipherstash-agent wants to merge 9 commits into
Conversation
A Push request fired at once, so a busy branch got a review, and a Claude session, for every push. A burst of pushes should get one review, of the last push. A new settle job runs between decide and fire, only for a Push fire. It waits for the new settle-minutes input (default 5, 0 for no wait, at most 30), then reads the pull request once with the job's own token. It passes the request on only if the pull request is still open, still ready and its head is still the commit after the push; otherwise it ends green with the skip superseded, draft or closed. Anything but a clear answer from GitHub, a bad wait value or a missing step file is the skip settle-check-failed with an error annotation. The check is steps/settle.py, run from the self-checkout like the other steps. The job holds only pull-requests: read and no secrets, and has no concurrency group, so a superseded request ends as a skip, never as a cancelled run, and a comment command never waits for it. The fire job needs the settle job and fires a Push request only on its result; every other kind still fires on the decision alone. Because GitHub skips a job with no status function once any job before it was skipped, the fire and react conditions now start with !cancelled(). The workflow's decision output is the settle job's decision for a push, so the run summary and callers see the final decision; the decide job's summary line for a push now says it is waiting. The self-test passes a one-minute wait, and its verify step passes a push that the settle wait skipped, since the newer push's run is the one tested. The job-condition evaluator moves into the test harness so the reusable workflow's conditions are tested too. Refs #53 Refs #50 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012Jmn7ojtaMx4z52zJA33Fo
A maintainer turning on Push reviews needs to know that a push waits before it is reviewed, how to change the wait, what the new skips mean and what the wait costs on a private repository, without reading the workflow. The README gains the settle-minutes input, the settle job, the superseded and settle-check-failed skips, the runner cost and how the self-test treats a superseded push. The example caller's header, and this repository's byte-for-byte copy of it, say the same in short. The glossary defines the settle wait. Refs #53 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012Jmn7ojtaMx4z52zJA33Fo
|
@cipherstash-agent review Draft pull request for #53, stacked on #55. Please review the whole pull request against its base Generated by Claude Code |
…le wait made it The self-test passed any push whose final decision was a superseded, draft or closed skip, on the reasoning that only the settle wait can make those for a push it tests. But the decide job also skips draft and closed pull requests, and the review workflow's final decision does not say which job wrote it. A regression in the request decision that skipped a ready push as draft would have passed as "Push not reviewed" instead of failing. The review workflow now also outputs the settle job's own decision as settle-decision, empty when the settle job did not run. The verify step passes a push's superseded, draft or closed skip only when that output is the same skip; a skip from the decide job fails, naming its reason, as it did before the settle wait. Refs #53 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012Jmn7ojtaMx4z52zJA33Fo
|
@cipherstash-agent review Head a1b9dc9. Please review the whole pull request against its base Generated by Claude Code |
…y-pr The base branch now gives Push requests a fire concurrency group of their own, so a push cannot replace a waiting comment command or requested reviewer request. Merged so the settle wait is tested against it. Refs #53 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012Jmn7ojtaMx4z52zJA33Fo
|
@cipherstash-agent review Please review this draft pull request (ticket #53, stacked on #55). Start with Generated by Claude Code |
… no push is reviewed The settle wait skips an earlier push as superseded and carries nothing forward, so the last push's request names only its own before..after range: an earlier push's commits are context, not changes to review. A newer push also supersedes when its own request is itself skipped, such as a bot's push, so then no push is reviewed. The README and glossary said the newer push's request always goes on; they now state both limits, which the ticket must still decide whether to change in behaviour. Also correct the contributor steps that named a renamed test and left the settle job out of the checkout-consistency test's jobs. Refs #53 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012Jmn7ojtaMx4z52zJA33Fo
|
@cipherstash-agent review Head 92e3d77. Please review the whole pull request against its base Generated by Claude Code |
…to feat/53-settle-before-review-push
…ith the next push Updates the settle wait's docs: the one review of a burst now covers the earlier pushes' commits. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012Jmn7ojtaMx4z52zJA33Fo
|
integration-test: received ready request from https://github.com/cipherstash/workflows/actions/runs/47458695851/attempts/1 Generated by Claude Code |
cipherstash-agent
left a comment
There was a problem hiding this comment.
Review attestation
Reviewed 62dce47 · posted from Claude Code · claude-opus-5-5 · effort medium (code-review)
Sources: code-review (medium) · claude-opus-5-5; mattpocock-skills:code-review, Standards and Spec axes · model unknown (sub-agents); findings verified at 62dce47 by review-cross-check sub-agents · model unknown
Skills: code-review, mattpocock-skills:code-review, company-skills:rust-security (loaded; the PR has no Rust files, so no rule applied), company-skills:review-cross-check, company-skills:review-post
Findings (11): 1 major, 10 minor. 10 inline, 1 below. Seven of the minor findings are code-smell judgement calls from the Standards axis, not hard violations. No documented repository standard was found to be broken.
- general minor No self-test run at
62dce47shows the two live acceptance criteria from #53: two pushes within the wait giving one reply, with the first runsuperseded; and a comment command sent during a wait. The body still says this pull request is a draft, but it is now ready, so both can be shown live; please link the runs. Source: mattpocock-skills:code-review, Spec axis · model unknown
Not posted inline: questions for the team (verification could not settle them from the code)
README.md:69says that a missing or invalid commit after the push asks for a review of the whole pull request.settle.py:61-63skips it assettle-check-failed(pinned bytest_settle.py:204-208). No realsynchronizeevent reaches this case, so the docs and thedecision.jqcomment are what disagree.- A bot push that supersedes a person's push means neither is reviewed until the next push is sent (documented as intended at
README.md:72). Is that the behaviour you want? - The 30-minute cap on
settle-minutes, and the newsettle-decisionoutput, were not asked for in #53. Keep them? - Should the self-test pass
draftandclosedsettle skips, or onlysuperseded? - Should "requested" in the run summary mean "decided to request" or "sent"? It is written before
fireruns, as it is for every other kind.
Refuted during verification: the settle step's missing summary line after an unexpected exception (no caller can produce one), and the whole-PR fallback for a push with no commit id being lost at runtime (GitHub always sends that id).
Generated by Claude Code
|
|
||
|
|
||
| def requested_pull_request(decision: str, sent: str, name: str, action: str) -> tuple[int, dict[str, Any]]: | ||
| def parsed(text: str) -> Any: |
There was a problem hiding this comment.
minor Possible Duplicated Code: the same "json.loads or None" logic is also hand-written at settle.py:51-54, settle.py:89-92, report.py:23-26, lookup.py:59-62 and verify.py:209-212. This PR moved text and summary into helpers.py; parsed could go there too.
Source: mattpocock-skills:code-review, Standards axis · model unknown
Generated by Claude Code
There was a problem hiding this comment.
Not changed. This is a judgement call from the Standards pass, not a broken repository standard, and refactoring shared helpers is out of scope for this pull request. It could be a follow-up.
Generated by Claude Code
|
|
||
| from helpers import Unreachable, error, github_headers, output, report_summary, send, summary | ||
|
|
||
| FAILED = '{"decision":"skip","reason":"settle-check-failed"}' |
There was a problem hiding this comment.
minor Possible Duplicated Code: the settle-check-failed literal is also at claude-review.yml:246 and :286, and tests/test_settle.py:270 exists only to keep the three equal. Some copying is unavoidable because a workflow expression cannot import Python, so this is a judgement call.
Source: mattpocock-skills:code-review, Standards axis · model unknown
Generated by Claude Code
There was a problem hiding this comment.
Not changed. This is a judgement call from the Standards pass, not a broken repository standard, and refactoring shared helpers is out of scope for this pull request. It could be a follow-up.
Generated by Claude Code
| } | ||
|
|
||
|
|
||
| def compact(value): |
There was a problem hiding this comment.
minor Possible Duplicated Code: compact() is copied here and in tests/test_settle_job.py:30, and it already exists in tests/test_report.py:23. Move it into tests/harness.py.
Source: mattpocock-skills:code-review, Standards axis · model unknown
Generated by Claude Code
There was a problem hiding this comment.
Not changed. This is a judgement call from the Standards pass, not a broken repository standard, and refactoring shared helpers is out of scope for this pull request. It could be a follow-up.
Generated by Claude Code
| decision = json.loads(value) | ||
| except ValueError: | ||
| decision = None | ||
| if not isinstance(decision, dict) or decision.get("decision") != "fire" or decision.get("kind") != "push": |
There was a problem hiding this comment.
minor Possible Repeated Switches: the "fire and kind push" check is also in report.py:44 and in the workflow's settle and fire conditions. The two Python copies could share one helper in helpers.py.
Source: mattpocock-skills:code-review, Standards axis · model unknown
Generated by Claude Code
There was a problem hiding this comment.
Not changed. This is a judgement call from the Standards pass, not a broken repository standard, and refactoring shared helpers is out of scope for this pull request. It could be a follow-up.
Generated by Claude Code
| return value if isinstance(value, str) else json.dumps(value) | ||
|
|
||
|
|
||
| def summary(decision: dict[str, Any], requested: str = "requested") -> str: |
There was a problem hiding this comment.
minor Possible Mysterious Name: requested holds any status phrase, such as report.py:45's "waiting for pushes to settle". A name like status says what it holds.
Source: mattpocock-skills:code-review, Standards axis · model unknown
Generated by Claude Code
There was a problem hiding this comment.
Not changed. This is a judgement call from the Standards pass, not a broken repository standard, and refactoring shared helpers is out of scope for this pull request. It could be a follow-up.
Generated by Claude Code
| pull_request = decision.get("pull_request") | ||
| number = pull_request.get("number") if isinstance(pull_request, dict) else None | ||
| if isinstance(number, bool) or not isinstance(number, int) or number < 1: | ||
| raise CheckFailed("The Push request names no pull request") |
There was a problem hiding this comment.
minor Possible Primitive Obsession: the pull request number is extracted and checked by hand here, at verify.py:169-172 and at helpers.py:69-70. A shared decision parser in helpers.py would remove the copies.
Source: mattpocock-skills:code-review, Standards axis · model unknown
Generated by Claude Code
There was a problem hiding this comment.
Not changed. This is a judgement call from the Standards pass, not a broken repository standard, and refactoring shared helpers is out of scope for this pull request. It could be a follow-up.
Generated by Claude Code
…e-review-push # Conflicts: # .github/workflows/claude-review.yml # .github/workflows/code-review.yml # CONTEXT.md # README.md # examples/claude-review.yml
|
integration-test: received push request from https://github.com/cipherstash/workflows/actions/runs/47460205006/attempts/1 Generated by Claude Code |
The review of 62dce47 found that the self-test passed any superseded, draft or closed skip the settle job wrote, so a settle wait that skipped every push stayed green. The verify step now reads the pull request and passes only when its head moved on, it is a draft, or it is closed, as the skip says. A settle job that ran but left no output, such as one whose runner was lost, now gives the settle-check-failed skip rather than the decide job's fire. Refs #53, #50 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012Jmn7ojtaMx4z52zJA33Fo
|
integration-test: received push request from https://github.com/cipherstash/workflows/actions/runs/47461054909/attempts/1 Generated by Claude Code |
Summary
A push to a ready pull request now waits before it is reviewed, so a burst of pushes gets one review, of the last push. The wait is the new
settle-minutesinput (default 5, 0 for no wait, at most 30). After the wait, the pull request is read once. If it is still open, still ready and its head is still the pushed commit, the review goes ahead. Otherwise the run ends green with the skipsuperseded,draftorclosed. Comment commands never wait.Stack position: this is the second pull request in a stack. Its base is
feat/52-review-push-ready-pr(#55), which is itself based onmain. Nothing is stacked above it. It is ticket #53 under #50.Changes
.github/workflows/): a newsettlejob runs betweendecideandfire, only for a Push fire. It holds onlypull-requests: read, uses no secrets and has no concurrency group, so a superseded run ends as a skip and never as a cancelled run. Thefirejob fires a Push request only on the settle result. Every other kind still fires on the decision alone. Thefireandreactjobs start with!cancelled(), so a skipped settle job does not stop a comment command or its reaction. The workflow also outputssettle-decision, the settle job's own decision.steps/settle.py): waits, then reads the pull request once with the job's own token. Anything but a clear answer from GitHub (error status, redirect, timeout, dropped connection, non-JSON, wrong shape, answer over 1 MiB), a bad wait value or a missing step file is the skipsettle-check-failedwith one error annotation..github/workflows/self-test.yml,steps/verify.py): passessettle-minutes: 1. A push skipped as superseded, draft or closed passes as "Push not reviewed" only when the settle job made that skip. A skip from the decide job still fails.tests/):test_settle.py(local HTTP stub),test_settle_job.py(job structure), plus additions to the permission, decision-file, Python-step, own-caller and verify tests.pyproject.tomllists the two new test files for mypy.README.md,CONTEXT.md,examples/): describe the input, the new skip reasons, the runner cost on private repositories (about 5 billed minutes per push at the default) and the self-test's 1-minute wait. The glossary defines Push and the settle wait. The example caller's header and its byte-for-byte copy carry the same change.Verification
Run locally, with the real results:
python3 -m unittest discover --start-directory tests: passed, 296 tests OK, on Python 3.13 only (CI runs 3.10, 3.12 and 3.14). Run after merging the base branch.ruff check(version pinned in.github/python-checks/requirements.txt): passed. Used--output-format=concisebecause the sandbox refused thegithubformat command.mypy: passed, no issues in 24 source files.request-decision/test-runner: passed.request-decision/test: passed, 103 cases, 0 failed.actionlintv1.7.12 (prebuilt binary, run over the workflows andexamples/claude-review.yml): passed, no findings.go run [email protected]was refused by the sandbox.zizmor1.32.0--persona=regular: passed only with--offline --format=plain(no findings, 3 ignored, 17 suppressed). The online run failed with HTTP 401 through the proxy, so the online audits did not run..github/scripts/check-lock: not run.gh actions-lockis not installed here. Left to CI.Acceptance criteria (#53)
tests/test_settle.pycovers head unchanged, the superseded, draft and closed skips, each failure to get a clear answer (error status, redirect, timeout, non-JSON, not a pull request, oversized) assettle-check-failedwith an error, and a wait of 0.pull-requests: read, no secrets, the shared checkout settings, and runs only for a Push fire. Met:test_settle_job.py,test_permissions.pyandtest_python_steps.py.superseded. Open. Not verified end to end. It needs the self-test on a real push to a ready pull request, and this pull request is a draft. The superseded path and the verify mapping are covered by unit tests only.tests/test_own_caller.py). A comment command's run neither waits for nor queues behind a Push wait.zizmorandcheck-lock, which could not run (see Verification). CI is the gate for both.Related
Refs #53 and #50. The base is not the default branch, so a
Closes #53line does not link this pull request; it is linked to #53 separately. Stacked on #55.Review notes
Start with
steps/settle.py, then thesettleandfirejobs in the reusable workflow. The branch is stacked, so it is not re-signed by rebase. This sandbox has no allowed-signers file, sogit log %G?showsNfor all four commits; GitHub's own verification badge is the check to trust.🤖 Generated with Claude Code
https://claude.ai/code/session_012Jmn7ojtaMx4z52zJA33Fo