A tag that could have published the wrong version
Tagging v2.0.0rc1 while the package metadata said 2.0.0 would have published the real 2.0.0 to PyPI, where a version can never be replaced.
The safety net had a hole
The test, the audit log, the scanner, the CI run — covering less than I assumed it did.
The PyPI release job runs on a tag. It built the package and published it — with the version from the package metadata, not from the tag.
I caught it before it happened. Tagging v2.0.0rc1 while pyproject.toml still said 2.0.0 would have published the real 2.0.0. PyPI doesn't let you replace a published version, so the number would have been gone, attached to a release candidate.
The guard is a step before the publish that compares the tag with the package version and refuses when they differ. Pre-release tags also stopped moving the latest container tag.
The same release found a second irreversible-publishing trap: relative links in the README don't resolve on PyPI, and a published description can't be edited. The links are absolute now, with a CI test that fails on a relative one.
The rule for both: put the check before the step that can't be undone. A check after it is just a report.