feat(rust-sdk): ergonomic cargo options, nextest, ci(), cargo-hack (Py+TS parity)#143
Merged
Conversation
Ports harmont-py/harmont/_cargo.py to TypeScript: CargoOpts interface, shQuote (shlex.quote-identical), and cargoFlags assembler with full validation (exclude/workspace pairing, allFeatures/features conflict, release/profile conflict). 18 tests, all passing, tsc clean.
…extest The example switched to rust.project().ci(), whose warmup runs 'cargo build --workspace --tests --locked' — which needs a committed Cargo.lock. Add the (dependency-free) lockfile. Drop nextest=True from the runnable example since the example-runner VM only rustup-installs stable (no cargo-nextest); nextest stays documented as an opt-in.
# Conflicts: # examples/rust/.hm/pipeline.py
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.
What
Overhauls the
hm.rustpipeline-authoring helper in both DSLs so a Rust CI pipeline is one call:Every action method now takes research-backed cargo options
packages=,exclude=,features=,all_features=,no_default_features=,target=,release=/profile=,locked=(defaults True for reproducible CI),workspace=, plus a genericflags=escape hatch. The surface is symmetric acrossbuild/test/clippy/fmt/docon bothRustToolchainandRustProject.New capabilities
test(nextest=True)→cargo nextest run; companiondoctest()step (nextest can't run doctests).RustProject.build()and.doc()(previously missing).RustProject.ci(nextest=, doc=)→ the zero-config DAG (test + clippy + fmt, +doctest under nextest).feature_powerset()→ cargo-hack--feature-powerset --depth 2 --no-dev-deps(the tokio/reqwest/tracing idiom), with a path-independent, forever-cached install step.Hardening
packages,exclude,features,target,profile, cargo-hackskip/include) is shell-quoted (shlex.quote/shQuote). Rawflags=stay verbatim (escape hatch). Regression tests added.all_features+features/no_default_features;release+profile;excludewithoutworkspace(cargo requires it);excludewith explicitpackages.Parity
Both DSLs route through a shared cargo-argument assembler (
_cargo.py/cargo.ts) andshQuotereplicates Python'sshlex.quotebyte-for-byte. Golden-string parity tests pin identical cargo commands across Python and TypeScript; the regeneratedrust-releasee2e fixtures are byte-identical across languages and pass the Rust IR-deserialization tests.Why
Flag choices are evidence-based: surveyed CI of ~30 top Rust repos (tokio, ripgrep, rust-analyzer, ruff, axum, reqwest, rustls, sqlx, wgpu, …).
--lockedis the community standard for reproducible CI; nextest is dominant in large workspaces and always splits doctests into a separate step;cargo clippy --all-targets -- -D warningsandcargo fmt --all --checkare the canonical lint/fmt invocations;cargo-hack --feature-powerset --depth 2is the standard combinatorial-feature sweep.Backwards compatibility
Additive except:
RustToolchain.build/testnow emit--lockedby default (passlocked=Falseto opt out);RustProject.clippyuses--all-targetsinstead of--tests;fmtdefaults to--all --check. Examples and e2e fixtures updated accordingly.Tests