Repository navigation
fix(release): re-read a reused release pull request's head before adopting it - #1184
Conversation
|
Security: PASS at 6c179d7
|
HugoXK-bot
left a comment
There was a problem hiding this comment.
Verdict: PASS at 6c179d7
The refusal is inside the reuse branch and the candidate stays in sameBranch: scripts/release-open.mjs:277-279 refuses a foreign head from the list payload, :280-286 refuses a non-200 readback and maintainer_can_modify === true, and :289 still takes conflicting = sameBranch[0] — the candidate is never dropped, which is what keeps POST /pulls unreachable on this path. I checked that claim by patching a scratch copy of this head to drop the candidate out of sameBranch instead: test/releaseOpen.test.ts:252 then returns opened (a real POST), so the zero-POST pin is a refusal, not a filter.
The two shapes that must stay accepted are pinned on both sides: test/releaseOpen.test.ts:269 (maintainer_can_modify: false, the normal same-repo value, #575) and :280 (key omitted) answer reused at exit 0, and both are green at the base too, so the fix cannot pass by refusing everything.
Red→green reproduced myself: the new test file over base source 25d0c459 gives 28/31 with not ok 3/4/7 — the fork, foreign-head and unreadable-readback rows; at this head 31/31.
Non-blocking: the runbook summary at docs/deploy.md:498-499 words the rule as "a flag that does not read back", while it is a flag that reads back true — an omitted key stays a reuse (#575) — so that phrase reads backwards beside the precise sentence at :502-505.
Ran:
- npx tsx --test test/releaseOpen.test.ts (at 6c179d7: 31/31 pass; same file over base source 25d0c45: 28/31, the three refusal rows red)
- curl GET /repos/HugoXK/fledge/check-runs/136404974720, 136402340701, 136402339855, 136402511432, 136402511455 — ci-ok, test (24), coverage, codeql-required and build all completed/success on 6c179d7
- node patch of a scratch copy of this head that filters the candidate out of sameBranch — test/releaseOpen.test.ts:252 flips to
opened, which is what makes the zero-POST assertion a refusal pin
Not run: fullnpm run checkand the real release workflow — CI test (24)/lint/typecheck cover the suite at this sha, and no token-holding run or live GitHub write was made.
Written-by: HugoXK-bot
|
Written-by: Fledge Platform Lead Record for the merge — two points that were raised and are now closed; neither changes this tip.
The requirement "every PR carries Check count, one canonical reading at
The four extra run objects are re-runs after the PASS: T3 PASS at this tip: review |
The reuse branch answered `reused` from the open-pull-request list alone, so a
head the create path would refuse was adopted green. The list item names the
head repository for free and `GET /pulls/{number}` carries the flag the create
path checks; a failing reading is refused on the spot, never dropped from the
candidate set, so the path can only turn `reused` into `refused` and never open
a second pull request on the same branch.
Written-by: HugoXK
Author: Fledge Platform Dev-1
Fixes #1183
What changed
scripts/release-open.mjsansweredreusedfromGET /pulls?state=openalone: the inlinefindat:265matched branch, head sha and release title and returned at:269, before theGET /pulls/{number}readback the create path makes at:370-379. A pull request whose head the create path would refuse was adopted green on the next run, andexitCodeFormade it exit 0.The reuse path now reads the head before it adopts the pull request, and refuses on the spot when a reading fails:
:276-279— the list item already names the head repository, so a head in another repository (head.repo.full_name !== repo) is refused without a request;:280-286— otherwise the run re-readsGET /pulls/{number}and refuses whenmaintainer_can_modify === true, exactly as the create path does at:377-379;:281-283— a readback that cannot be made (non-200) is a refusal too: a reuse that cannot be checked is not a reuse.Each refusal carries
pr. The candidate is not removed fromsameBranch: refusing inside the branch is what keepsPOST /pullsunreachable. Falling through toconflicting = sameBranch[0](:289) would depend on a second open pull request existing; with the candidate filtered out, the same run would open a second pull request on the same branch.test/releaseOpen.test.ts:237pins that with the plan set to release: a filter-based fix posts and fails.maintainer_can_modify: falseand an omitted key stay non-fatal on the reuse path, exactly as on the create path (#575).Files
scripts/release-open.mjs— the reuse branch's head check and its three refusals.test/releaseOpen.test.ts— per-number readback map inmakeServer(/pulls/{n}answers for the reused 201 as well as the created 210), the fork row and the unreadable-readback row (red before the fix), the same-repo and omitted-key rows (green before and after, so the fix cannot pass by refusing everything), andhead.repo.full_nameon the existing reuse row at:220.docs/deploy.md— the reuse promise gains its condition (:496-501), and the "next run reuses that pull request" clause (:508-509) now says the next run re-reads the head and either reuses it or refuses it again. The owner-closes sentence is untouched.changelog.d/1183.fixed.md— one fragment; this is a user-visible behaviour change.Red before, green after
Red on the unbroken tip
25d0c459(the branch base),npx tsx --test test/releaseOpen.test.ts:Green at
6c179d754a587811d8072052ccfb42cf597a32f6, same command:# tests 31 / # pass 31 / # fail 0.Ran:
npm run checkat6c179d75(tree5225b93f) — exit 0;# tests 3264 / # pass 3264 / # fail 0; lint, typecheck and build passnode scripts/risk-gate.mjs --base origin/main—risk-tier: T3; basis: scripts/release-open.mjsnode scripts/changelog.mjs check—changelog: 22 fragment(s) oknode scripts/version.mjs check—version: 0.4.4 oknode scripts/secret-scan.mjs—secret:scan: no suspected value in the tracked filesNot run: the nightly release workflow itself (it runs in Actions); a live readback against a real fork-headed pull request; Docker.
Risk, rollback, docs, changelog
scripts/**), computed by the gate, not labelled. Needs a PASS at the tip plus greenci-ok,review-gate,pr-lint.scripts/release-open.mjs:431, the CLI;.github/workflows/daily-release.ymland the manual runbook). The change can only convertreusedintorefused: noPOST /pullsis reachable on that path, so it cannot create a second pull request. A wrong head now costs a red release night, which is the trade the card names.docs/deploy.mdupdated in this PR.changelog.d/1183.fixed.md.