Skip to content

build: retire ./_cargo trampolines; route Rust tooling through soldr (closes #76) - #78

Merged
zackees merged 2 commits into
mainfrom
retire-cargo-trampolines
May 13, 2026
Merged

zackees merged 2 commits into
mainfrom
retire-cargo-trampolines

Conversation

@zackees

@zackees zackees commented May 13, 2026

Copy link
Copy Markdown
Member

Summary

Closes #76. Companion to #75.

  • Delete the legacy ./_cargo, ./_rustc, ./_rustfmt trampolines and route every caller through soldr cargo / soldr rustfmt.
  • Add a PreToolUse Bash hook (ci/hooks/tool_guard.py wired via .claude/settings.json) that blocks bare cargo / rustc / rustfmt / clippy-driver and the retired ./_cargo invocations — with a clear message pointing at soldr. Pattern adapted from zackees/zccache's hook. uv run <rust-tool> is rejected too because it bypasses soldr's toolchain selection.
  • Update CLAUDE.md so coding agents (Claude + Codex via CODEX.md's pointer) see the new rule.

Why

The trampoline ended with exec cargo "$@" — it set PATH and CARGO_BUILD_TARGET but never routed through soldr. Local dev consequently bypassed the zccache compile cache that CI uses (via zackees/setup-soldr@v0). Cold builds of fastled-py took 8–10 minutes locally vs. seconds on warm cache. See #75 for the original root-cause investigation.

Files

  • Deleted: _cargo, _rustc, _rustfmt
  • New: ci/hooks/tool_guard.py, ci/hooks/README.md, .claude/settings.json
  • Updated: ./lint, ./test, ./install, ./build-wheel, .github/workflows/_build.yml, CLAUDE.md

Each updated caller checks command -v soldr and falls back to plain cargo with a "install soldr with: uv tool install soldr" hint so soldr-less environments still build (just slow).

Hook behavior

Command Decision
Bare cargo / rustc / rustfmt / clippy-driver DENY — points at soldr
soldr cargo … ALLOW
./_cargo … (retired) DENY — references #76
uv run <rust-tool> DENY — bypasses soldr toolchain selection
uv pip install … ALLOW
bash lint, ls -la, etc. ALLOW

A second commit (fix(hook): ignore cargo references inside heredocs and quoted strings) hardens the parser so PR-body heredocs and shell-quoted strings that happen to contain the literal text cargo build don't trigger false positives.

Test plan

  • bash lint — green via soldr cargo fmt + soldr cargo clippy (zccache log visible)
  • Hook unit-tested against multiple command shapes — correct deny/allow for each
  • CI must validate bash test end-to-end on Linux/Windows/macOS (soldr provisioned via zackees/setup-soldr@v0, already in workflow)
  • ./install on a clean checkout with soldr installed — should fetch a binstall fastled-cli or build via soldr cargo

Related

🤖 Generated with Claude Code

zackees and others added 2 commits May 13, 2026 15:26
Closes #76. Companion to #75.

Delete ./_cargo, ./_rustc, ./_rustfmt and route every caller through
soldr cargo / soldr rustfmt etc. so the zccache compile cache is hit
on every Rust build. The trampolines were useful before soldr existed;
now they're noise that bypasses the cache (8-10 min cold builds vs.
seconds on warm cache).

Add a PreToolUse Bash hook (ci/hooks/tool_guard.py wired via
.claude/settings.json) that blocks bare cargo / rustc / rustfmt /
clippy-driver and the legacy ./_cargo invocations, with a clear
message pointing at soldr. Pattern adapted from zackees/zccache.
uv run <rust-tool> is rejected too because it bypasses soldr's
toolchain selection.

Callers updated to use 'soldr cargo' with a plain-cargo fallback
(plus a "install soldr with: uv tool install soldr" hint):
  - ./lint     - cargo fmt --check + cargo clippy
  - ./test     - cargo test --workspace
  - ./install  - cargo build --bin fastled when binstall missed
  - ./build-wheel - cargo build --release --bin fastled
  - .github/workflows/_build.yml - same path in CI

CLAUDE.md updated to document the new rule and the hook.

Tested locally: bash lint passes (soldr cargo fmt + soldr cargo clippy
both hit the zccache).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The PreToolUse hook was rejecting gh pr create invocations whose
heredoc body documented the hook's deny semantics with literal
'cargo build' text. Strip heredocs, command substitutions, and
single/double-quoted strings before splitting the command into
pipeline segments.

Verified: 'cargo build' still denied; 'echo "cargo build"',
'cat <<EOF cargo build EOF', and 'soldr cargo build' all allowed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@zackees
zackees merged commit 3532a3b into main May 13, 2026
16 of 25 checks passed
@zackees
zackees deleted the retire-cargo-trampolines branch November 5, 2026 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Retire ./_cargo, ./_rustc, ./_rustfmt trampolines — replace with soldr

1 participant