Skip to content

ci: pre-flight size+twine check before PyPI upload; drop redundant lint-version#14

Closed
r-barnes wants to merge 4 commits into
mainfrom
fix/release-preflight-and-lint-version
Closed

ci: pre-flight size+twine check before PyPI upload; drop redundant lint-version#14
r-barnes wants to merge 4 commits into
mainfrom
fix/release-preflight-and-lint-version

Conversation

@r-barnes

Copy link
Copy Markdown
Contributor

Summary

Two changes to release.yml to make PyPI uploads more robust:

1. Pre-flight validation before upload

Adds a step between artifact download and pypa/gh-action-pypi-publish that validates every file in pypi_dist/ before any upload begins:

  • Size gate: fails if any file exceeds PyPI's 100 MB per-file limit
  • twine check --strict: validates wheel metadata, RECORD integrity, and sdist structure

PyPI has no atomic upload API — files land one at a time with no rollback. A rejection mid-upload (e.g. an oversized Linux wheel) leaves a partial release on the index, which then blocks future retries via the "version already exists" check. Failing before touching PyPI keeps the index clean.

2. Remove lint-version.py from validate

lint-version.py checks both PyPI and TestPyPI and hard-fails if the version is already present. After the partial v1.0.0 upload (macOS wheels + sdist succeeded before Linux wheels hit 100 MB), this check permanently blocked retries — even though skip-existing: true would have handled the re-upload correctly.

lint-version.py is already a required CI gate via lint-version.yml in REQUIRED_WORKFLOWS. By the time the release runs, the version has already been validated. Running it again here is redundant and actively harmful on retry.

Test plan

  • Confirm pre-flight step logs file sizes and passes twine check on a good set of distributions
  • Confirm pre-flight step exits 1 (without uploading anything) when a file exceeds 100 MB
  • Confirm release runs successfully after a prior partial upload (retry scenario)
@meta-cla meta-cla Bot added the cla signed label Jun 13, 2026
r-barnes added 4 commits June 13, 2026 10:45
Pre-flight (before pypa/gh-action-pypi-publish):
- Fails the job if any file in pypi_dist/ exceeds PyPI's 100 MB per-file
  limit, aborting before any file is uploaded.
- Runs twine check --strict to catch metadata/RECORD issues early.
This keeps the index clean: a rejection mid-upload leaves a partial
release that blocks future retries via the version-already-exists check.

Remove lint-version.py from validate:
lint-version.py checks TestPyPI and hard-fails if the version is already
there. After a partial upload (some files succeeded before a rejection),
this blocked all subsequent retries even though skip-existing: true would
have handled the re-upload correctly. lint-version.py is already a
required CI gate via lint-version.yml in REQUIRED_WORKFLOWS, so running
it again here is redundant and actively harmful on retry.
A partial upload (some files succeeded before a rejection) is now treated
as unrecoverable rather than retryable. skip-existing: true is removed so
a re-run after a partial upload fails explicitly instead of silently
completing a mismatched set. The pre-flight step queries the TestPyPI JSON
API and aborts before touching the index if any files for this version are
already there, with a message directing the operator to bump the version or
yank the partial release.
The release workflow can be triggered manually via workflow_dispatch
independently of regular CI, so lint-version.py's format/monotonicity/
tag checks are still needed. The index (PyPI/TestPyPI already-published)
check is skipped here because the pre-flight step in publish owns it with
a clearer error message — and the index check would permanently block
retries after a partial upload.
@r-barnes r-barnes force-pushed the fix/release-preflight-and-lint-version branch from db65f66 to ab75ae0 Compare June 13, 2026 17:45
@meta-codesync

meta-codesync Bot commented Jun 13, 2026

Copy link
Copy Markdown

@r-barnes has imported this pull request. If you are a Meta employee, you can view this in D108520140.

@meta-codesync meta-codesync Bot closed this in cbf4085 Jun 14, 2026
@meta-codesync meta-codesync Bot added the Merged label Jun 14, 2026
@meta-codesync

meta-codesync Bot commented Jun 14, 2026

Copy link
Copy Markdown

@r-barnes merged this pull request in facebookincubator/rebalancer@cbf40858652e584de5a466080dec9739fcbf7566.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

1 participant