Skip to content

fix(go): compile the wrapper against the pinned ffi before releasing - #3999

Merged
kixelated merged 1 commit into
mainfrom
claude/go-wrapper-compile-gate
Sep 23, 2026
Merged

kixelated merged 1 commit into
mainfrom
claude/go-wrapper-compile-gate

Conversation

@kixelated

Copy link
Copy Markdown
Collaborator

moq.dev/moq v0.7.0 doesn't build. It pins moq.dev/moq-ffi v0.4.0, but it calls Demand / MoqTrackDemand, which that FFI doesn't have:

publish.go:322:24: m.inner.Demand undefined (type *"moq.dev/moq-ffi/moq".MoqMediaProducer has no field or method Demand)
publish.go:437:13: undefined: ffi.MoqTrackDemand

How it shipped

  1. moq-ffi-v0.4.0 was tagged at 10:47.
  2. feat(ffi): add a TrackDemand handle and expose demand() on JSON producers #3949 merged at 11:09. It added TrackDemand to moq-ffi and used it from the Go wrapper, without bumping moq-ffi's version (release-plz does that later).
  3. The next main push ran Release Go. It read the FFI version from rs/moq-ffi/Cargo.toml (still 0.4.0) and passed the gate, because moq-go-ffi v0.4.0 exists. It then published the wrapper.

package-wrapper.sh only runs go mod tidy, which never type-checks, so nothing caught the mismatch.

Fix

After tidy, package-wrapper.sh now runs go build ./... in the staged module against the pinned FFI, so a mismatch fails the release instead of publishing it. The build only compiles, never links, and moq-go-ffi ships moq.h, so it works on the stock runner.

Verified locally:

  • Current main's wrapper against ffi 0.4.0 fails with the errors above.
  • The moq-ffi-v0.4.0 wrapper against ffi 0.4.0 passes.

Trade-off: until #3945 releases moq-ffi 0.4.1, Release Go will fail on main pushes instead of silently shipping a broken module.

Unbreaking consumers

Merging release-plz #3945 bumps moq-ffi to 0.4.1, which includes #3949. The resulting moq-ffi-v0.4.1 tag runs Release Go FFI and then Release Go, which publishes a wrapper pinned to 0.4.1. Until then, go get moq.dev/moq@latest gives a module that doesn't compile. moq-dev/smoke's Go cells are red for this reason.

🤖 Generated with Claude Code

(written by Opus 5.5)

#3949 merged after moq-ffi-v0.4.0 was tagged and made the wrapper call
TrackDemand/Demand. The next main push released moq.dev/moq v0.7.0 pinned
to moq.dev/moq-ffi v0.4.0 (the Cargo.toml version), which lacks that API,
so every consumer fails to build. package-wrapper.sh only ran go mod tidy,
which never type-checks; build the staged module so a mismatch fails the
release instead of publishing it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 15 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: cbd9f323-f34e-4951-8609-cbd048c2d096

📥 Commits

Reviewing files that changed from the base of the PR and between 822287a and dcb1de1.

📒 Files selected for processing (1)
  • go/scripts/package-wrapper.sh

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.

@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-23T21:21:25.716912Z dcb1de1 PR opened
ℹ️ 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.

@kixelated

Copy link
Copy Markdown
Collaborator Author

Recommendation: MERGE

Positive improvement? Yes. moq.dev/moq v0.7.0 shipped calling Demand / MoqTrackDemand while pinned to moq-ffi v0.4.0, which lacks those symbols. Root cause is real: go mod tidy never type-checks, so the Release Go packaging path could publish an uncompilable module. Adding CGO_ENABLED=1 go build ./... against the staged tree after tidy is the right gate for that class of mismatch.

Worth the complexity? Yes. Five lines in the existing tidy block, gated by the same TIDY flag as dry-runs that skip against unpublished FFI tags. No new workflow, no new job, no version-policy machinery. Cost is intentional and temporary: main pushes fail Release Go until moq-ffi 0.4.1 lands (via #3945) instead of quietly shipping another broken wrapper. That is the correct trade for a public Go module.

Different approach? Alternatives like relying on smoke after publish, bumping FFI before merging wrapper API use, or a separate compile-only CI job are either too late (smoke) or orthogonal (process discipline). The compile check belongs here because this script is what decides the published tree. One caveat to watch: confirm the stock ubuntu-latest + setup-go runner can satisfy the cgo header/link expectations for moq-go-ffi without extra apt packages; the PR claims moq.h in the FFI module is enough and that was verified locally for the matching tag.

Ship this, then land the FFI bump so consumers and smoke go green again.

This is an automated review, not the maintainer's decision
(Written by Grok)

@kixelated
kixelated merged commit 74633d7 into main Sep 23, 2026
3 of 4 checks passed
@kixelated
kixelated deleted the claude/go-wrapper-compile-gate branch September 23, 2026 22:51
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