Skip to content

ci(packaging): validate sdist+wheel metadata with twine on every PR#1355

Merged
mergify[bot] merged 2 commits intomainfrom
devs/jd/worktree-rust-port/validate-sdist-wheel-metadata-twine-pr--0f7338df
May 5, 2026
Merged

ci(packaging): validate sdist+wheel metadata with twine on every PR#1355
mergify[bot] merged 2 commits intomainfrom
devs/jd/worktree-rust-port/validate-sdist-wheel-metadata-twine-pr--0f7338df

Conversation

@jd
Copy link
Copy Markdown
Member

@jd jd commented May 5, 2026

Without this, packaging-metadata bugs only surface at
release: published time — release 2026.5.5.1 was rejected by
PyPI's upload validator with 400 License-File LICENSE does not exist in distribution file because the LICENSE auto-bundling
hadn't been wired up. PR CI couldn't have caught it: build-sdist
was gated on inputs.stamp-version, so PR runs skipped the sdist
entirely, and there was no twine invocation anywhere.

Two changes:

  1. build-sdist now runs on every PR. The version-stamping step
    and the artifact upload still gate on inputs.stamp-version
    (PR builds keep the placeholder version and skip the upload —
    the artifact is only useful for the publish job in
    release.yml). The Python toolchain is provisioned the same
    way as the wheel jobs.

  2. twine check --strict runs against both the wheel (per
    matrix target) and the sdist immediately after each is built.
    Strict mode applies the same metadata rules PyPI's upload
    validator does — README rendering,
    Description-Content-Type, License-File presence — so a
    mismatch fails PR CI instead of the next release.

The cost is one extra ubuntu-24.04 job (~30s for sdist + twine
check) and a few seconds per wheel-matrix shard for the twine
install + check.

Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

Depends-On: #1354

jd and others added 2 commits May 5, 2026 12:12
The 2026.5.5.1 release upload to PyPI failed with
``400 License-File LICENSE does not exist in distribution file
mergify_cli-2026.5.5.1.tar.gz at mergify_cli-2026.5.5.1/LICENSE``.

Maturin auto-derives a ``License-File: LICENSE`` PEP 639 metadata
field from ``license = "Apache-2.0"`` plus the project root
``LICENSE`` file, but the sdist tarball (``maturin sdist``) packs
the cargo workspace and the Python source dir without picking up
the project root ``LICENSE`` itself. PyPI's upload validator
cross-checks the metadata against the tarball contents and 400s
when they disagree.

Listing ``LICENSE`` in ``[tool.maturin].include`` puts it back in
both the wheel and the sdist, so the metadata claim is honored and
PyPI accepts the upload.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Change-Id: Ie45717750af52467929600966592cb8453d3b4d2
Without this, packaging-metadata bugs only surface at
``release: published`` time — release 2026.5.5.1 was rejected by
PyPI's upload validator with ``400 License-File LICENSE does not
exist in distribution file`` because the LICENSE auto-bundling
hadn't been wired up. PR CI couldn't have caught it: ``build-sdist``
was gated on ``inputs.stamp-version``, so PR runs skipped the sdist
entirely, and there was no twine invocation anywhere.

Two changes:

1. ``build-sdist`` now runs on every PR. The version-stamping step
   and the artifact upload still gate on ``inputs.stamp-version``
   (PR builds keep the placeholder version and skip the upload —
   the artifact is only useful for the publish job in
   ``release.yml``). The Python toolchain is provisioned the same
   way as the wheel jobs.

2. ``twine check --strict`` runs against both the wheel (per
   matrix target) and the sdist immediately after each is built.
   Strict mode applies the same metadata rules PyPI's upload
   validator does — README rendering,
   ``Description-Content-Type``, ``License-File`` presence — so a
   mismatch fails PR CI instead of the next release.

The cost is one extra ubuntu-24.04 job (~30s for sdist + twine
check) and a few seconds per wheel-matrix shard for the twine
install + check.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Change-Id: I0f7338df02bbf600804a58bcb996bcb882de6010
@jd
Copy link
Copy Markdown
Member Author

jd commented May 5, 2026

This pull request is part of a Mergify stack:

# Pull Request Link
1 fix(packaging): bundle LICENSE in wheel and sdist #1354
2 ci(packaging): validate sdist+wheel metadata with twine on every PR #1355 👈
3 chore(port): drop PORT_STATUS.toml inventory in favor of port-and-delete #1351
4 docs(port): add port review checklist for HTTP/test/UX parity pitfalls #1357
5 feat(rust): port queue pause and unpause to native Rust (Phase 1.5) #1352
6 feat(rust): port ci git-refs and ci queue-info to native Rust (Phase 1.6) #1353
7 feat(rust): port queue status to native Rust (Phase 1.7) #1359

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented May 5, 2026

Merge Protections

Your pull request matches the following merge protections and will not be merged until they are valid.

🟢 ⛓️ Depends-On Requirements

Wonderful, this rule succeeded.

Requirement based on the presence of Depends-On in the body of the pull request

🟢 🤖 Continuous Integration

Wonderful, this rule succeeded.
  • all of:
    • check-success=ci-gate

🟢 👀 Review Requirements

Wonderful, this rule succeeded.
  • any of:
    • #approved-reviews-by>=2
    • author = dependabot[bot]
    • author = mergify-ci-bot
    • author = renovate[bot]

🟢 Enforce conventional commit

Wonderful, this rule succeeded.

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert|ui)(?:\(.+\))?:

🟢 🔎 Reviews

Wonderful, this rule succeeded.
  • #changes-requested-reviews-by = 0
  • #review-requested = 0
  • #review-threads-unresolved = 0

🟢 📕 PR description

Wonderful, this rule succeeded.
  • body ~= (?ms:.{48,})

Base automatically changed from devs/jd/worktree-rust-port/bundle-license-wheel-sdist--e4571775 to main May 5, 2026 10:25
@jd jd marked this pull request as ready for review May 5, 2026 10:25
Copilot AI review requested due to automatic review settings May 5, 2026 10:25
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds packaging validation to PR CI so metadata problems are caught before release publishing, aligning the reusable wheel/sdist workflow with the packaging fix from #1354.

Changes:

  • Add LICENSE to the maturin package include list so built artifacts match the emitted License-File metadata.
  • Run the reusable build-sdist job on every PR instead of only on release builds.
  • Run twine check --strict after building each wheel and the sdist to validate publish-time metadata rules in CI.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
pyproject.toml Includes LICENSE in maturin-built distributions to keep packaged contents aligned with metadata.
.github/workflows/build-wheels.yml Expands reusable packaging CI to always build the sdist on PRs and validates both wheel and sdist metadata with Twine.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mergify mergify Bot requested a review from a team May 5, 2026 10:31
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented May 5, 2026

Merge Queue Status

This pull request spent 12 minutes 22 seconds in the queue, including 11 minutes 56 seconds running CI.

Required conditions to merge

mergify Bot added a commit that referenced this pull request May 5, 2026
@mergify mergify Bot added the queued label May 5, 2026
@mergify mergify Bot merged commit b1c384e into main May 5, 2026
22 checks passed
@mergify mergify Bot deleted the devs/jd/worktree-rust-port/validate-sdist-wheel-metadata-twine-pr--0f7338df branch May 5, 2026 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

5 participants