headroom/.github
chopratejas d73cbd6b0a fix(build): shrink Rust extension wheels — strip + thin-LTO + single codegen unit
PyPI rejected the v0.21.37 release publish with:

    HTTPError: 400 Bad Request from https://upload.pypi.org/legacy/
    Project size too large. Limit for project 'headroom-ai' total size is 10 GB.

PyPI inventory check confirmed: **191 versions × ~213 MB/release =
10.00 GB exactly** — at the cumulative project storage ceiling. Each
recent release ships 12 wheels × ~16-18 MB each.

Post-mortem inspection of a production wheel
(``headroom_ai-0.21.36-cp311-cp311-manylinux_2_28_x86_64.whl``)
showed the binary was ``not stripped``:

    .text             18.3 MB  (code)
    .rodata           11.4 MB  (Magika model + ONNX runtime data)
    .strtab            4.9 MB  (debug strings — strippable)
    .eh_frame          1.9 MB  (unwind tables)
    .symtab            1.5 MB  (debug symbols — strippable)
    .gcc_except_table  1.2 MB

This commit adds a release profile:

    [profile.release]
    strip      = "symbols"
    lto        = "thin"
    codegen-units = 1

That:
* Strips ``.symtab`` + ``.strtab`` (~6.4 MB direct savings per wheel)
* Enables thin link-time optimization for cross-crate dead-code
  elimination (~5-10% ``.text`` savings)
* Single codegen unit for better inlining + DCE at the cost of
  ~30-50% slower release builds (acceptable for CI)

Deliberately NOT setting ``panic = "abort"``:
* The proxy is a long-lived async process. A panic on one bad
  request triggering process abort would disconnect every concurrent
  client. Accept the smaller savings; keep unwind behaviour.

Estimated impact
* Per wheel: ~16-18 MB → ~10-11 MB (40% smaller)
* Per release (12 wheels): ~213 MB → ~130 MB
* PyPI capacity: ~30+ more releases before hitting 10 GB again

Verification
* Local build of ``headroom._core`` with new profile:
  ``.so`` size 29 MB on macOS arm64 (was ~45 MB pre-fix; final wheel
  compressed will be smaller on Linux which also benefits from the
  ``strip`` directive).
* 77 Rust-parity tests pass — extension still functional.
* Single-codegen-unit slows build by ~30-50% but maturin/cibuildwheel
  build time was never the bottleneck.

Forward strategy (separate work)
* Submit a PyPI project-size-limit-increase request to unblock the
  immediate release.
* Adopt a release-deprecation policy: yank versions older than N
  patches per minor; consider dropping Python 3.10 wheels (EOL'd
  October 2026) and manylinux_2_28_aarch64 wheels (niche audience,
  largest at 18.75 MB).
* Investigate runtime-download for Magika model (~10 MB further
  savings) — same pattern Kompress already uses.
2026-05-14 19:31:23 -07:00
..
act fix: skip commitlint for PR merge commits 2026-04-20 22:52:20 -05:00
actions/headroom-e2e-setup refactor: single-wheel maturin build backend (fixes #355) 2026-05-03 13:16:41 -07:00
ISSUE_TEMPLATE Prepare for OSS release v0.2.0 2026-01-07 11:36:44 -08:00
plugin fix(build): shrink Rust extension wheels — strip + thin-LTO + single codegen unit 2026-05-14 19:31:23 -07:00
workflows Merge pull request #457 from JerrettDavis/main 2026-05-11 16:09:48 -07:00
dependabot.yml ci: group dependabot minor/patch updates per ecosystem 2026-04-16 17:54:39 -05:00
FUNDING.yml Prepare for OSS release v0.2.0 2026-01-07 11:36:44 -08:00
PULL_REQUEST_TEMPLATE.md Prepare for OSS release v0.2.0 2026-01-07 11:36:44 -08:00