The approving act approves only a pull request open at the commit, and an approval from before a reopening never stands (#378)
Closes #378.
GitHub takes an approval of a closed pull request (P-7.refused case 1). Once the pull request is reopened with no push, it reads that approval as APPROVED again (P-7.refused case 4). This PR closes both holes. Record 0079 holds all three parts. It extends 0055 and does not edit it.
What changes
- Before the approval (
adapters/effects.py). The act reads the pull request and checks it is open at the commit it approves.- If the pull request is closed or merged, the act is refused:
superseded,not_open. - If it is at another head, the act is refused:
superseded,head_moved. - In both cases nothing is sent.
- If the pull request can't be read, the act is refused, and the fault is whatever its status says.
- If the pull request is closed or merged, the act is refused:
- After the approval (
adapters/effects.py, the ruling's (b)). Once the approval is read back, the pull request is read again.- If it was closed or merged under the act, the act records
failed,superseded,closed_under_act, with no landed Effect. Reconciliation (decision 0061) then names the approval while the pull request is served in its window. - If the pull request can't be read, the act claims nothing.
- If it was closed or merged under the act, the act records
- The Kernel rule (
kernel/derive.py, the ruling's (c)).standing_approvalcounts the machine user's approval only if it was submitted after the pull request was last reopened.- This is a new required fact,
last_reopened_at, read from the timeline'sreopenedevent. - On a timeline not read whole, no approval stands. A reopening time that can't be read makes the Kernel defer.
- It is derived from facts at every call, with no write, so an approval given while the pull request was closed never converges, even before anyone dismisses it.
- This is a new required fact,
- Recovery (
harness/approve.py). The act recovers an approval only while the pull request is open, and never one submitted before its last reopening.- A re-run after a close claims nothing.
- After a reopening, the act sends a fresh approval.
- The comment in
effects.pythat assumed GitHub refuses a close is corrected.
facts/1 gains last_reopened_at in the schema, the port (timeline.reopened_at and facts.snapshot), all 51 examples, the test support and the pull request's world. Both simulators still pass on 40 seeds.
Fixture
trials/P-7.reopened.json is case 4's redacted read by the trials lane: the REST timeline and the reviews of canary pull request 61 after its reopening. The timeline shows a reopened event by the Maintainer, a User, at 03:11:05Z. The machine user's approval from 02:55:47Z, given while 61 was closed, reads APPROVED again. The same evidence is in a comment on #378.
Gates
-
Claude review with a security pass: it found two majors, both confirmed by probes, and both in the recovery step:
- after a reopening, the act could never re-approve;
- a re-run after a close claimed the approval GitHub took.
Both are fixed in 6439672, with tests and mutants.
-
Muse: it raised the same reopening deadlock as a blocker, plus a minor: an unreadable reopening time was not deferred. That is fixed too.
-
AGY: not run (quota). Argon's review is owed.
-
Mutants: every new one, and each repointed one, was checked to apply once, parse and be killed.
Verify
make verify passes on a fresh export, except the context check: 0079 waits on 0078.
🤖 Generated with Claude Code
Summary by CodeRabbit
- New Features
- Approval status now reflects pull request reopenings: approvals submitted before or at the latest reopening no longer count, and a fresh approval can be submitted afterward.
- Approval requests are checked against the pull request’s open state and current commit before and after submission.
- Bug Fixes
- Closed or merged pull requests are distinguished from pull requests whose commit has changed, including when they close during approval.
- Incomplete or unreadable timeline information no longer results in an approval being treated as valid.