Skip to content

Route Rust toolchain trampolines through soldr#54

Merged
zackees merged 1 commit intomainfrom
feat/soldr-trampoline-migration
Apr 17, 2026
Merged

Route Rust toolchain trampolines through soldr#54
zackees merged 1 commit intomainfrom
feat/soldr-trampoline-migration

Conversation

@zackees
Copy link
Copy Markdown
Member

@zackees zackees commented Apr 16, 2026

Summary

Replaces fbuild's hand-rolled PATH-munging trampolines with calls to soldr v0.7.0. soldr resolves each toolchain binary via `rustup which`, so the rustup-managed toolchain is always used without any per-call environment shaping. Closes #53.

Behavior-preserving — all the same commands work the same way. The implementation is just thinner underneath.

Changes

  • `ci/trampoline.py`: `cargo` / `rustc` / `rustfmt` / `clippy_driver` now exec `soldr [--no-cache] ` instead of discovering `.cargo/bin` and prepending it to PATH. `cargo` passes `--no-cache` so soldr's own RUSTC_WRAPPER / managed-zccache path is not inserted — previous bare-cargo semantics are preserved. `_run_cargo_bin` (backing `run_fbuild` / `run_fbuild_daemon`) also routes through soldr.
  • `_cargo` / `_rustc` / `_rustfmt` shell shims: one-liners that `exec uv run soldr ...`. Same user-facing behavior as before.
  • `ci/dev-tools/pyproject.toml`: pulls `soldr>=0.7.0` as a Python dep so the `soldr` binary is available in the venv that the uv-run trampolines execute under.
  • `ci/hooks/tool_guard.py`: accepts `soldr ...` as a valid prefix alongside `uv run` and the `_cargo` trampolines. New test case covers `soldr cargo`, `soldr --no-cache cargo`, `soldr rustc`, `soldr rustfmt`.
  • Docs: `CLAUDE.md`, `CODEX.md`, `ci/dev-tools/README.md`, `ci/hooks/README.md` list `soldr ...` as an approved form.

Why soldr

soldr solves the exact problem this repo's trampolines were handling: finding the right rustup-managed toolchain binary on systems with polluted PATH (chocolatey cargo on Windows, stale system rust on Linux, etc.). Using soldr means:

  • `ci/trampoline.py` drops ~60 lines of `.cargo/bin` discovery logic.
  • Future fbuild contributors don't have to learn yet another trampoline system — soldr is a separate, documented tool.
  • Downstream users who pin `fbuild` get a deterministic toolchain resolution story out of the box.

Verification

  • `uv run cargo check --workspace --all-targets` — full workspace passes (46s, 11 crates)
  • `uv run cargo clippy -p fbuild-cli --all-targets` — passes
  • `uv run soldr --version` → `soldr 0.7.0`
  • `uv run rustc --version` → `rustc 1.94.1` (correct rustup toolchain)
  • `./_rustc --version` → `rustc 1.94.1` (shell trampoline)
  • `python -m unittest test_tool_guard` — 6 tests pass including new `test_allows_soldr_wrapped_cargo`

Risk / rollback

Minimal. soldr's rustup resolver mirrors what fbuild's trampolines already do. If CI flags anything, revert is a single-commit rollback.

Closes #53

Summary by CodeRabbit

  • Chores
    • Added soldr>=0.7.0 as a project dependency for improved Rust toolchain management.
    • Updated shell scripts and CI validation to route Rust tool invocations through soldr for consistent toolchain selection.
    • Updated documentation and test coverage to reflect new toolchain routing.

Replaces fbuild's hand-rolled PATH-munging trampolines with calls to
soldr, which resolves each tool via \`rustup which\` so the
rustup-managed toolchain is always used without per-call environment
shaping.

- \`ci/trampoline.py\`: cargo/rustc/rustfmt/clippy_driver functions now
  exec \`soldr [--no-cache] <subcommand>\` instead of discovering
  \`.cargo/bin\` and prepending it to PATH. \`cargo\` passes
  \`--no-cache\` so the previous bare-cargo semantics are preserved —
  soldr's own RUSTC_WRAPPER/zccache path is not inserted.
  \`_run_cargo_bin\` (backing \`run_fbuild\` / \`run_fbuild_daemon\`)
  also routes through soldr.
- \`_cargo\` / \`_rustc\` / \`_rustfmt\` bash shims: one-liners that
  \`exec uv run soldr ...\`. Same user-facing behavior as before.
- \`ci/dev-tools/pyproject.toml\`: pulls \`soldr>=0.7.0\` as a Python
  dep so the \`soldr\` binary is available in the venv that the uv-run
  trampolines execute under.
- \`ci/hooks/tool_guard.py\`: accepts \`soldr ...\` as a valid prefix
  alongside \`uv run\` and the \`_cargo\` trampolines. New test case
  covers \`soldr cargo\`, \`soldr --no-cache cargo\`, \`soldr rustc\`,
  \`soldr rustfmt\`.
- Docs: \`CLAUDE.md\`, \`CODEX.md\`, \`ci/dev-tools/README.md\`,
  \`ci/hooks/README.md\` list \`soldr ...\` as an approved form and
  explain that the cargo trampoline uses \`--no-cache\` to preserve
  prior semantics.

Cargo.lock picks up the existing 2.1.14 → 2.1.15 version alignment
(\`cargo check\` regenerated it during local verification).
uv.lock updates with the new soldr dep.

Closes #53

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 16, 2026

📝 Walkthrough

Walkthrough

This PR replaces fbuild's hand-rolled Rust toolchain trampolines (_cargo, _rustc, _rustfmt, and ci/trampoline.py functions) with calls to the soldr tool (v0.7.0+), which resolves toolchain binaries via rustup which without PATH-munging. Dependencies, tool guards, and documentation are updated accordingly.

Changes

Cohort / File(s) Summary
Shell Trampolines
_cargo, _rustc, _rustfmt
Replaced PATH-prepending logic with direct soldr invocation via uv run. _cargo adds --no-cache flag to preserve prior bare-cargo semantics; _rustc and _rustfmt invoke soldr directly without the flag.
Documentation Updates
CLAUDE.md, CODEX.md, ci/dev-tools/README.md, ci/hooks/README.md
Revised "Essential Rules" and command guidance to document soldr as approved method alongside uv run and repo trampolines. Clarified that toolchain selection uses rustup which and cargo passes --no-cache to preserve prior behavior.
Tool Guard Validation
ci/hooks/tool_guard.py, ci/hooks/test_tool_guard.py
Extended ALLOWED_PREFIXES to accept soldr commands. Updated denial messages to include soldr {tool} as allowed alternative. Added test test_allows_soldr_wrapped_cargo validating soldr-wrapped invocations.
Dependency & Trampoline Logic
ci/dev-tools/pyproject.toml, ci/trampoline.py
Added soldr>=0.7.0 dependency. Replaced cargo(), rustc(), rustfmt(), clippy_driver(), and _run_cargo_bin() implementations with soldr-based routing; removed PATH-mutation and rustup discovery logic (~24 net lines removed).

Sequence Diagram(s)

sequenceDiagram
    participant User as Build Command
    participant UV as uv run
    participant Soldr as soldr
    participant Rustup as rustup which
    participant Tool as Rust Tool<br/>(cargo/rustc)
    
    User->>UV: uv run cargo check
    UV->>Soldr: soldr --no-cache cargo check
    Soldr->>Rustup: rustup which cargo
    Rustup-->>Soldr: path to toolchain cargo
    Soldr->>Tool: Execute cargo check
    Tool-->>User: Build result
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 Hopping past the PATH, a soldr now leads,
No more cargo-bin munging for the deeds,
Rustup whispers which binary to run,
Trampolines rest—soldr gets the job done! 🎯

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 36.36% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Route Rust toolchain trampolines through soldr' clearly and specifically summarizes the main change: migrating from PATH-based trampolines to soldr-based routing for Rust tools.
Linked Issues check ✅ Passed The PR comprehensively addresses all in-scope requirements from issue #53: shell trampolines routed through soldr with --no-cache for cargo [_cargo, _rustc, _rustfmt], ci/trampoline.py functions updated, tool_guard.py accepts soldr prefix, soldr>=0.7.0 added to dependencies, and all documentation updated.
Out of Scope Changes check ✅ Passed All changes are directly aligned with the stated PR scope and linked issue #53 requirements. No extraneous modifications to zccache, legacy env helpers, or ecosystem tools were introduced.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/soldr-trampoline-migration

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
CLAUDE.md (1)

69-69: ⚠️ Potential issue | 🟡 Minor

Hook description is out of sync with the updated allow-list.

Line 7 (and ci/hooks/README.md, and the tool_guard.py denial message) now list soldr alongside uv run and the _cargo/_rustc/_rustfmt trampolines, but this line still mentions only uv run and the trampolines. Worth syncing to avoid confusing users who read the hooks section.

📝 Proposed doc fix
-- **PreToolUse**: `ci/hooks/tool_guard.py` blocks bare Rust commands (must use `uv run` or `_cargo`/`_rustc`/`_rustfmt` trampolines) and bare `python`/`pip` (must use `uv`) across supported shell tools, not just Bash
+- **PreToolUse**: `ci/hooks/tool_guard.py` blocks bare Rust commands (must use `uv run`, `soldr`, or `_cargo`/`_rustc`/`_rustfmt` trampolines) and bare `python`/`pip` (must use `uv`) across supported shell tools, not just Bash
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@CLAUDE.md` at line 69, Update the PreToolUse bullet so it matches the
allow-list by adding "soldr" alongside "uv run" and the
`_cargo`/`_rustc`/`_rustfmt` trampolines (i.e., change the text in the
PreToolUse line to list `soldr`, `uv run`, and the trampolines as allowed
patterns), and ensure the same wording is reflected in the tool_guard.py
messages and ci/hooks/README.md denial/help text to keep all descriptions
consistent (search for the PreToolUse string, the denial message in
tool_guard.py, and the corresponding README entry to update).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@CLAUDE.md`:
- Line 69: Update the PreToolUse bullet so it matches the allow-list by adding
"soldr" alongside "uv run" and the `_cargo`/`_rustc`/`_rustfmt` trampolines
(i.e., change the text in the PreToolUse line to list `soldr`, `uv run`, and the
trampolines as allowed patterns), and ensure the same wording is reflected in
the tool_guard.py messages and ci/hooks/README.md denial/help text to keep all
descriptions consistent (search for the PreToolUse string, the denial message in
tool_guard.py, and the corresponding README entry to update).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9a0a3386-c33b-4e77-bfa1-4a74948b732b

📥 Commits

Reviewing files that changed from the base of the PR and between 564a3e9 and dd0bbe2.

⛔ Files ignored due to path filters (2)
  • Cargo.lock is excluded by !**/*.lock
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (11)
  • CLAUDE.md
  • CODEX.md
  • _cargo
  • _rustc
  • _rustfmt
  • ci/dev-tools/README.md
  • ci/dev-tools/pyproject.toml
  • ci/hooks/README.md
  • ci/hooks/test_tool_guard.py
  • ci/hooks/tool_guard.py
  • ci/trampoline.py

@zackees zackees merged commit dd8f2d9 into main Apr 17, 2026
76 of 77 checks passed
@zackees zackees deleted the feat/soldr-trampoline-migration branch April 17, 2026 01:10
zackees added a commit to zackees/zccache that referenced this pull request Apr 17, 2026
Replaces zccache's hand-rolled PATH-munging trampolines with calls to
soldr, which resolves each tool via \`rustup which\` so the
rustup-managed toolchain is always used without per-call environment
shaping. Parallel to FastLED/fbuild#54.

Nice closing of the loop: soldr already fetches and invokes zccache as
its managed RUSTC_WRAPPER. Having zccache itself build through soldr
closes the circle.

- \`ci/trampoline.py\`: cargo/rustc/rustfmt/clippy_driver exec \`soldr
  [--no-cache] <subcommand>\` instead of discovering cargo_bin and
  calling \`ensure_windows_msvc\`. soldr already enforces MSVC on
  Windows. \`cargo\` passes \`--no-cache\` so soldr's own
  RUSTC_WRAPPER / managed-zccache path is not inserted — prior
  bare-cargo semantics preserved. \`_run_cargo_bin\` (run_zccache,
  run_zccache_daemon, run_zccache_fingerprint, check_on_stop) also
  routes through soldr. \`ci.env.activate()\` is still called first so
  repo-local \`.rustup\` / \`.cargo\` layouts still win — soldr's
  \`rustup which\` honors those env vars.
- \`_cargo\` / \`_rustc\` / \`_rustfmt\`: bash trampolines preserve the
  repo-local RUSTUP_HOME / CARGO_HOME detection (so vendored toolchain
  layouts still override the user-global location) and then
  \`exec uv run soldr [--no-cache] <subcommand>\`. The hand-rolled
  cargo_bin probe is removed.
- \`ci/hooks/tool_guard.py\`: accepts \`soldr ...\` as a valid
  top-level invocation alongside the \`./_cargo\` / \`./_rustc\` /
  \`./_rustfmt\` trampolines. \`uv run cargo\` remains blocked, but the
  message now points at either \`./_cargo\` or \`soldr cargo\`.
- \`pyproject.toml\`: pulls \`soldr>=0.7.0\` as a dev dependency and
  bumps \`requires-python\` from 3.9 to 3.10 (soldr wheels require
  3.10+).
- Docs: \`CLAUDE.md\` and \`CODEX.md\` list \`soldr <tool>\` as an
  approved form and explain the \`--no-cache\` preservation of
  previous semantics.

Closes #30

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
zackees added a commit to zackees/zccache that referenced this pull request Apr 17, 2026
Replaces zccache's hand-rolled PATH-munging trampolines with calls to
soldr, which resolves each tool via \`rustup which\` so the
rustup-managed toolchain is always used without per-call environment
shaping. Parallel to FastLED/fbuild#54.

Nice closing of the loop: soldr already fetches and invokes zccache as
its managed RUSTC_WRAPPER. Having zccache itself build through soldr
closes the circle.

- \`ci/trampoline.py\`: cargo/rustc/rustfmt/clippy_driver exec \`soldr
  [--no-cache] <subcommand>\` instead of discovering cargo_bin and
  calling \`ensure_windows_msvc\`. soldr already enforces MSVC on
  Windows. \`cargo\` passes \`--no-cache\` so soldr's own
  RUSTC_WRAPPER / managed-zccache path is not inserted — prior
  bare-cargo semantics preserved. \`_run_cargo_bin\` (run_zccache,
  run_zccache_daemon, run_zccache_fingerprint, check_on_stop) also
  routes through soldr. \`ci.env.activate()\` is still called first so
  repo-local \`.rustup\` / \`.cargo\` layouts still win — soldr's
  \`rustup which\` honors those env vars.
- \`_cargo\` / \`_rustc\` / \`_rustfmt\`: bash trampolines preserve the
  repo-local RUSTUP_HOME / CARGO_HOME detection (so vendored toolchain
  layouts still override the user-global location) and then
  \`exec uv run soldr [--no-cache] <subcommand>\`. The hand-rolled
  cargo_bin probe is removed.
- \`ci/hooks/tool_guard.py\`: accepts \`soldr ...\` as a valid
  top-level invocation alongside the \`./_cargo\` / \`./_rustc\` /
  \`./_rustfmt\` trampolines. \`uv run cargo\` remains blocked, but the
  message now points at either \`./_cargo\` or \`soldr cargo\`.
- \`pyproject.toml\`: pulls \`soldr>=0.7.0\` as a dev dependency and
  bumps \`requires-python\` from 3.9 to 3.10 (soldr wheels require
  3.10+).
- Docs: \`CLAUDE.md\` and \`CODEX.md\` list \`soldr <tool>\` as an
  approved form and explain the \`--no-cache\` preservation of
  previous semantics.

Closes #30

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

Replace Rust toolchain trampolines with soldr

1 participant