CLI: build the embedded components from source in build.rs - #92
Merged
Conversation
The compose-runner/run defaults (runner-cli + provider) were committed size-optimized artifacts, refreshed by hand (`just embed-update`) and freshness-gated only through sample-suite-visible behavior — #88's gap. Now the CLI's build.rs builds them from their sources at compile time, so staleness is impossible by construction: verify-cli becomes a pure behavior gate, and the unreviewable binary blobs leave the repo. Mechanics (each documented in build.rs): nested cargo into a target dir under OUT_DIR (sharing the outer target dir would deadlock on cargo's build-dir lock; cargo's own fingerprinting caches the inner graph there), broad rerun-if-changed over components//crates//wit/ (over-firing costs a ~0.1s inner no-op, while a curated file list would silently go stale when the dependency closure grows — the failure mode this exists to delete), a curated environment (the outer build's host-targeted RUSTFLAGS/RUSTC and cargo bookkeeping must not leak into the wasm build; CARGO_HOME and network/registry knobs survive for offline and vendored setups; RUSTC_WRAPPER survives for sccache), and --locked --profile embed (workspace lockfile governs the inner graph; components ship size-optimized regardless of the outer profile). New default feature `embedded-components`: --no-default-features yields a host-only CLI needing no wasm target — compose-runner/run then require explicit --runner/--provider with an error naming the cause. The aggregate action's fallback install uses it (aggregation never composes), so reporting-only consumers keep working on runners without wasm32-wasip2. Everything else installing the CLI (setup action, _ct-tools) runs in repos that build suites, where the target is already present. Measured (17-core linux): cold CLI build 15.8s; no-op rebuild 0.08s; CLI-edit rebuild 5.0s; runner-cli-edit rebuild 9.3s (inner wasm rebuild + relink). cargo install --locked --git: 47.6s vs 47.7s at the committed-blob baseline — zero delta, the inner wasm graph builds entirely in the shadow of the wasmtime compile. Installed binaries reproduce expected/verify-compose-sample.jsonl byte-for-byte and wizen works; slim install 45.9s with the documented error UX. When cargo's artifact-dependencies (bindeps) stabilize, build.rs becomes two [build-dependencies] entries; this is the stable-Rust approximation. Publishing to crates.io would need vendoring or fetching prebuilt artifacts at package time — consumption is git-pinned-only today (#54), unchanged. Verified: just check, just all, just test-wasm; clippy under both feature sets; the three install shapes above from a file:// clone.
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.
Closes #88 — by construction rather than by gating: the compose-runner/run defaults (runner-cli + provider) are now built from their sources by the CLI's build.rs at compile time. Staleness is impossible,
verify-clibecomes a pure behavior gate, and the unreviewable binary blobs (plusembed-updateand the.gitignorenegation) leave the repo.Mechanics
OUT_DIR(sharing the outer target dir deadlocks on cargo's build-dir lock); the inner graph is small and cargo's own fingerprinting caches it.rerun-if-changed(components/,crates/,wit/, root manifests): over-firing costs a ~0.1s inner no-op; a curated file list would silently go stale as the dependency closure grows — the exact failure mode this PR deletes.RUSTFLAGS/RUSTCand cargo bookkeeping scrubbed;CARGO_HOME+ network/registry knobs kept (offline/vendored setups);RUSTC_WRAPPERkept (sccache).--locked --profile embed: workspace lockfile governs the inner graph; components ship size-optimized regardless of outer profile.embedded-components;--no-default-features= host-only CLI (no wasm target needed),compose-runner/runerror naming the missing flag. actions/aggregate's fallback install uses it — reporting-only consumers keep working on runners withoutwasm32-wasip2.Measured
cargo install --locked --git(default features)--no-default-features)The inner wasm graph builds entirely in the shadow of the wasmtime compile. Installed binaries reproduce
expected/verify-compose-sample.jsonlbyte-for-byte; wizen works from the installed bin; the slim build's error UX verified.Notes
bindeps(cargo artifact-dependencies) is the principled replacement once stable; build.rs is the stable-Rust approximation and says so.pins— one-rev-everywhere gate for downstream pin trios #54), unchanged.Verified:
just check,just all,just test-wasm, clippy under both feature sets, three realcargo installshapes from afile://clone. The actions-setup-smoke job on this PR exercises the--pathinstall route with build.rs live.