fix(scripts,#1257): cargo-test.sh wrapper for platform GPU features#1285
Merged
Conversation
…orm GPU features
Make the obvious developer command work on every platform without
requiring contributors to memorize the per-platform Cargo feature
incantation.
Before:
cd workers/continuum-core && cargo test tick_db_handle --lib
→ fails in vendored llama crate; "metal" or "cuda" feature required
After:
./scripts/cargo-test.sh tick_db_handle --lib (anywhere from src/)
npm run test:rust -- tick_db_handle --lib
→ auto-detects platform, appends --features metal,accelerate (Mac) /
--features cuda,load-dynamic-ort (Linux+Nvidia) / etc.
Implementation:
- `scripts/cargo-test.sh` sources the existing
`scripts/shared/cargo-features.sh` detector (single source of truth
for platform→features, also used by build-with-loud-failure.sh and
git-prepush.sh) and forwards arbitrary args to `cargo test`.
- `npm run test:rust` alias added next to `test:precommit` /
`test:prepush` for discoverability.
- `workers/continuum-core/TESTING.md` documents the friction, the
wrapper, the CARGO_TEST_NO_FEATURES escape hatch (for verifying the
loud-fail guard itself), and the relationship to the other test
entry points.
The wrapper does NOT weaken the no-CPU-fallback compile guard — it
just spares the dev from typing the platform-correct features every
time. The guard still fires in CARGO_TEST_NO_FEATURES=1 mode.
Verified:
- ./src/scripts/cargo-test.sh --test generated_barrel_sync → 8 passed,
0 failed (8.5s, used --features metal,accelerate on this Mac).
Closes #1257.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Make `cargo test` Just Work on every platform without forcing the dev to memorize the platform-correct Cargo feature incantation.
Before (the friction this card was filed for):
```bash
cd workers/continuum-core && cargo test tick_db_handle --lib
→ fails in vendored llama crate; "metal" or "cuda" feature required
```
After:
```bash
./scripts/cargo-test.sh tick_db_handle --lib # from src/
npm run test:rust -- tick_db_handle --lib
```
The wrapper sources the existing `scripts/shared/cargo-features.sh` detector — same single source of truth that `build-with-loud-failure.sh` and `git-prepush.sh` already use — and forwards arbitrary args to `cargo test` with platform-correct features appended.
Acceptance criteria check (from #1257)
Files
Test plan
🤖 Generated with Claude Code