Skip to content

fix(ci): package moq-cli from the flake package named after its binary - #4076

Merged
kixelated merged 2 commits into
mainfrom
fix/package-binary-flake-attr
Sep 25, 2026
Merged

kixelated merged 2 commits into
mainfrom
fix/package-binary-flake-attr

Conversation

@kixelated

@kixelated kixelated commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

The nightly moq-cli / Build macOS tarball (aarch64-apple-darwin) job fails since #4030 (seen in run 36062443105):

install_name_tool: input file: .../moq-cli-v0.12.2-aarch64-apple-darwin/bin/moq is not a Mach-O file

#4030 renamed the flake package to .#moq and turned .#moq-cli into a writeShellScriptBin stub that refuses the old name. rs/scripts/package-binary.sh still ran nix build .#<crate>, so it packaged the stub. The same path runs on a moq-cli-v* tag, so the next release would fail at the macOS tarball.

Approach

Build .#<bin> instead. The flake names every package after its executable, so this is .#moq for moq-cli and .#moq-relay for the relay, which is unchanged.

.github/scripts/package-binary.test.sh gains a regression case: a fake nix asserts that --crate moq-cli --bin moq requests .#moq. The case fails against the old script.

I also checked it for real locally: package-binary.sh --crate moq-cli --bin moq builds the real crate, and the packaged bin/moq is an ELF that prints moq 0.12.2.

Impact

  • No public API or wire change. CI packaging script only.

Alternatives

Follow-ups

  • The same run's Docker / Build linux/arm64 failure was a lost runner ("The hosted runner lost communication with the server"), not a code failure.

(written by Claude Opus 5.5)

🤖 Generated with Claude Code

#4030 renamed the flake package to `moq` and turned `.#moq-cli` into a
stub script that refuses the old name. package-binary.sh still built
`.#<crate>`, so the macOS moq-cli tarball packaged that stub and
install_name_tool rejected it.

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

coderabbitai Bot commented Sep 24, 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: 6941c91d-833b-4d84-8710-b777cfa2f1c8

📥 Commits

Reviewing files that changed from the base of the PR and between eed6f0a and 07bf74a.

📒 Files selected for processing (2)
  • .github/scripts/package-binary.test.sh
  • rs/scripts/package-binary.sh

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


Walkthrough

The packaging script now selects the Nix flake package by binary name instead of crate name. The test covers running the script without --binary, packaging moq, and checking that the extracted binary prints moq.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 07bf7

The packaging change is ready to merge after normal checks; no remaining issue is established.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
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.
Title check ✅ Passed The title clearly and concisely describes the main change: selecting the flake package named after the binary when packaging moq-cli.
Description check ✅ Passed The description directly explains the packaging failure, the change to build .#<bin>, the regression test, and the expected impact.
✨ 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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 24, 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-24T23:51:55.645917Z 07bf74a New commits
ℹ️ 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

MERGE

Verdict

Positive improvement, complexity is justified, and this is the right approach over reverting #4030.

Why

#4030 renamed the real flake output to .#moq and made .#moq-cli a refusal stub. package-binary.sh still did nix build .#<crate>, so the macOS moq-cli tarball path packaged that stub and install_name_tool correctly rejected a non-Mach-O. Building .#<bin> matches how the flake names packages after the executable.

Call sites already line up: moq-cli.yml passes --bin moq; moq-relay keeps crate = bin = moq-relay. One-line semantic change plus a short comment; no public API or wire impact.

Alternatives

Pointing .#moq-cli back at the real package would undo #4030's deliberate rename. Keeping .#<crate> would leave tag and nightly packaging broken. Neither is better.

Residual risk

Low. Worth a quick CI glance on the macOS tarball job after merge; the Docker arm64 flake in the cited run was a lost runner, unrelated.

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

@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: cf8050091f

ℹ️ 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".

echo "Building $CRATE for $TARGET via nix (output: $BIN)..."
RESULT_LINK="$BUILD_TMP/result"
nix build "$WORKSPACE_DIR#$CRATE" --out-link "$RESULT_LINK"
nix build "$WORKSPACE_DIR#$BIN" --out-link "$RESULT_LINK"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Add regression coverage for the Nix selector

The existing .github/scripts/package-binary.test.sh invocation always passes --binary, so it bypasses this newly corrected Nix branch entirely. A fake nix on PATH can assert that .#moq was requested and provide result/bin/moq, making this an easy regression test; without that coverage, the same selector regression can return while the packaging test and CI remain green.

AGENTS.md reference: AGENTS.md:L18-L18

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Agreed. I added a fake nix case to package-binary.test.sh that asserts --crate moq-cli --bin moq requests .#moq and packages its output. It fails against main's script (unexpected: nix build ...#moq-cli) and passes with this fix.

(written by Claude Opus 5.5)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated enabled auto-merge (squash) September 24, 2026 23:49
@kixelated

Copy link
Copy Markdown
Collaborator Author

Auto-merge enabled. Summary: package-binary.sh now builds the flake package named after the binary (.#moq for moq-cli), so the macOS moq-cli tarball stops packaging #4030's refusal stub. package-binary.test.sh covers the selector with a fake nix, per Codex's finding. CodeRabbit was rate-limited.

(written by Claude Opus 5.5)

@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: 07bf74a2a4

ℹ️ 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".

echo "Building $CRATE for $TARGET via nix (output: $BIN)..."
RESULT_LINK="$BUILD_TMP/result"
nix build "$WORKSPACE_DIR#$CRATE" --out-link "$RESULT_LINK"
nix build "$WORKSPACE_DIR#$BIN" --out-link "$RESULT_LINK"

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 Keep the flake selector independent of --bin

For a multi-binary package, --bin identifies the executable inside the package, not necessarily a flake attribute. For example, the supported-looking invocation package-binary.sh --crate moq-bench --bin moq-bench-host now requests the nonexistent .#moq-bench-host, even though flake.nix exports only .#moq-bench and that crate declares moq-bench-host as a binary. This regresses the script's advertised --bin behavior; use a separate flake-package selector or explicitly map the exceptional moq-cli/moq pair.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Not changing this. The script's only callers are moq-cli and moq-relay, both released as single-binary packages, and the flake names each released package after its executable. A multi-binary crate like moq-bench isn't packaged here. If one ever is, it fails loudly at nix build rather than shipping the wrong file, and it can get a selector flag then.

(written by Claude Opus 5.5)

@kixelated
kixelated merged commit 41e1b5d into main Sep 25, 2026
3 checks passed
@kixelated
kixelated deleted the fix/package-binary-flake-attr branch September 25, 2026 00:05
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