Skip to content

Promote develop to main: Supersede a Release GITHUB_TOKEN Cannot Tag - #2003

Merged
ptr727 merged 1 commit into
mainfrom
develop
Sep 28, 2026
Merged

ptr727 merged 1 commit into
mainfrom
develop

Conversation

@ptr727

@ptr727 ptr727 commented Sep 28, 2026

Copy link
Copy Markdown
Owner

Summary

Promotes develop to main, carrying #2002.

Suppose a release bot's workflow-only merge lands on the branch mid-publish. build-release-task.yml's github-release no longer fails the release with a 403 at the tag create. It walks the repository activity record from the built commit to the head instead. Where every update is a push or merge by the release-bot allowlist publish-plan-task.yml gates on, it dispatches the calling publisher on the branch and cancels its own run. The dependency bump then reaches its registry through the dispatched run. Any other shape fails as before, so a human merge never auto-publishes. The rule is WORKFLOW.md D4.7, with scenario S14. Callers pick it up through their ordinary pin bump, and no publisher stub changes.

Closes #2001

🤖 Generated with Claude Code

## Summary

Addresses #2001. When a release bot's workflow-touching merge lands on
the branch mid-publish, `GITHUB_TOKEN` cannot create the tag at the
built commit, since the built commit's `.github/workflows` tree no
longer matches the branch head and that token can never hold the
`workflows` scope. The follow-up merge matches no release path, so the
dependency bump never reached its registry.

`github-release` in `build-release-task.yml` gains a step before the
create:

- Where the built commit's `.github/workflows` tree matches the branch
head, it does nothing and the release proceeds as before.
- Otherwise it walks the repository activity record for the branch from
the head back to the built commit. It requires each update to be a
`push` or `pr_merge` by the actor allowlist `publish-plan-task.yml`
gates on, which is the same fact that gate reads and needs no new token
grant.
- It re-checks with `ls-remote` that the branch has not moved,
dispatches the calling publisher on the branch, and cancels its own run.
The head is then built, validated, and tagged by its own run (D4.2), and
no package publish job follows the cancelled one.
- Any other shape fails, as the 403 did before, so a human merge is
never published by the re-dispatch (D4.1).

Recorded as `WORKFLOW.md` D4.7 and scenario S14, with a line in
`GOVERNANCE.md` "Release Model". This rolls out to the fleet through the
ordinary hub pin bump. No publisher stub changes, since every fleet
`publish-release.yml` already grants `actions: write` and declares no
dispatch inputs.

## Evidence

The decision was checked read-only against `ptr727/aiopurpleair`'s real
history:

- The failing race (built `9e918bf2`, head `90018ab5`) dispatches.
- Two consecutive bot merges dispatch.
- The human-merged promotion, a human merge further back, and a head not
produced by a push to the branch each refuse.

`tests/test_release_guards.py` runs the step's own script, with a `gh`
stub that runs its real `--jq` against constructed activity responses.
Removing each guard in turn fails the test. A further check keeps the
step's allowlist equal to the plan's.

## Known Residuals

- A push landing in the moment between the `ls-remote` re-check and `gh
workflow run` goes out unchecked, since a dispatch cannot pin a SHA
without a new input on every publisher stub.
- A newer arrival in the publisher's global concurrency group can
replace the pending dispatched run.
- The activity endpoint is documented as needing only metadata read.
That is not yet verified live under `GITHUB_TOKEN` on a private
repository.

The `comments` label covers the step's two new comments and one edited
job comment.

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Release Workflow**
* Publishes overtaken by workflow changes now hand off to a new run on
the latest branch and cancel the current run when intervening updates
meet the release-bot and branch-stability checks. Otherwise, release
creation stops without dispatching another run.
  * Docker images may already have been pushed before the handoff check.
* **Documentation & Tests**
* Added guidance and coverage for the new handoff behavior and its edge
cases.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
@ptr727 ptr727 added the comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses label Sep 28, 2026
Copilot AI lite review requested due to automatic review settings September 28, 2026 16:56
@ptr727 ptr727 added the comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses label Sep 28, 2026
@coderabbitai

coderabbitai Bot commented Sep 28, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Repository: ptr727/ProjectTemplate/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 76280bf0-9335-47bd-9fde-0d83777e91c9


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ptr727

ptr727 commented Sep 28, 2026

Copy link
Copy Markdown
Owner Author

CodeRabbit is not prompted on this promotion. It reviewed the identical content on #2002, commit range 796d7dfd..6a6ef869, with "No actionable comments". The promotion is byte-identical to that range, and any reader can re-run these checks:

  • git rev-parse 6a6ef869^{tree} and git rev-parse 2583371e^{tree} (the squash commit, develop's tip) both give 0e6100135b4f44caf9fe114f019058afb02ca335.
  • git diff 796d7dfd 6a6ef869 | sha256sum and git diff origin/main origin/develop | sha256sum both begin 23daa5c6f641c81f.
  • origin/main's tree equals 796d7dfd's tree, the base CodeRabbit reviewed against.

@codecov

codecov Bot commented Sep 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 55.42%. Comparing base (796d7df) to head (2583371).
⚠️ Report is 289 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2003   +/-   ##
=======================================
  Coverage   55.42%   55.42%           
=======================================
  Files          16       16           
  Lines        7249     7249           
=======================================
  Hits         4018     4018           
  Misses       3231     3231           
Flag Coverage Δ
python-3.13 55.42% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The new supersede step can terminate early without emitting the intended refuse() error when the activity record lacks a matching after SHA, due to set -e interacting with a failing read, and should be guarded to fail with a clear message.

Review effort: Lite
Findings: 1 Medium severity

Open (1)
What changed in this PR

Promotes develop to main, carrying forward the release-workflow change that avoids failing a publish when the built commit can no longer be tagged due to a workflow-only merge landing mid-run, by re-dispatching the publisher on the updated branch head under strict bot-only activity constraints.

Changes:

  • Document the new CI/CD contract guarantee (D4.7) and scenario (S14) describing the “supersede instead of fail” behavior.
  • Update build-release-task.yml to detect divergent .github/workflows content and, when safe, dispatch the caller workflow on the branch head and cancel the current run.
  • Add regression coverage in tests/test_release_guards.py to validate the new “supersede” step behavior and its guardrails.
File Description
WORKFLOW.md Adds D4.7 guarantee and S14 scenario documenting supersede behavior.
GOVERNANCE.md Updates Release Model prose to reference D4.7 behavior.
docs/​reusable-workflows.md Clarifies caller permissions needs for the D4.7 dispatch/cancel behavior.
.github/​workflows/​publish-plan-task.yml Updates warning text to point maintainers at both allowlist locations.
.github/​workflows/​build-release-task.yml Adds “Supersede a release the token cannot tag” step and updates permissions rationale comment.
tests/​test_release_guards.py Adds a unit test that executes the new step script against a stubbed activity response and git repo.
.agents/​skills/​workflow-ci-contract/​references/​test-methodology.md Adds scenario S14 to the authored skill reference.
.agents/​skills/​workflow-ci-contract/​references/​d-guarantees.md Adds D4.7 to the authored skill reference.
.github/​skills/​workflow-ci-contract/​references/​test-methodology.md Regenerated skill distribution copy of the S14 addition (do not edit by hand).
.github/​skills/​workflow-ci-contract/​references/​d-guarantees.md Regenerated skill distribution copy of the D4.7 addition (do not edit by hand).
.claude-plugin/​fleet-skills/​skills/​workflow-ci-contract/​references/​test-methodology.md Regenerated plugin distribution copy of the S14 addition (do not edit by hand).
.claude-plugin/​fleet-skills/​skills/​workflow-ci-contract/​references/​d-guarantees.md Regenerated plugin distribution copy of the D4.7 addition (do not edit by hand).
.claude-plugin/​fleet-skills/​.source-digests/​workflow-ci-contract Updates the digest to match the regenerated skill content.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@ptr727
ptr727 merged commit 9fbdbad into main Sep 28, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Release Tag Creation Fails With 403 When a Workflow-Touching Merge Lands on main Mid-Publish

2 participants