8000 ci(release): gate publishing on CI and dispatch bindings after crates.io (#938, #939) by adityamukho · Pull Request #954 · project-minigraf/minigraf · GitHub
[go: up one dir, main page]

Skip to content

ci(release): gate publishing on CI and dispatch bindings after crates.io (#938, #939) - #954

Merged
adityamukho merged 2 commits into
mainfrom
ci/938-939-release-main
Nov 30, 2026
Merged

adityamukho merged 2 commits into
mainfrom
ci/938-939-release-main

Conversation

@adityamukho
Copy link
Copy Markdown
Collaborator

Closes #938. Closes #939.

The same change lands on main and v3. The files are identical except CONTRIBUTING.md, which keeps each branch's own checklist.

#938: dispatch the bindings after crates.io, not on the tag push

  • cascade.yml now triggers on workflow_run of Release (completed). It runs only when the run concluded success. workflow_dispatch (input tag) stays for recovery.
  • It checks out the default branch's own workflow_sha, never the triggering run's code.
  • .github/release/release.sh prepare validates the triggering run: the official .github/workflows/release.yml of this repo (not a fork), event push, head_branch = the tag, and head_sha = the commit the tag resolves to now. It then checks CI on that commit (below).
  • It waits up to 60 minutes for that exact crate version on crates.io (backoff from 10 s up to 120 s), then dispatches core-release with client_payload.version = the full tag to the seven binding repos, as before.
  • Prerelease tags such as v3.0.0-alpha (crate version 3.0.0-alpha) are accepted.

#939: publishing requires CI green on the exact tagged commit

  • New reusable release-gate.yml (release.sh gate) requires a successful latest push run of Rust, WASM, Lint, Coverage Gates, Policy and Binary Size on the tagged SHA. A workflow missing from that commit is skipped by name. All six run on main and v[0-9]* pushes, so v2.x is covered after release: move v3 to main and main to v2.x at the 3.0.0-alpha #937.
  • It is wired into Release through cargo-dist config, not a hand edit (local-artifacts-jobs = ["./release-gate"]). host (the GitHub release) and everything after it wait for it.
  • Publisher migration: regenerating release.yml would delete the hand-added publish-crates-io job. That job moves unchanged (crates-io environment, OIDC trusted publishing, cargo publish --locked -p minigraf) into a reusable release-publish.yml, wired as a dist publish-jobs entry with publish-prereleases = true so the alpha publishes. allow-dirty = ["ci"] is removed, so release.yml is again exactly what dist generate writes. pr-run-mode = "skip" and actions/checkout pinned to v4 keep the generated file's other behavior.
  • CONTRIBUTING.md release checklist: a cargo publish --dry-run --locked step from a clea 8000 n checkout before tagging, the CI-on-exact-SHA rule, and the cascade's recovery command. Lockfile: not added. Recommendation: track a release lockfile separately and use it in CI and in publishing.

Verification

Not testable in a PR

The real workflow_run trigger, OIDC publish and binding dispatch run only on a tag. Before tagging the alpha, run the gate on the candidate SHA and cargo publish --dry-run --locked.

🤖 Generated with Claude Code

https://claude.ai/code/session_01H2a7QngaFzuCVt5umd1qoh

@codecov
codecov Bot commented Nov 30, 2026
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Collaborator Author

One release-readiness gap in wait_for_crate: matching .version.num from the crates.io API proves the version is in registry metadata, not that Cargo can resolve it. crates.io updates the index and invalidates its CDN cache asynchronously. The cascade can therefore dispatch bindings while cargo update --precise still cannot find the alpha.

Keep the bounded retry, but poll the Cargo sparse-index entry for an exact vers match with yanked == false. Add a regression fixture where the API already reports the alpha but the sparse index is missing it on the first poll, then returns the exact unyanked row. Assert the cascade does not dispatch before the index is ready.

adityamukho and others added 2 commits November 30, 2026 14:37
….io (#938, #939)

Release Cascade now runs on completion of a successful official
tag-push Release run, checks the tag still names that commit and that CI
passed on it, waits up to 60 minutes for the exact crate version, then
dispatches the bindings. A Release Gate job (cargo-dist
local-artifacts-jobs) blocks hosting and publishing unless the tagged
commit's push CI succeeded. The hand-added crates.io publish job moves
unchanged into a dist publish-jobs workflow so release.yml is generated
again.

Closes #938.
Closes #939.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H2a7QngaFzuCVt5umd1qoh
The API can list a version before Cargo can resolve it: crates.io
updates the index and its CDN asynchronously. Poll
index.crates.io/mi/ni/minigraf for an exact, unyanked vers row instead,
within the same 60-minute bound. Review follow-up on #954/#955.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H2a7QngaFzuCVt5umd1qoh
@adityamukho
adityamukho force-pushed the ci/938-939-release-main branch from 3184003 to c5deab8 Compare November 30, 2026 09:07
adityamukho added a commit that referenced this pull request Nov 30, 2026
The API can list a version before Cargo can resolve it: crates.io
updates the index and its CDN asynchronously. Poll
index.crates.io/mi/ni/minigraf for an exact, unyanked vers row instead,
within the same 60-minute bound. Review follow-up on #954/#955.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H2a7QngaFzuCVt5umd1qoh
@adityamukho
Copy link
Copy Markdown
Collaborator Author

Addressed in the new commit "ci(release): wait for the Cargo sparse index, not the crates.io API" (same change on both PRs):

  • wait_for_crate now polls https://index.crates.io/mi/ni/minigraf (with Cache-Control: no-cache). It needs HTTP 200, a body that parses as complete NDJSON, and a row with .vers == <version> and .yanked == false. Anything else counts as "not ready", within the same 60-minute bound and 10→120 s backoff.
  • The crates.io API check is gone: it only added an availability dependency and never proved Cargo readiness.
  • New regressions in test_release.py (18 tests now; the four new ones failed before the fix): the API already reports the version but the sparse index lacks it on the first poll, then returns the exact unyanked row, with an assertion that dispatch happens only after that; a yanked row; a near-miss version (3.0.0-alpha2 vs 3.0.0-alpha); HTTP errors and partial responses.
  • CONTRIBUTING step 7 now says "exact, unyanked crate version in the Cargo sparse index".

Also rebased onto the merged policy PRs (#956/#957), so release step 8 now reads lock-step. shellcheck and actionlint are clean, and release.yml is unchanged.

@adityamukho
adityamukho merged commit b1f5229 into main Nov 30, 2026
20 checks passed
@adityamukho
adityamukho deleted the ci/938-939-release-main branch November 30, 2026 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant

0