fix(build): isolate voip example so the demo build drops cpal/alsa-sys - #922
Merged
Conversation
Cargo compiles every root dev-dependency when building any --example, so `cargo build --example demo` (the binary the Docker image ships) pulled cpal, and with it alsa-sys, which needs pkg-config plus ALSA dev libraries. Those are absent in the Alpine/musl builder, so production deploys started failing on alsa-sys right after the voip PR added cpal as a dev-dependency. Move examples/voip.rs into a standalone workspace member (examples/voip-cli) that owns cpal and ringbuf, and drop both from the root dev-dependencies. The demo build no longer touches the audio stack; run the voip example with `cargo run -p whatsapp-rust-voip-cli`. Also drop two genuinely unused dependencies surfaced by cargo shear: the `postcard` workspace dependency (referenced by no member) and `prost` in the e2e test crate (unused in its code).
📝 WalkthroughWalkthroughThe inline VoIP CLI Migration
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
📦 Binary size report
.text per crate
Top movers (cargo-bloat attribution)
Baseline: |
Contributor
jlucaso1
added a commit
to oxidezap/whatsapp-rust-docs
that referenced
this pull request
Jun 28, 2026
…split The VoIP example was moved from examples/voip.rs to its own workspace crate at examples/voip-cli/src/main.rs (whatsapp-rust PR #922). Update all references and add the new run command. References: oxidezap/whatsapp-rust#922
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.
Problem
Production deploys (Coolify, which builds
cargo build --example demofrom the Dockerfile) started failing right after the VoIP PR, with:Root cause
Cargo compiles every root
[dev-dependencies]when building any--example, even onesdemo.rsnever touches. The VoIP PR addedcpal(andringbuf) as a dev-dependency forexamples/voip.rsonly. Socargo build --example demodragged incpal->alsa-sys, which needspkg-configplus ALSA dev libraries, both absent in the Alpine/musl builder.cargo chef cookdid not catch it because it only cooks the library dependency graph, not the examples.Installing ALSA in the Dockerfile is not a real fix: the build is a static musl binary on
scratch, soalsa-syswould still emit-lasoundinto thedemolink (a binary that does not even use audio), breaking the static link or the runtime onscratch. The right move is fordemoto not touch VoIP at all.Fix
Move
examples/voip.rsinto its own workspace crate,examples/voip-cli/, which ownscpal/ringbuf, and drop both from the root dev-dependencies. It is a workspace member but not indefault-members, so a plaincargo buildskips it; run the example withcargo run -p whatsapp-rust-voip-cli.Result:
cargo tree -p whatsapp-rust -i alsa-sysfinds nothing anymore, and thedemobuild no longer compiles the audio stack.Dependency cleanup (cargo shear)
While here, two genuinely unused dependencies (confirmed manually) are removed:
postcardin[workspace.dependencies]: referenced by no member (likely a leftover from the refactor(sqlite-storage)!: replace bincode with prost for persisted blobs #911 bincode->prost refactor).prostintests/e2e: unused in the test code.The remaining
cargo shearreports were reviewed and are false positives or intentional, so they are left as-is:serdein waproto (derive injected bybuild.rs),getrandom(thewasm_jsbackend),dhat/libsqlite3-sys(feature enablers), and the bench-integration "misplaced" ones (pre-existing, out of scope).Local validation
cargo build --example democompiles without touchingcpal/alsa-sys.cargo build -p whatsapp-rust-voip-clicompiles.cargo build -p e2e-tests --testscompiles withoutprost.