test(ops): prove cargo.sh keeps a host rustup shim working
Follow-up to #601, which merged without a regression test.
ops/cargo.sh used to export the private RUSTUP_HOME before asking the cargo on PATH whether it could run. On a rustup shim that fails with "no default toolchain configured" even when the host toolchain is fine.
ops/cargo-host-shim.test.mjs puts that shim first on PATH, points RELAYFLOWS_TOOLCHAIN_HOME at an empty directory, and requires ops/cargo.sh --version to print the host shim's version. It also restores the trailing newline #601 dropped.
Local: node --test ops/cargo-host-shim.test.mjs passed.
[!NOTE]
Low Risk
Changes are limited to a new Node regression test, CI wiring, and a newline in ops/cargo.sh; no bootstrap logic changes in this diff.
Overview
Adds a regression test for the #601 fix: when a host cargo rustup shim is first on PATH and the private toolchain home is empty, ops/cargo.sh --version must still succeed and report the host shim’s version (not fail with “no default toolchain configured”).
ops/cargo-host-shim.test.mjs builds a fake shim that errors if RUSTUP_HOME points at an empty private rustup home, then runs ops/cargo.sh with RELAYFLOWS_NO_TOOLCHAIN_INSTALL=1.
.github/workflows/ops-cargo-shim.yml runs that test on Node 22 for PRs/pushes touching ops/cargo.sh, the test file, or the workflow (checkout uses the PR head SHA).
ops/cargo.sh only restores a trailing newline after the final exec line.
Reviewed by Cursor Bugbot for commit e89e6733bf6577ed73a8a61ac11a4b0f0f0edf74. Bugbot is set up for automated code reviews on this repo. Configure here.
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.
Summary by cubic
Adds a regression test for the #601 fix, proving ops/cargo.sh still works with a host rustup shim even when the private toolchain's RUSTUP_HOME is empty, and restores the trailing newline dropped in #601.
- CI Adds a workflow that runs the test on changes to
ops/cargo.sh, the test, and the workflow itself, since an ops-only change would otherwise skip the existing workflows.