Skip to content

ci(publish): verify refuses a deleted or moved tag; a Slack post that fails shows on the run - #22

Merged
sanctrl merged 4 commits into
mainfrom
ci/publish-notify-loud
Nov 12, 2026
Merged

sanctrl merged 4 commits into
mainfrom
ci/publish-notify-loud

Conversation

@sanctrl

@sanctrl sanctrl commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Why

Two gaps in publish.yml, the workflow that ships the package to PyPI:

  • The Slack posts could fail silently. It posts twice to the Slack warning channel: when a release waits for the pypi approval, and when the pipeline fails. Both posts ended in curl -sS ... || true. Without -f, curl treats a 403 or 404 from Slack as success, so a revoked webhook looked like a sent message: the step was green and nothing reached the channel.
  • A deleted or moved tag could pass verify. A tag deletion can start a push run too. For a deleted branch, GitHub's docs say the run gets the default branch's head as its commit. They say nothing about tags, but nothing guards against the same for a tag. While main's version still equals the deleted tag's, every verify check passed: the tag name matched the version, and the commit was on main. One approval would then publish main's head under a tag that no longer exists. A tag moved to another commit before verify ran passed the same way.

What changes

.github/workflows/publish.yml:

  • verify checks the tag as origin has it now. On a tag push, it fetches refs/tags/<tag> from origin and refuses the release unless that tag, peeled to its commit, is the commit being published. The refusal says what git saw: the tag is missing, or it points at another commit. Annotated and lightweight tags both pass.
  • The Slack steps (notify-awaiting-tap, notify-failure):
    • curl -fsS, and no || true. A post that Slack refuses (403, 404, 410) or never answers (connection refused, the 15 s timeout) now fails its step and writes an ::error:: annotation on the run.
    • set -o pipefail. If the JSON payload never builds (a jq failure), the step fails too, instead of curl quietly sending an empty body.
    • continue-on-error: true on both steps. A failed post shows as a failed step and an annotation, but the job and the run stay green. No publish job depends on a notify job.
    • An unset secret still logs a warning and passes.

The rest of the release path is unchanged: the version checks, the test matrix, the build and the environment gate. No version bump, because nothing that ships in the package changed.

Proof (local)

I extracted each run: block from this file with a YAML parser and ran it under bash -e, GitHub's default shell.

verify, against a throwaway origin with main, an unmerged branch, and tags set per case:

Case Result
Tag push v1.3.0 on a 1.3.0 main commit, annotated tag pass
Same, lightweight tag pass
Wrong tag v1.3.1 refused
Right tag on an off-main commit refused
Tag deleted, with the run on main's head refused (new)
Tag moved to another commit before verify refused (new)
prod dispatch on main pass
prod dispatch off main refused
test dispatch off main pass
pyproject.toml and _version.py disagree refused

Slack steps, against a local HTTP stub:

Case Exit Annotation
Stub answers 200 0 none
Revoked webhook (403) 1 ::error::
Webhook gone (404) 1 ::error::
Connection refused 1 ::error::
jq fails, and the stub accepts an empty body 1 ::error::
Secret not set 0 ::warning::
  • Controls:
    • The old line exits 0 on a 403.
    • Without set -o pipefail, the jq case exits 0.
  • No secret in the output. curl's error lines name only the status code or the host, never the webhook path.
  • actionlint 1.7.12 (with shellcheck 0.11.0) is clean.
  • The full gate passes on Python 3.9–3.13: ruff, mypy and pytest (718 passed, 2 skipped on each). The contract-fixture check matches the published manifest.

Test plan

  • CI green on this PR
  • At the next release, verify passes on the tag push and notify-awaiting-tap posts the tap request. If the post fails, the run shows a failed Post to Slack step, and the publish still goes ahead after approval.

…g the release

The awaiting-tap and failure posts used curl -sS ... || true, so a revoked
webhook (403/404) or Slack being unreachable read as success. They now use
curl -fsS: a post Slack refuses or never answers fails its step with an
error annotation, and continue-on-error on that step keeps it from
failing the release. An unset secret still logs a warning and passes.
…lt fails the step too; the comment says what a failed post looks like
… commit (deleting a tag starts a push run too)
@sanctrl sanctrl changed the title ci(publish): a Slack post that fails shows on the run, without failing the release ci(publish): verify refuses a deleted or moved tag; a Slack post that fails shows on the run Nov 11, 2026
@sanctrl
sanctrl merged commit 5f233b3 into main Nov 12, 2026
11 checks passed
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.

1 participant