Repository navigation
fix: read an empty release run listing through check-runs - #36953
Conversation
release_promotion.py resolve reads the release.yml runs listing filtered by head_sha, which is a filtered search that can answer no runs for a commit whose runs exist (#23245). An empty answer refused a stable promotion for a commit whose prerelease run succeeded. An empty listing is now read through the commit check-runs (every row, filter=all), the runs their Actions job links name are fetched, and release.yml push runs are kept, the rule the other readers apply. An unreadable named run fails the resolve, never reads as absent. resolve-promotion gains checks: read for that read. Fixes #36859
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: this reuses the check-runs fallback that the sibling readers already use, adds one read-only permission, and leaves candidate selection unchanged. [DESIGN-REVIEWED] 620f40d Description read[DESCRIPTION-READ] 187d8d3344da0e6cf61f6d448eaa7f2d049bfbbf5f8e5d0a5b220eb8ba318602 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. The fix is at mechanism level and tied to #36859. The only overlap is with the check-runs parsing in Notes
What this change shipsInventory (4 items) — 3 justifiedIntent: let a stable release promotion find the same-commit prerelease run when GitHub's
[FIRST-PRINCIPLES-REVIEWED] 620f40d Description read[DESCRIPTION-READ] 378b203c78d3822179fb89dbb1281a8c6db184eace6b2fc6200390341960417e That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Code change approver recommendation: ApproveWhy: the decider estimates an 8% chance that this change introduces a defect, within the 12% limit for approving on its own, and every check passes. An empty head_sha runs listing is now read through the commit's check-runs: every row is read (filter=all, paged), the named runs are fetched from the repo's own API and only release.yml push runs are kept. Those still go through the unchanged select_candidate_runs (successful run, exact SHA, v- branch), so a forged check-run link cannot widen what can be selected. The stable tag's own in-progress run is excluded by its branch and its missing conclusion. Any failed read raises instead of reporting "no run". checks: read is added to the resolve-promotion job and both permission pins are updated. The new tests would fail without the change. The non-empty listing path is unchanged. An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approving. On this head the review checked that the check-runs fallback runs only when the release.yml runs listing comes back empty. It keeps only same-repo push runs of release.yml, and the kept runs still go through the unchanged select_candidate_runs and verify_bundle. A named run that cannot be read raises PromotionError. With the base script, both new tests fail: one hits the old refusal from #36859, the other a wrong error match. With the fix they pass. Removing the path filter makes the main test fail.
Security: the only new grant is a read-only checks: read on the resolve-promotion job, and both permission pins are updated. Only a push run of release.yml in this repo can become a candidate, so the fallback trusts nothing the existing listing did not already trust.
Done well: the fake API fails on any endpoint it does not expect, so reading the unrelated ci.yml run's artifacts is a hard failure, not a silent pass.
Optional:
- Add a two-page case: page 1 has exactly 100 rows with no release run, and page 2 names the run. Today, a loop that stops after page 1 still passes every test.
- Add a release.yml run with a non-push event, so a test covers the
event == "push"filter. - The Proof line could also name
test_an_empty_runs_listing_is_read_through_the_commits_check_runs, which fails without the fix.
Problem / Motivation
Goal: A stable promotion finds the same-commit prerelease run even when GitHub's
head_sharuns listing answers empty.scripts/release_promotion.py resolvereadsactions/workflows/release.yml/runsfiltered byevent=push,status=successandhead_sha. That listing is a filtered search that can answer no runs for a commit whose runs exist (#23245). On an empty answer the resolver raisedno successful prerelease workflow run exists for this exact commit and base, so the stable promotion was refused for a commit whose prerelease run had succeeded.Why it matters
The refusal is loud, so nothing wrong ships, but a release stops and the message sends the operator looking for a run that is there. Every other reader of this listing already reads an empty answer through the commit's check-runs (#32383, #33367); this one did not.
Not a goal
await-fast-gate.sh,issue-gate-retrigger.yml).select_candidate_runsis unchanged).What changed (motivation → approach → change)
release.ymlrun succeeded.resolve_candidatetook an emptyhead_shalisting as "no run"._release_runs_named_by_check_runsreads the commit's check-runs (every row,filter=all, paged), takes the run ids their Actions job links name (.../<repo>/actions/runs/<id>/job/<job>), fetches each run, and keeps therelease.ymlpush runs. Those go through the unchangedselect_candidate_runs(success, exacthead_sha,v<base>-branch). Any read that fails raisesPromotionError, so an unreadable run is a read failure, never an absent run. This is the same rule asrepublish_withheld_verdict.py::_head_runs.release.ymlresolve-promotiongainschecks: readfor that read; the two permission pins and the empty-listing paragraph indocs/ci/ci-and-reviews.mdare updated.Backwards compatibility
Compatible: a non-empty listing takes the same path as before; only an empty listing now does an extra read before it concludes.
Removes nothing: the change only adds a fallback read and one read-only token permission.
Tests
test_an_empty_runs_listing_is_read_through_the_commits_check_runs: an empty listing plus check-runs naming the release run (two jobs) and aci.ymlrun resolves the release run, reads check-runs once withfilter=all, fetches the release run once, and never reads theci.ymlrun's artifacts.test_a_named_run_that_cannot_be_read_is_a_read_failure_not_an_absent_run: a named run whose fetch fails raises the API error, not the "no run" refusal.test_stable_tag_resolves_candidate_and_never_enters_build_jobsandTestReleasePermissions::test_release_jobs_follow_least_privilege_split: pinchecks: readonresolve-promotion.Proof: PROVEN test/test_release_promotion.py::test_a_named_run_that_cannot_be_read_is_a_read_failure_not_an_absent_run, test/test_release_promotion_contract.py::test_stable_tag_resolves_candidate_and_never_enters_build_jobs, test/test_workflow_permissions.py::TestReleasePermissions::test_release_jobs_follow_least_privilege_split (head 620f40d)
Locally:
test_release_promotion.py,test_release_promotion_contract.py,test_workflow_permissions.py,test_stable_release_gate.py: 103 passed;local-gate.pybackend related tests: 764 passed.Manual verification
N/A: the empty listing cannot be produced on demand (the issue says so), so the stubbed
ghtests above are the reproduction.Related Issues
Fixes #36859
Sibling sweep
Swept: git grep -nE "runs?[^"]*head_sha|"head_sha": *source_sha|head_sha=$" -- scripts .github
Sibling: scripts/release_promotion.py -- changed here
Sibling: .github/scripts/republish_withheld_verdict.py -- not affected -- already reads an empty listing through check-runs (#32383)
Sibling: .github/workflows/pr-readiness.yml -- not affected -- already reads an empty listing through check-runs (#32383)
Sibling: .github/workflows/ai-review-human-override.yml -- not affected -- already reads an empty listing through check-runs (#32383)
Sibling: .github/workflows/pr-size-override.yml -- not affected -- already reads an empty listing through check-runs (#33367)
Sibling: .github/workflows/merge-queue-readiness.yml -- not affected -- already reads an empty listing through check-runs (#33367)
Sibling: .github/scripts/await-fast-gate.sh -- tracked in #33264
Sibling: .github/workflows/issue-gate-retrigger.yml -- tracked in #33264
Pattern harvest
Rule candidate: semgrep
Pattern: a
head_sha-filteredactions/runslisting whose empty answer is taken as "no run" without a check-runs readChecklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license.