Repository navigation
chore(release): diff pact.h and bump doc links in FFI release PRs - #1784
Merged
Merged
Conversation
When the FFI release PR moves to a new upstream `pact_ffi` version, two steps used to be manual: checking `pact.h` for changes the Python wrappers must follow, and pointing the upstream documentation links in `pact_ffi/__init__.py` at the new version. `prepare ffi` now downloads `pact.h` for the old and new upstream versions from their GitHub releases. It appends a unified diff to the PR body in a collapsed block. The diff stops short of GitHub's PR body size limit and says how many lines it left out. An unchanged header gets a one-line note. The same run rewrites the `docs.rs/pact_ffi/X.Y.Z/` and `pact-reference/blob/pact_ffi-vX.Y.Z/` links to the new version and commits `__init__.py` with the release files. The patterns match any version, so links that drifted behind are caught too. Wrapper-only bumps (`0.5.12.0` to `0.5.12.1`) skip both steps. Wrapper changes the diff calls for still land on main as their own commit. The release branch is force-pushed on every run. Assisted-by: Claude Code:claude-opus-5-5
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1784 +/- ##
====================================
Coverage 66% 66%
====================================
Files 23 23
Lines 3565 3565
====================================
Hits 2355 2355
Misses 1210 1210
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Summary
scripts/release.py prepare ffitakes over two manual steps of every upstream FFI upgrade:pact.hdiff in the PR body. The script downloads the header for the old and new upstream versions from theirpact_ffi-v*GitHub releases. It appends a unified diff after the changelog in a collapsed<details>block. The reviewer sees at a glance whether the wrappers inpact_ffi/__init__.pyneed hand edits.docs.rs/pact_ffi/X.Y.Z/andpact-reference/blob/pact_ffi-vX.Y.Z/links inpact_ffi/__init__.py. The release commit carries the file next topyproject.tomlandCHANGELOG.md.Both steps run only when the upstream
X.Y.Zchanges. Wrapper-only bumps such as0.5.12.0 → 0.5.12.1skip them.🔥 Motivation
Each FFI upgrade (e.g. dc6f966 for 0.5.12) repeated the same chores: diff the header by hand, then bump about 250 links. The diff now arrives with the release PR. The link bump needs no commit of its own.
Design choices:
pactffi_*signatures would read faster. It would also need a C header parser, which is one more thing to break. The raw diff shows doc-comment changes too, and those often matter for wrapper docstrings.blob/masterlinks and the 2024 blog post stay untouched.Wrapper changes the diff calls for still land on main as their own commit. The release branch is force-pushed on every run.
🔨 Test Plan
scripts/release.pyhas no test suite. I verified by hand:python scripts/release.py prepare ffi --dry-runagainst the live 0.5.12 → 0.5.13 bump. The rendered body contains the real header change, a doc comment on provider-state retries. All 245 docs.rs links and all 9blob/pact_ffi-vlinks moved to 0.5.13.render_header_diffwith a 300-character budget prints the truncation note. Calling it with identical versions prints the no-change note.ruff check,ruff formatand the pre-pushmypyhook pass.🔗 Related issues/PRs