Skip to content

fix(pack): update libsui and test musl - #4283

Merged
codeshaunted merged 2 commits into
canaryfrom
codex/baml-pack-audit
Jul 30, 2026
Merged

codeshaunted merged 2 commits into
canaryfrom
codex/baml-pack-audit

Conversation

@codeshaunted

@codeshaunted codeshaunted commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Issue Reference

Changes

  • Upgrade libsui from 0.14.0 to 0.16.4.
  • Replace the custom ELF note writer with libsui::Elf::append.
  • Add normal CI coverage for x86_64-unknown-linux-musl, including the target-compatible workspace suite and pack_e2e.
  • Rename Cargo test jobs to their full target triples.
  • Verify packed baml.sys.exit(42) programs propagate exit code 42.

Testing

  • Unit tests added/updated
  • Manual testing performed
  • Tested on macOS aarch64

Commands run:

  • cargo test -p baml_cli --test pack_e2e --all-features
  • python3 -m unittest scripts.tests.test_release_pipeline_contract
  • cargo fmt --all -- --check
  • Repository pre-commit hooks, including Cargo clippy and YAML/TOML validation

The new musl execution runs in CI.

Screenshots

Not applicable.

PR Checklist

  • I have read and followed the contributing guidelines
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • My changes generate no new warnings

Summary by CodeRabbit

  • New Features

    • Enhanced Linux MUSL packaging and end-to-end validation in the release pipeline.
    • Updated Linux executable packaging to use the shared ELF utility for embedding runtime data.
  • Bug Fixes

    • Improved reliability of Linux packaging by removing ELF note injection that could conflict with memory layout.
    • Streamlined packaging behavior to better match shipped MUSL artifacts.
  • Tests

    • Strengthened release checks for target-specific job naming and ensured MUSL runs the pack end-to-end tests.
    • Updated pack end-to-end coverage to validate the expected exit-code handling scenario.

@vercel

vercel Bot commented Jul 30, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
beps Error Error Jul 30, 2026 6:32pm
promptfiddle2 Ready Ready Preview Jul 30, 2026 6:32pm

Request Review

@github-actions

Copy link
Copy Markdown

⏭️ Performance benchmarks were skipped

Perf benchmarks (CodSpeed) are opt-in on pull requests — they no longer run on every push. They always run automatically after merge to canary/main.

To run them on this PR, do any of the following, then push a commit (or re-run CI):

  • Add RUN_CODSPEED=1 to the PR description, or
  • Include run-perf or /perf in the PR title or any commit message.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR updates Linux ELF packing to use libsui, removes the custom ELF module and object dependency, adds dedicated x86_64 musl CI coverage, and validates target naming and workflow wiring.

Changes

Musl packaging

Layer / File(s) Summary
Linux ELF embedding
baml_language/Cargo.toml, baml_language/crates/baml_cli/..., baml_language/crates/baml_cli/tests/pack_e2e.rs
libsui is upgraded, the pinned object dependency and custom pack_elf module are removed, Linux packing uses libsui::Elf, and the exit-code test expects 42.
Musl CI and workflow contracts
.github/workflows/cargo-tests.reusable.yaml, scripts/tests/test_release_pipeline_contract.py
CI adds x86_64 musl testing with separate pack_e2e execution, includes musl artifacts in aggregations, names target jobs explicitly, and verifies the workflow structure.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CI
  participant cargo_nextest
  participant baml_cli
  participant packed_binary
  CI->>cargo_nextest: run standard musl tests excluding pack_e2e
  CI->>baml_cli: run pack_e2e
  baml_cli->>packed_binary: produce and execute packed program
  packed_binary-->>CI: return exit code 42
Loading

Possibly related PRs

Suggested reviewers: rossirpaulo, 2kai2kai2

Poem

A rabbit packs ELF beneath the moon,
Musl tests hop through CI soon.
Exit forty-two, ears held high,
Timings and caches drift by.
Libsui leads the way—
Thump-thump, ship today!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main changes: libsui update and musl packing/test coverage.
Linked Issues check ✅ Passed The PR addresses #4279 by switching to libsui packing and adding musl CI coverage for the failing pack path.
Out of Scope Changes check ✅ Passed The dependency, workflow, and test edits all support the musl packing fix; no unrelated changes stand out.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Fix failing CI checks
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/baml-pack-audit

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.

@vercel
vercel Bot temporarily deployed to Preview – promptfiddle2 July 30, 2026 18:16 Inactive
@vercel
vercel Bot temporarily deployed to Preview – beps July 30, 2026 18:22 Inactive

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
scripts/tests/test_release_pipeline_contract.py (1)

671-673: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert the pack_e2e nextest exclusion.

The workflow intentionally excludes pack_e2e from nextest and runs it separately, but this contract only checks the generic nextest command. Assert the exact filter so the test catches duplicate or incorrectly combined execution.

Proposed contract assertion
         self.assertIn("cargo nextest run --workspace", musl)
+        self.assertIn("-E 'not binary(=pack_e2e)'", musl)
         self.assertIn("cargo test -p baml_cli --test pack_e2e", musl)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/tests/test_release_pipeline_contract.py` around lines 671 - 673,
Update the contract assertions around the musl workflow string in the test
method containing the existing nextest checks to verify that the generic nextest
command excludes the pack_e2e test via its exact filter. Preserve the separate
`cargo test -p baml_cli --test pack_e2e` assertion and ensure the assertion
rejects duplicate or combined execution.
.github/workflows/cargo-tests.reusable.yaml (1)

169-190: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift

Cover both musl targets required by the PR.

The new workflow and contract test exercise only x86_64-unknown-linux-musl, while the stated objective includes aarch64-unknown-linux-musl. Without a matching CI path, aarch64-specific packaging regressions can remain undetected.

  • .github/workflows/cargo-tests.reusable.yaml#L169-L190: add an aarch64 musl job or provide equivalent existing coverage.
  • scripts/tests/test_release_pipeline_contract.py#L659-L665: include the aarch64 target and assert its workflow job.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/cargo-tests.reusable.yaml around lines 169 - 190, The musl
coverage currently exercises only x86_64, so add equivalent aarch64 musl CI
coverage in the cargo-test workflow, including the required target/toolchain
setup and test execution. Update scripts/tests/test_release_pipeline_contract.py
at lines 659-665 to include aarch64-unknown-linux-musl and assert its workflow
job; both listed sites require changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In @.github/workflows/cargo-tests.reusable.yaml:
- Around line 169-190: The musl coverage currently exercises only x86_64, so add
equivalent aarch64 musl CI coverage in the cargo-test workflow, including the
required target/toolchain setup and test execution. Update
scripts/tests/test_release_pipeline_contract.py at lines 659-665 to include
aarch64-unknown-linux-musl and assert its workflow job; both listed sites
require changes.

In `@scripts/tests/test_release_pipeline_contract.py`:
- Around line 671-673: Update the contract assertions around the musl workflow
string in the test method containing the existing nextest checks to verify that
the generic nextest command excludes the pack_e2e test via its exact filter.
Preserve the separate `cargo test -p baml_cli --test pack_e2e` assertion and
ensure the assertion rejects duplicate or combined execution.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2e24f590-04da-4930-b6e2-dcdd719efdf4

📥 Commits

Reviewing files that changed from the base of the PR and between f4c1a46 and ec4d7d9.

📒 Files selected for processing (2)
  • .github/workflows/cargo-tests.reusable.yaml
  • scripts/tests/test_release_pipeline_contract.py

@vercel
vercel Bot temporarily deployed to Preview – promptfiddle2 July 30, 2026 18:32 Inactive
@github-actions

Copy link
Copy Markdown

Binary size checks passed

✅ 7 passed

Artifact Platform File Gzip Gated on Baseline Delta Status
✅ baml-cli Linux 🔒 27.3 MB 11.6 MB file 27.4 MB -53.1 KB (-0.2%) OK
✅ packed-program Linux 🔒 17.8 MB 7.3 MB file 17.7 MB +30.2 KB (+0.2%) OK
✅ baml-cli macOS 🔒 21.2 MB 10.2 MB file 21.3 MB -51.6 KB (-0.2%) OK
✅ packed-program macOS 🔒 13.9 MB 6.4 MB file 13.8 MB +11.9 KB (+0.1%) OK
✅ baml-cli Windows 🔒 22.9 MB 10.4 MB file 23.0 MB -84.1 KB (-0.4%) OK
✅ packed-program Windows 🔒 14.8 MB 6.5 MB file 14.8 MB -4.1 KB (-0.0%) OK
✅ bridge_wasm WASM 16.8 MB 🔒 4.6 MB gzip 4.6 MB -36.2 KB (-0.8%) OK

🔒 = the size this artifact is GATED on (ceiling + delta). Binaries gate on file size (installed binary); WASM gates on gzip (download size). The other size is shown for information only.


Generated by cargo size-gate · workflow run

@codeshaunted
codeshaunted added this pull request to the merge queue Jul 30, 2026
Merged via the queue into canary with commit 8f1fa6f Jul 30, 2026
81 of 82 checks passed
@codeshaunted
codeshaunted deleted the codex/baml-pack-audit branch July 30, 2026 19:15
@coderabbitai coderabbitai Bot mentioned this pull request Aug 16, 2026
9 of 10 tasks

This branch was previously deployed

2 inactive deployments
Preview – promptfiddle2 — ec4d7d9e Deployed Jul 30, 2026 by vercel[bot]
Preview – beps — ec4d7d9e Deployed Jul 30, 2026 by vercel[bot]
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.

[bug] baml pack --target *-unknown-linux-musl always fails: "Unsupported sh_offset value 0x238 for section '.hash'"

1 participant