Skip to content

fix(release): publish after promoted tags; add tag recovery path - #3794

Merged
Daniel Meppiel (danielmeppiel) merged 2 commits into
mainfrom
danielmeppiel-release-publish-gates
Nov 17, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 2 commits into
mainfrom
danielmeppiel-release-publish-gates

Conversation

@danielmeppiel

Copy link
Copy Markdown
Collaborator

Description

Release fix for a regression from #3771. The v0.36.0 tag run (44144535206) was promoted and took 7 min: it built, smoke-tested, release-validated and created the GitHub Release. But Deploy Docs, GH-AW Compatibility, Build PyPI Distributions and Publish to PyPI were skipped, so PyPI still shows 0.35.1.

Root cause: a job-level if: without a status function gets an implicit success(), which is false whenever any transitive ancestor was skipped. On a promoted tag the integration jobs are skipped by design. create-release already used always(), but the jobs after it did not.

Changes in .github/workflows/build-release.yml:

  1. Explicit status gates. The four publication jobs now use !cancelled() && needs.<job>.result == 'success' && .... Their conditions are otherwise unchanged: pushed tag only, prerelease and private-repo checks.
  2. Recovery path publish-existing-tag. This is a new repository_dispatch type (still no workflow_dispatch). It publishes the PyPI distributions of a stable release that already exists:
    gh api repos/microsoft/apm/dispatches -f event_type=publish-existing-tag -F 'client_payload[tag]=v0.36.0'
    Release Plan is skipped, so no validation or release job runs. Resolve Existing Release Tag (contents: read; the payload reaches the script only through env) refuses anything other than a vX.Y.Z tag that is a published, non-draft, non-prerelease GitHub release whose version is not yet on PyPI. Build PyPI Distributions checks out the tag, not main, and verifies that the built wheel and sdist versions match the tag. Publish to PyPI stays in this workflow with the pypi environment, so the trusted publisher still matches.
  3. Evidence hardening (scripts/release_plan.py). A green schedule/repository_dispatch run counts as promotion evidence only if its Integration Tests Summary job succeeded. Without this, a green recovery dispatch on a main SHA would wrongly promote a later tag.
flowchart LR
  T["v* tag (promoted)"] --> CR["Create GitHub Release"]
  I["integration jobs: skipped"] -.-> CR
  CR -->|"!cancelled() && success"| D["Deploy Docs / GH-AW"]
  CR -->|"!cancelled() && success"| B["Build PyPI Distributions"]
  R["dispatch publish-existing-tag"] --> RT["Resolve Existing Release Tag"] --> B
  B --> P["Publish to PyPI (trusted publisher)"]
Loading

After merge: dispatch publish-existing-tag for v0.36.0 so PyPI gets 0.36.0. v0.36.1 then publishes normally.

Issue and approved scope

Issue: Refs #3581

Human scope-approval comment: #3581 (comment) (release CI scope, including "nothing publishes without a green full validation"). This PR is a named release fix for that scope, requested by the coordinator and by the 0.36.1 release captain.

Does this PR complete the issue, or what remains? Partial. It fixes a regression in #3771's publication path; the rest of #3581 stays in #3582.

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Maintenance / refactor

Testing

  • Tested locally
  • All existing tests pass
  • Added tests for new functionality (if applicable)

New guards in tests/unit/test_platform_contract_workflow.py:

  • test_publication_jobs_survive_skipped_upstream_jobs: any job downstream of a skippable job (integration-tests, recover-tag) must start with always() or !cancelled(). Each publication job must check needs.<x>.result == 'success' for every need.
  • test_implicit_success_publication_gate_is_rejected: restoring any of the four pre-fix conditions fails.
  • test_tag_recovery_builds_from_a_verified_stable_tag_only.

test_release_plan.py adds tests showing that a green run whose Integration Tests Summary was skipped, failed or missing is not evidence.

Command Result
pytest tests/unit/scripts/test_release_plan.py tests/unit/test_platform_contract_workflow.py tests/unit/test_security_workflow_contracts.py tests/unit/test_windows_signing_contract.py tests/unit/test_windows_unit_diagnostics.py tests/unit/test_ado_live_workflow_contract.py tests/unit/test_guardrailing_hero_topology.py tests/unit/test_docs_contract_workflow.py -p no:xdist 141 passed
ruff check / ruff format --check (CI paths) All checks passed / 2307 files already formatted
bash scripts/lint-auth-signals.sh clean
actionlint .github/workflows/build-release.yml clean

Spec conformance (OpenAPM v0.1)

  • N/A -- this PR does not change OpenAPM-observable behaviour.

On a promoted tag, integration jobs are skipped, and the implicit
success() on Deploy Docs, GH-AW Compatibility, Build PyPI Distributions
and Publish to PyPI turned that skip into a skip of publication: v0.36.0
created its GitHub release but never reached PyPI. These jobs now use
!cancelled() with explicit needs.<job>.result == 'success' checks, and a
contract test rejects any job behind a skippable job that relies on the
implicit success().

repository_dispatch publish-existing-tag (client_payload.tag) re-publishes
PyPI distributions for a published stable release that is missing from
PyPI. It skips all validation and release jobs, builds from the tag,
checks the built version, and stays in build-release.yml so PyPI trusted
publishing still matches.

Promotion evidence now also requires the run's Integration Tests Summary
job to have succeeded, so a green recovery dispatch is never evidence.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 17, 2026 18:35
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

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.

🟡 Changes recommended

Release recovery can publish to PyPI without full-validation evidence for the exact commit and may check out a same-named branch instead of the release tag, allowing unverified or incorrect source to be published.

2 open issues
What changed in this PR

Fixes the publication regression introduced by #3771, where promoted release tags skipped downstream publication jobs. Adds a PyPI recovery path for existing stable releases and tightens promotion-evidence checks.

Changes:

  • Adds explicit status gates so publication jobs tolerate intentionally skipped upstream jobs.
  • Introduces publish-existing-tag recovery with release-state and distribution-version checks.
  • Requires a successful integration summary for promotion evidence and adds regression coverage.
File Description
tests/​unit/​test_security_workflow_contracts.py Allows the recovery dispatch while preserving manual-trigger restrictions.
tests/​unit/​test_platform_contract_workflow.py Adds publication-gate and recovery-path contract tests.
tests/​unit/​scripts/​test_release_plan.py Tests rejection of runs without a successful integration summary.
scripts/​release_plan.py Checks integration-job results before accepting promotion evidence.
docs/​src/​content/​docs/​contributing/​integration-testing.md Documents the PyPI recovery command and eligibility checks.
CHANGELOG.md Records the publication fix and recovery option.
.github/​workflows/​build-release.yml Updates publication gates and adds tag-based PyPI recovery.

Review effort: Balanced

Comment on lines +1212 to +1213
state="$(gh api "repos/$REPOSITORY/releases/tags/$TAG" --jq '"\(.draft) \(.prerelease)"')"
if [ "$state" != "false false" ]; then
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
ref: ${{ needs.recover-tag.outputs.tag || github.ref }}
@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit 439fd73 into main Nov 17, 2026
25 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the danielmeppiel-release-publish-gates branch November 17, 2026 18:48
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 19, 2026
* docs(changelog): make 0.36.0 onwards legible and concise

Rewrites [Unreleased], [0.36.1] and [0.36.0] as one short line per user-visible change, with Highlights and a Breaking changes and upgrade notes list per version, grouped PRs and internal-only entries dropped (#3637, #3771, #3794, #3796, #3877). Credits, PR references, the 0.36.1 issue closures and the live Azure DevOps caveat are kept. Sections from 0.35.1 down are unchanged. The changelog instructions now describe this style.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* chore(lock): record the new changelog instructions hash

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* docs: note the shared .mcp.json and VS Code Local mode in 0.37 upgrade notes

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* docs(changelog): restore accuracy qualifiers flagged in review

Restores the static env caveat for .mcp.json, the pack default-format
qualifier, Copilot CLI scope for COPILOT_HOME, the 0.36.1 frozen-lockfile
recovery step, and the bundle install --target qualifier.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: danielmeppiel <danielmeppiel@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants