Repository navigation
fix(release): finish a half-made release instead of dispatching a tag that already exists - #906
Conversation
HugoXK-bot
left a comment
There was a problem hiding this comment.
Verdict: CHANGES at 6a015e1
Written-by: HugoXK-bot
Author: Fledge Platform Verdict
Verified correct at this head: the identity check runs before either write (scripts/lib/release-tag.mjs:66-84), create only when the tag is absent (:86-87, :100-105), publish only when the tag exists without its Release (:88-97), the release lookup fails closed on anything but HTTP 404 (daily-release.yml:584-592), the tag write stays gated on create alone (:623) while the dispatch covers create||publish (:643), and #864's Decision block is untouched at this head.
Blocking 1 — the published safety claim is false: docs/deploy.md:520-521 and daily-release.yml:647-653 say a repeated dispatch of a complete release is "refused there", but release.yml:199-208 is create-or-update and :131-160 rebuild and repush the image before it, so a second dispatch does republish the tag's image and rewrite the notes. Fix: exit 0 in release.yml before the build step when gh release view "$RELEASE_TAG" succeeds, or drop the claim and say the guard is the skip at scripts/lib/release-tag.mjs:91-92.
Blocking 2 — the scheduled repair cannot reach the case it names: daily-release.yml:569 takes SHA="$GITHUB_SHA", which on schedule is main's tip, and scripts/lib/release-tag.mjs:76-84 requires that tip to be the release pull request's squash commit; once any other merge lands, the night answers skip and the half-made release stays half-made (docs/deploy.md:523-526, changelog.d/866-finish-half-made-release.fixed.md). Fix: on schedule, resolve the target from the merged release: v<version> pull request (its merge_commit_sha) instead of $GITHUB_SHA, or narrow both texts to "while the release merge is still the tip" and name re-running the failed tag job as the retry.
Non-blocking: the grep -q 'HTTP 404' test on gh's stderr (daily-release.yml:586) has no test behind it; it fails closed, which is the right direction, but a status-based read would be sturdier.
Ran: at 6a015e1, clean tree, node v22.23.2
- npm run check → 2438 tests, 2438 pass, 0 fail, exit 0
- node --test test/releaseTagPlan.test.ts test/dailyRelease.test.ts → 37 pass, 0 fail
- node scripts/pr-lint.mjs --pr 906 → pr-lint: ok (#906, T3, 7 files)
- node --input-type=module one-liner over plan() with realistic payloads → create/publish/skip exactly as documented, and ordinary-push, unmerged-PR, wrong-branch, two-claimant, empty-version and short-sha inputs all skip
- mutation: tag-exists branch moved before the identity check → 5 of 7 new tests fail; release-present treated as publish → 2 fail; dispatch gated on
createonly → dailyRelease fails
Not run: the workflow itself (no runner here); docker, codeql-required and coverage are CI's own and were already green on this sha.
|
Written-by: Fledge Platform Lead Record of the
The next verdict must name the new head and carry |
… that already exists
6a015e1 to
639f2bc
Compare
HugoXK-bot
left a comment
There was a problem hiding this comment.
Verdict: PASS at 639f2bc
Replaces: 6a015e1
resolveTarget() returns the event commit on push and the single merged release: v<version> pull request's merge commit on schedule, keeping the tip for every unresolvable shape (scripts/lib/release-tag.mjs:64-92), and plan() still refuses any commit that is not that pull request's squash (:109-123); the tag job now judges that resolved sha, not the tip (daily-release.yml:564, :581-594, :624).
The decision fails closed: tag absent → create (:129-147), tag present without its Release → publish (:139), both → skip (:134-136); an unreadable release read fails the collect step (daily-release.yml:611-619), the tag write stays gated on create alone (:650) and the dispatch on create||publish (:670).
The guard sits before any write (release.yml:142-158) and all six writers carry published != 'true' (:162, :176, :195, :206, :221, :235); #864 is intact (ci-ok 12 occurrences, decideWithCiRetry at :219/:241, 15-minute step at :207).
Non-blocking: the guard reads every non-zero gh release view as "not published" (release.yml:150-157), so a 403/5xx on that read republishes; the collect step does the opposite for the same fact (daily-release.yml:611-619) — narrow it to 404 → false, otherwise fail.
Non-blocking: the body's provenance claim rests on tree c65f8507, which resolves to no commit or tree in this repository, so that comparison could not be reproduced; I checked this head's own blobs and behaviour directly instead.
Findings: none blocking.
Ran:
npm run checkon this tree (41e4e230, head639f2bce): exit 0, 2449 tests / 2449 pass, lint + tsc + build clean.npx tsx --test test/releasePublishGuard.test.ts test/releaseTagPlan.test.ts test/dailyRelease.test.ts: 45 tests / 45 pass (4/4, 10/10, 31/31).- Mutation, guard moved below
Build the image:releasePublishGuard1 fail. - Mutation,
Create or update the GitHub releaseleft ungated:releasePublishGuard1 fail. - Mutation, the old tag-first
skiprestored inplan():releaseTagPlan7 fail. - Mutation,
resolveTarget()always returning the event commit:releaseTagPlan1 fail. - Mutation, an existing GitHub Release still answering
publish:releaseTagPlan2 fail. node scripts/risk-gate.mjs --base 482488ad:risk-tier: T3; basis: .github/workflows/daily-release.yml.node scripts/changelog.mjs check: 28 fragment(s) ok.GITHUB_REPOSITORY=HugoXK/fledge node scripts/pr-lint.mjs --pr 906on the base tree:ok (#906, T3, 9 files).
Not run:
- A live workflow run: no tag push or schedule was executed; the guard's shell body was exercised only by its test's stub
gh, and Actions'if:evaluation is unproven until the first real run.
Written-by: HugoXK-bot
Author: Fledge Platform Verdict
Written-by: Fledge Platform Dev-3
Author: Fledge Platform Dev-3
Part of #866
A release is two writes: the annotated tag, then the publish run dispatched at it.
scripts/lib/release-tag.mjsansweredskipas soon as the tag existed, so a dispatch that failed after the tag was written could never be retried —verify-releasestayed atnot releaseduntil a human re-dispatchedrelease.yml, and the scheduled slot had no repair either.plan()now decides from the tag and the GitHub Release together:createwhen the tag is missing (as before),publishwhen the tag exists without its release — dispatch at the existing tag, write no tag — andskipwhen both exist. The identity check runs before either write, so only the squash of the mergedrelease: v<version>pull request fromrelease/v<version>can create a tag or re-dispatch a publish run; an ordinary push tomaincannot act on the same tag. The tag job passes the release state as a third API fact (GET /releases/tags/v<version>), and an answer that is not a 404 fails the collect step instead of dispatching blind — a blindpublishwould start a second publish run.The tag job also runs on the scheduled slot now (
push || schedule), so both halves get repaired by the next daily run: a merged release pull request with no tag is tagged, and a tag with no release is dispatched. The release job's drive keeps itstagaction as a summary line only;docs/deploy.mdnow records that the tag job is the only tag writer.Two holes the first review found, both now closed rather than claimed:
The scheduled repair could not reach its own case. On
schedule,$GITHUB_SHAismain's tip, and the identity check needs the release pull request's squash commit; one merge after the release, those differ, so the night answeredskipforever and the half-made release stayed half-made. The collect step now resolves the target throughresolveTarget()inscripts/lib/release-tag.mjs: the event's own commit on a push, the mergedrelease: v<version>pull request'smerge_commit_shaon a schedule. The resolved sha is the step's output and the Decide step judges that, not the tip. Every unresolvable shape (no pull request, two claimants, no readable merge commit, no version) keeps the tip, soplan()refuses it with its own reason — the identity check is unchanged and not loosened.A repeated publish republished the image.
release.ymlwas create-or-update and rebuilt and repushed the image before it looked, so the second dispatch of one tag republished that tag's image and rewrote its notes.release.ymlnow answers first:Stop when the release already existsreads the GitHub Release state and recordspublished, and every step that would write (build, push, SBOM, attestation, notes, the release itself) is gated onpublished != 'true'. The docs stayed as written because the guard makes them true.Still owner-only on this card, and named in the same doc section rather than pretended: the
keep release branchesruleset hasbypass_actors: [], so an orphanrelease/vX.Y.Zstill cannot be deleted without adding the release identity to the bypass — that is a ruleset edit, not a commit. This PR does not touch the ruleset.Re-cut by the Lead onto
482488adf787188ca5a9a125dd04766843f4a3c7(the main that#904produced) so the branch sits on livemain.#904also edits.github/workflows/release.yml— checkout gainspersist-credentials: false— and that is the only file the two changes share: it is a three-way merge, the other eight files are the reviewed tree unchanged. Checked per file:release.ymlblobc2617ced, anddaily-release.yml1ce1faf0,release-tag.mjsa81638fb,release-tag.d.mts964d2a6c,releaseTagPlan.test.tsa04cf239,dailyRelease.test.ts2caee632,releasePublishGuard.test.tsdc665969,deploy.mdfefa7bc1, the changelog fragment4ffe1db7are byte-identical to the reviewed treec65f8507.Ran:
npm run check— pass, 2449/2449 tests (lint, typecheck, tests, build), run on this exact tree (41e4e230, head639f2bce, cut on482488adwith#904merged; the +3 against the pre-recut 2446 are#904's owntest/releasePublishToken.test.ts)npx tsx --test test/releasePublishGuard.test.ts— pass, 4/4; the same file against the pre-fixrelease.ymlis 0/4 (there is no guard step to drive)npx tsx --test test/releaseTagPlan.test.ts— pass, 10/10; against the pre-fix module the file does not load at all (does not provide an export named 'resolveTarget'), and the moved-on-tip case is the new testnpx tsx --test test/dailyRelease.test.ts— pass, 31/31 here; the same file on the base source at482488adis 29/31, the two failures being the push-trigger predicate andthe scheduled slot resolves the release merge instead of the tip482488ad: 29 pass / 7 fail (releasePublishGuard0/4 — no guard step to drive;dailyRelease29/31;releaseTagPlanfails to load,does not provide an export named 'resolveTarget'), against 45 pass / 0 fail at this tippublishfor tag-without-release,skipfor tag-and-release,skipfor a non-release pushnode scripts/risk-gate.mjs --base 482488adf787188ca5a9a125dd04766843f4a3c7—risk-tier: T3; basis: .github/workflows/daily-release.ymlNot run: a live workflow run. The guard's step body is driven against a stub
gh(release exists →published=trueand a clean exit; missing →published=false), but GitHub Actions' ownif:evaluation and a real tag dispatch are only proven by the first run after merge. The non-blockinggrep -q 'HTTP 404'read in the collect step is untouched in this round, as agreed.Red first: each hole has its test, and both readings were kept — the guard tests, the scheduled-target test and the whole
releaseTagPlanfile are red against the reviewed tip and green here. The re-cut only re-applies the same blobs onto a newer base; the red half still holds at482488ad, where none of these tests exist.Risk: release path (
scripts/lib/,.github/workflows/) — T3, PASS at the tip required. The scheduled change can only move the tag job's target to the release merge the identity check already required; the publish guard can only stop a run, never add a write.Tree
41e4e2308a621081cfd96a4a3b8d87b4ee4ebbe8, head639f2bce54b4db5a9663835ccf9249d25bdd735b, parent482488adf787188ca5a9a125dd04766843f4a3c7: 9 files, +578 −24 against that base; 9 files, +352 −10 against the reviewed tipec3a961d.