Skip to content

ci(release): refuse PyPI publication without storage headroom (#1756) - #1787

Merged
zackees merged 1 commit into
mainfrom
agent/pypi-quota-preflight
Oct 29, 2026
Merged

zackees merged 1 commit into
mainfrom
agent/pypi-quota-preflight

Conversation

@zackees

@zackees zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member

Why

PyPI caps a project's total stored bytes at 10 GB and enforces the cap mid-upload: it accepts the
first files of a release and then rejects the rest with 400 Project size too large. That is exactly
what happened to v2.5.46 (#1756) — 1 of 5 wheels uploaded, so PyPI advertised a version only Intel
macOS could install. Nothing in the release pipeline noticed the quota until files were already
committed to an immutable version number.

What changed

ci/publish.py gains a storage preflight, and both release stages now consult it before any
upload:

Stage Guard
prepare estimate_upload_storage() — no wheels are built yet, so per-wheel weight is estimated from this version's already-stored files (the stranded-release case), else the largest wheel of any older release. Refuses the dispatch while nothing has been uploaded.
build-pypi measured_upload_storage() — real wheel sizes, fetched against live PyPI JSON, immediately before publish-pypi runs.
publish-pypi Verify all wheels visible on PyPI (existing) still catches a genuine partial upload.

The module gains one narrow CLI, python -m ci.publish --pypi-json <saved json> [--version V --expected-wheels N | --wheel dist/wheels/*.whl],
which prints the verdict and exits non-zero when the batch would not fit. No upload code, no auth, no
secrets — OIDC trusted publishing is untouched.

Refusal message is actionable and names the doc URL:

PyPI storage: 9.87 GB of a 10.00 GB project limit (0.13 GB free)
this upload needs 214 MB for 1 built wheel(s)
refusing to publish: this would exceed the limit by 84 MB, and PyPI
enforces the limit mid-upload, which strands a version at partial wheels (#1756).
Free space first: request a project size increase or delete old releases in the
PyPI web UI - https://docs.pypi.org/project-management/storage-limits/

Verification (real output)

Against live https://pypi.org/pypi/fbuild/json (fetched during this run):

$ python -m ci.publish --pypi-json pypi-fbuild.json --version 2.5.46 --expected-wheels 5
PyPI storage: 9.87 GB of a 10.00 GB project limit (0.13 GB free)
this upload needs 0 MB - headroom is sufficient        exit=0

$ python -m ci.publish --pypi-json pypi-fbuild.json --wheel fbuild-2.5.48-manylinux_2_17_x86_64.whl  # 204 MB
PyPI storage: 9.87 GB of a 10.00 GB project limit (0.13 GB free)
this upload needs 214 MB for 1 built wheel(s)
refusing to publish: ... would exceed the limit by 84 MB ...            exit=1

So the guard passes an already-complete version and refuses the next release, which is the live
situation: 92 versions / 9.870 GB, ~130 MB free, one release ≈ 204 MB.

Gates (all run locally, real output):

  • uv run --no-project python -m unittest ci.test_publish_quota → 15 tests, OK (project-size
    summation, malformed/missing size fields, stranded-version estimate, fresh-release fallback,
    exact-headroom boundary, one-byte-over boundary, measured mode, CLI exit codes)
  • --with pyyaml python -m unittest ci.test_fractional_workflows ci.test_local_gate ci.test_local_dylint_gate ci.test_publish_quota
    → 47 tests, OK
  • ci/render_workflows.py --check → rc=0; ci/check_workflow_concurrency.py → OK
  • ruff check ci/publish.py ci/test_publish_quota.py ci/local_gate.py → all checks passed
  • ci/check_python_complexity.py → all checks passed
  • YAML parses for both edited workflows

Not run: the Rust workspace suite (bash test) — this diff touches no Rust, and the full run is ~1 h.

Notes

  • ci/test_publish_quota.py is registered in ci-workflow-drift.yml and ci/local_gate.py so it
    runs in CI rather than only by hand.
  • Measured mode re-counts wheels that skip-existing would skip, i.e. it is deliberately
    conservative.
  • docs/RELEASING.md documents both guards and the maintainer recovery path (increase limit or
    prune old releases, then re-dispatch the same candidate SHA with publish=true).

Refs #1756 (recovery of 2.5.46 itself remains a maintainer action in the PyPI web UI).

PyPI enforces the 10 GB project storage limit mid-upload: it accepts the
first files of a release, then rejects the remainder with '400 Project
size too large'. v2.5.46 stranded that way at 1 of 5 wheels, so PyPI
advertised a version only Intel macOS could install.

ci/publish.py gains a storage preflight (pypi_project_bytes,
estimate_upload_storage for the prepare stage, measured_upload_storage
for the real wheel sizes) plus a narrow 'python -m ci.publish' CLI.
prepare refuses a dispatch the estimate says cannot fit; build-pypi
repeats the check with the built wheels before publish-pypi runs.

Refs #1756.
@coderabbitai

coderabbitai Bot commented Oct 29, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@zackees
zackees added this pull request to the merge queue Oct 29, 2026
Merged via the queue into main with commit 7464528 Oct 29, 2026
29 checks passed
@zackees
zackees deleted the agent/pypi-quota-preflight branch October 29, 2026 18:47
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

1 participant