Gate releases on successful tag commit checks (CLS-1422) #335
Loading…
Reference in a new issue
No description provided.
Delete branch "cls-1422-release-status-gate"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
First part of CLS-1422.
prepareresolves the release tag to a commit SHA, andgatechecks that SHA before any build starts. The gate uses the workflow's existingGITHUB_TOKENand requires successfulci / check (push),ci / coverage (push), andci / live-e2e (push)contexts.Status scope: every other commit context must also be successful, including external checks such as
security-scan. Only this release workflow's contexts and pull request event contexts are excluded.Stable snapshot: the gate reads every page from the combined commit-status endpoint twice and requires the complete status sets to match. API errors, duplicate contexts, incomplete scans, and changing sets fail closed.
The release run adds its own pending contexts to the same SHA, so those contexts must be excluded to avoid blocking itself. Gate failures flow to
guardfor release recovery, and a successful publish clears the draft state invisible.No local build or test suite was run. Shellcheck passes on the extracted gate script. Actionlint reports existing Forgejo-specific label and action URL warnings, plus warnings in other steps. CI will validate the workflow.
Automated Codex review (read-only) of head
7d3e27a47a.Medium .forgejo/workflows/release.yml:111: Invariant: a release gate must evaluate the complete status set. The combined-status endpoint paginates, but this request reads only its default first page. The existing status scanner explicitly walks until an empty page because neither a short page nor the reported total proves completeness. If a tag commit has enough contexts for a failed or pending check to fall on a later page, the workflow can publish it after seeing only successes. This defeats the gate introduced by this PR. Fetch every page, verify the SHA on each response, and fail closed if the scan cannot establish completeness.
Medium .forgejo/workflows/release.yml:119: Invariant: a failed release attempt must not leave an advertised, empty release without a visible failure report. A failed check, missing status set, or API error now fails
prepare, but the existingguardruns only whenpreparesucceeds. On a normal tag push, Forgejo can already expose the tag as a published release, so a tag pushed while CI is pending or during an API outage leaves that empty release advertised and files no issue. This newly reachable failure belongs in this PR. Run recovery for gate failures after tag resolution, preserving the resolved tag for the guard and reporting the prepare failure.BLOCKING: 2
Reviewed head
7d3e27a47aat 2026-11-21T23:05:36Z by codex exec (read-only sandbox).Fixed in the latest push.
Tested the gate and guard shell logic against a mock curl (clean, late failure, repeated page, wrong sha, no live-e2e, null statuses, PR-only contexts, API down, injection-shaped tag). Not exercised: a real release run, the 50-page cap, and the visible job against a real draft.
Not changed here, and in the guard's original behaviour rather than new: a release that got some but not all assets stays public (guard demotes only an empty one), and two overlapping runs for one tag can race on the demotion. Both are worth a follow-up issue.
Automated Codex review (read-only) of head
76aebdd7ce.Medium .forgejo/workflows/release.yml:170: The gate must reject every unsuccessful non-release check, as the PR body promises. It instead ignores every context that does not end in
(push). On the supported Forgejo commit-status API, an external check can report a failure under a context such assecurity-scan; if the three named CI push jobs are green, this gate still publishes the release. This belongs in the PR because the new gate claims to prevent precisely that outcome. Exclude the release workflow and the explicitly unwanted pull-request contexts, then evaluate all other statuses, including ordinary external status contexts.Low .forgejo/workflows/release.yml:142: Edge case. A completed scan must represent one coherent status set. Statuses can change while the pages are read, shifting entries between pages; a context can be missed even though the scan reaches an empty page. A check that changes during the scan could therefore be omitted and the release allowed. Re-read and compare the set or otherwise establish a stable snapshot before certifying it.
BLOCKING: 1
Reviewed head
76aebdd7ceat 2026-11-22T00:39:47Z by codex exec (read-only sandbox).Automated Codex review (read-only) of head
897c5ed3bd.Low release.yml:571: Invariant: release visibility reflects the tag’s version. The check treats any hyphen as a prerelease marker, including one in build metadata. For example, the accepted stable tag
v1.2.3+build-1becomes a prerelease after publication. Parse the version’s prerelease component separately from its build metadata. This is an edge case.Low release.yml:638: Invariant: recovery identifies the existing release across retries.
visibleaccounts for the tag lookup returning 404 for a draft, butguarddoes not use the same fallback. If a failed release was already demoted and a subsequent attempt fails before publication, recovery reports a lookup failure despite the draft existing. Use the authenticated release-list fallback in both paths. This is an edge case because the release is already hidden and the issue is still attempted.BLOCKING: 0
Reviewed head
897c5ed3bdat 2026-11-22T02:07:48Z by codex exec (read-only sandbox).