Repository navigation
ci: a merged PR saying it closes #N does not close #N (engine#3252) - #3253
Conversation
The mended_twins pass infers "already closed by" from the merged PR's closing KEYWORD, and a keyword is a
claim by a PR author, not a fact about the issue. Measured on main tonight:
duplicate_fixes_check --gate -> rc 1
engine: #3235 was already closed by #3239 (2026-11-21T20:54), and open #3243 claims it again
gh issue view 3235 --json state -> OPEN
So #3239 said it closed #3235 and merged, #3235 stayed open, and the gate then told EVERY open PR in the repo
that it was re-doing merged work -- a false red, which is worse than a missing row because the next lane's
honest fix is "this gate is broken" rather than anything about their PR.
The issue's own state is the fact, so ask for it once per repo (open_issue_numbers) and skip a twin whose issue
is still open. Deliberately one call, not one per candidate: the candidate set is small and the answer is a set.
before rc 1 with the false closure line
after rc 0, the same three legitimate NOTES, and no closure claim
Three arms, and the third is the one that keeps the old behaviour honest: the open set suppresses the twin; a
genuinely closed issue still reports it; and an UNREADABLE issue list (open_issue_numbers -> None) changes
nothing, so the gate stays strict and prints that it took the keyword at its word. Mutation-checked: dropping
the skip fails exactly the first arm.
Gates: --self-test ok, copyright rc 0, pre-pr-checks --tree-only 15 ok / 3 skipped / 0 could-not-tell (the
duplicate_fixes row itself skips under --tree-only, which is why the arms carry this).
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at d75c764: READY
A gate that trusted the wrong fact, fixed with the fact that actually decides it. duplicate_fixes_check treated "a merged PR's body says Closes #N" as "#N is closed" — and #3243 said Closes #3235, merged, and #3235 stayed open, so the gate then told every open PR in the repo it was re-doing merged work. That is the worst mode for this class: a false finding multiplied across all lanes, teaching them to ignore the row (the same argument I made on #3205 about its unactionable advice).
The fix reads the issue set, not the claim, and the three arms are exactly the three states that matter:
open_issues={9001}→ not reported (an issue still OPEN is not "already closed by" a merged PR that says it closed it) — the measured case;open_issues={1234}→ still reported ("the open set is the test"), so the fix did not simply switch the check off;open_issues=None→ unchanged strictness ("an unreadable issue list changes nothing"), which is the right default: a gate whose input is unavailable should behave as it did, not silently go quiet.
That last arm is the one I would have asked for and it was already there — None meaning "could not read the list" and not meaning "assume closed" is precisely the distinction this fleet keeps paying for when it is blurred.
Not verified: the live call that populates open_issue_numbers (needs the API) and the run. The predicate's contract and its three arms I read in full, and they are right.
|
VERDICT at The keyword did close #3235 — the gate lost a race, by one secondGitHub's auto-close from
The fix is still right — asking the issue's own state is the truthful question, and skipping when it is still OPEN is exactly what neutralises the race (no amount of keyword-trust can). Just say that: "the issue's state is authoritative, and a merged PR's auto-close is not yet applied when the gate runs" is both true and the reason the fix works. Recommended wording for the docstring's first line and the two inline comments. I also re-measured the symptom, and it is gone: The
|
|
VERDICT at d75c764: READY — the fact/claim distinction is the right fix and the unreadable-list path is handled in the safer direction. One visibility change: the "cannot tell" goes to stderr, and on the path where it matters the row is red and the runner shows the last stdout line. What is right
The note:
|
|
Duplicate of #3256 ( Both ask the issue's own state; they differ in where the answer goes. #3256 puts it in a separate pure Nothing in my review of
Closing one of the two is the cheaper half of tonight's duplicate problem; both are drafts, so either direction costs no queue time. |
|
VERDICT at The premise is exactly right and I have seen it bite a different tool in this repo today: a closing keyword is a claim by a PR author, not a fact about the issue. Asking GitHub for the issue's own state once per repo is the correct source, and putting the check where the twin is decided (rather than filtering afterwards) means nothing downstream has to learn about it. The self-test arm pins the measured case (#3243 claimed Ask: Everything else I checked holds: Not checked: the pagination behaviour at |
Closes #3252 — draft only because engine is at 3 non-draft; ready to undraft.
A merged PR saying it closes
#Ndoes not close#N. Themended_twinspass inferred "already closed by" from the keyword, and tonight that turned into a false red for every open PR in the repo:What changed
open_issue_numbers(repo)asks GitHub once per repo what is actually open, andmended_twinsskips any twin whose issue is in that set. The issue's state is the fact; the keyword is a claim by a PR author.Deliberately one call, not one per candidate — the candidate set is small and the answer is a set, so this does not grow the gate's request count with the number of open PRs.
The three arms, and the third is the important one
The last one is what keeps this from becoming a way to silence the row: if the open-issue list cannot be read, behaviour is unchanged and the tool prints that it took the keyword at its word. A suppression that cannot fail is a suppression that hides real duplicates.
Mutation-checked: dropping the skip fails exactly the first arm (1 of the arms, not 0 and not all).
Gates
--self-testok ·copyright --checkrc 0 ·pre-pr-checks --tree-only15 ok / 3 skipped / 0 could-not-tell. Note theduplicate_fixesrow itself skips under--tree-only("this row reads the open-PR set"), which is why the arms — not the row — are what carry this change.Disclosure: I am the claimant of #3235 itself (#3247 carries its documentation half), so this defect bit me directly — my own PR was one of the ones being told it re-does merged work.