Skip to content

fix(ci): defer wrapper releases while moq-ffi has unreleased changes - #4009

Merged
kixelated merged 1 commit into
mainfrom
fix/wrapper-ffi-guard
Sep 23, 2026
Merged

kixelated merged 1 commit into
mainfrom
fix/wrapper-ffi-guard

Conversation

@kixelated

Copy link
Copy Markdown
Collaborator

Problem

moq-ffi-v0.4.0 was tagged before #3949 (TrackDemand) merged, so the wrappers on main called FFI API that no published moq-ffi had.

  • Kotlin published dev.moq:moq:0.5.0. It compiles against bindings generated from HEAD, but its only FFI guard checked that some dev.moq:moq-ffi in [0.4,0.5) was on Maven Central. At runtime, demand() has nothing behind it until 0.4.1 lands.
  • Go published moq.dev/moq@v0.7.0, which doesn't compile. fix(go): compile the wrapper against the pinned ffi before releasing #3999 added a go build against the pinned ffi. That catches the problem, but every main push fails Release Go (and alerts) until the next ffi release.
  • Swift and Python held back because they check git diff moq-ffi-v<crate version> HEAD -- rs/moq-ffi and defer to the FFI release chain. Each had its own inline copy of the check.

Approach

  • Move the Swift/Python check into release.sh ffi-unreleased <version>. It emits unreleased=true and a ::warning:: when the moq-ffi-v<version> tag is missing (release in flight) or rs/moq-ffi changed since that tag.
  • Kotlin:
    • Runs the new check.
    • Chains off Release Kotlin FFI through workflow_run, with the same trust gate as Swift/Python, and builds from that tag's commit.
    • Requires the exact dev.moq:moq-ffi:<crate version> on Maven Central instead of any version in range. maven-version-in-range is now unused, so it's deleted.
  • Go: push runs the check first and skips when it fires, the same way it already skips when the ffi mirror tag is missing. fix(go): compile the wrapper against the pinned ffi before releasing #3999's compile check stays as the backstop, for example on workflow_run, which builds main HEAD.
  • Swift: PR dry-runs now diff against the ffi tag instead of against the PR base, so they no longer try to cross-resolve the published FFI when main is ahead of it.
  • Python and Swift: switched to the shared check. Behavior is otherwise unchanged.
  • Added .github/scripts/release.test.sh, which just check runs from .github/justfile.

Dry-runs: the Kotlin and Swift PR runs still build the wrapper. They also run the check, so a PR merged while the ffi is ahead shows a warning that says so. Python and Go have no PR dry-run. Nightly does not call the wrapper workflows.

Trade-off: diff guard vs compiling against the published FFI

A compile against the published artifact is the stronger check. It only flags FFI changes the wrapper actually uses. It is also costly:

  • Swift already does it (the verify job on macOS).
  • Kotlin would need Gradle to drop the project substitution and resolve dev.moq:moq-ffi from Maven.
  • A mismatch fails the run instead of deferring, so main stays red until release-plz merges. Release Go shows that today.

The diff guard is one cheap git diff, already proven in Swift and Python, and defers instead of failing. The FFI release then re-triggers the wrapper. The cost is false positives: any rs/moq-ffi change, even one the wrapper doesn't use, holds wrapper releases until the next ffi release. release-plz cuts that release whenever rs/moq-ffi changes, so the hold is bounded. Go keeps its compile check and Swift keeps its verify job as backstops.

Impact

  • No public API or wire changes. CI only.
  • release.sh: adds ffi-unreleased and removes maven-version-in-range.
  • Kotlin, Go, Python, and Swift wrapper releases are held while rs/moq-ffi is ahead of its tag. Kotlin now publishes from the Release Kotlin FFI chain.

Alternatives

  • Compile each wrapper against the published FFI. See the trade-off above.
  • Diff only the generated bindings instead of rs/moq-ffi. Fewer false positives, but it needs a Rust build at both refs.

Follow-ups

  • Dependency floors. The Kotlin [0.4,0.5), Python ~= 0.4.0, and Dart ^0.4.0 floors are set by hand. Nothing stops a consumer that pins moq-ffi 0.4.0 from resolving it under a wrapper that needs 0.4.1. Swift and Go derive the floor from the ffi they built against. Changing this is a version-coupling policy call for the maintainer.
  • Kotlin 0.5.0 heals once dev.moq:moq-ffi:0.4.1 is on Maven Central, because its range floats. Go 0.7.0 is re-cut by the Release Go FFI chain.

🤖 Generated with Claude Code

(written by Opus 5.5)

Release Kotlin lib published dev.moq:moq:0.5.0 compiled against bindings
generated from main, which already used TrackDemand, while the newest
published dev.moq:moq-ffi (0.4.0) predates it. Swift and Python already
defer in that case by diffing rs/moq-ffi against its release tag.

Move that check into `release.sh ffi-unreleased` and use it from the
Kotlin, Go, Swift, and Python wrapper releases. Kotlin now also chains
off Release Kotlin FFI so a deferred wrapper publishes once the bindings
land, and requires the exact bindings version rather than any in range.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated marked this pull request as ready for review September 23, 2026 23:07
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-23T23:11:22.802219Z b2c0aab Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b2c0aab7ce

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
with:
ref: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || github.sha }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Rebuild deferred Kotlin releases from the deferred commit

When a Kotlin wrapper bump lands after the moq-ffi tag is pushed but before Release Kotlin FFI finishes, its push run sees the bindings as unpublished and defers, but this workflow_run checks out the older tag SHA. It then reads and builds the pre-bump wrapper and may no-op because that old version is already on Maven, leaving the newer wrapper unpublished until a manual dispatch or another FFI release. The chained run must evaluate the deferred wrapper commit or current branch while still guarding against newer unreleased FFI changes.

Useful? React with 👍 / 👎.

@coderabbitai

coderabbitai Bot commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 767feb2d-a196-4db1-a28a-008d66966b17

📥 Commits

Reviewing files that changed from the base of the PR and between c2f72f2 and b2c0aab.

📒 Files selected for processing (8)
  • .github/justfile
  • .github/scripts/release.sh
  • .github/scripts/release.test.sh
  • .github/workflows/release-go.yml
  • .github/workflows/release-kt-lib.yml
  • .github/workflows/release-py.yml
  • .github/workflows/release-swift-lib.yml
  • kt/README.md

Included review availability: Your plan provides up to 4 included reviews per hour; 0 remain after this review.


Walkthrough

The release script adds an ffi-unreleased check and removes Maven version-range checking. Go, Python, and Swift workflows use the check in their release gates. The Kotlin workflow adds a trigger tied to the Kotlin FFI release and defers wrapper publishing when the FFI version has unreleased changes. A shell test covers the check, and the repository check recipe runs that test.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to b2c0a

This CI-only change defers Go, Python, Swift, and Kotlin wrapper releases until any pending moq-ffi changes are released, and adds a tested shared check for this. No concrete defects were found. The main trade-off, which the author states, is that wrappers may be deferred for FFI changes they do not use. The change is ready to merge.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. (6 skipped: 6… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: deferring wrapper releases while moq-ffi has unreleased changes.
Description check ✅ Passed The description directly explains the CI problem, implementation, affected workflows, tests, trade-offs, and expected impact.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. (6 skipped: 6 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
✨ Simplify code
  • Commit to this branch
  • Create a new PR

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.

@kixelated
kixelated merged commit 25fcdce into main Sep 23, 2026
16 checks passed
@kixelated
kixelated deleted the fix/wrapper-ffi-guard branch September 23, 2026 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant