From 4cbd0928293ecdc7da480e2c2e6b5130b993fa7a Mon Sep 17 00:00:00 2001 From: zackees Date: Sat, 9 May 2026 18:41:07 -0700 Subject: [PATCH] chore(hooks): route lint/test/perf through soldr instead of `uv run cargo` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The PostToolUse lint hook (`ci/hooks/lint.py` -> `./lint`) and the Stop hook (`ci/hooks/check-on-stop.py` -> `ci/lint.py` + `ci/test.py`) shelled out to `uv run cargo`, which on Windows resolves to a different host triple than `soldr cargo` (`x86_64-pc-windows-gnu` vs `x86_64-pc-windows-msvc`). Same `target/debug/` cannot be shared between hosts, so every Stop fired a target-triple mismatch ("couldn't find crate ... with expected target triple x86_64-pc-windows-gnu") cascading across 30+ crates. `tool_guard.py` already blocks `uv run cargo` in shell tool calls but doesn't catch subprocess invocations from inside Python — these hooks slipped through. Patch every `cargo`/`rustfmt` call in the four scripts to use `uv run soldr cargo|rustfmt` so the rustup-managed msvc-host toolchain is the single source of truth for `target/debug/`: - `ci/lint.py` — clippy + fmt - `ci/test.py` — cargo test - `lint` (root) — clippy + fmt - `perf` (root) — cargo test Verified post-patch: `uv run --script ci/lint.py` finishes clean and `uv run --script ci/test.py -p fbuild-library-select` passes 16/16. Co-Authored-By: Claude Opus 4.7 (1M context) --- ci/lint.py | 12 ++++++------ ci/test.py | 2 +- lint | 14 +++++++------- perf | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/ci/lint.py b/ci/lint.py index dc40db75..d824760b 100644 --- a/ci/lint.py +++ b/ci/lint.py @@ -54,13 +54,13 @@ def lint_single_file(file_path): return 1 # Format single file - result = run_cmd(["uv", "run", "rustfmt", file_path]) + result = run_cmd(["uv", "run", "soldr", "rustfmt", file_path]) if result.returncode != 0: return result.returncode # Clippy on the affected crate (or workspace if unknown) crate = detect_crate(file_path) - cmd = ["uv", "run", "cargo", "clippy"] + cmd = ["uv", "run", "soldr", "cargo", "clippy"] if crate: cmd += ["-p", crate] else: @@ -74,14 +74,14 @@ def lint_single_file(file_path): def lint_workspace(): """Full workspace lint: fmt check + clippy.""" # Format check - result = run_cmd(["uv", "run", "cargo", "fmt", "--all", "--check"]) + result = run_cmd(["uv", "run", "soldr", "cargo", "fmt", "--all", "--check"]) if result.returncode != 0: print("Formatting issues found. Run './lint --fix' to auto-fix.", file=sys.stderr) return result.returncode # Clippy result = run_cmd([ - "uv", "run", "cargo", "clippy", "--workspace", "--all-targets", + "uv", "run", "soldr", "cargo", "clippy", "--workspace", "--all-targets", "--", "-D", "warnings", ]) return result.returncode @@ -93,13 +93,13 @@ def main(): # Handle --fix flag if "--fix" in args: args.remove("--fix") - result = run_cmd(["uv", "run", "cargo", "fmt", "--all"]) + result = run_cmd(["uv", "run", "soldr", "cargo", "fmt", "--all"]) if result.returncode != 0: return result.returncode if not args: # After fixing fmt, run clippy result = run_cmd([ - "uv", "run", "cargo", "clippy", "--workspace", "--all-targets", + "uv", "run", "soldr", "cargo", "clippy", "--workspace", "--all-targets", "--", "-D", "warnings", ]) return result.returncode diff --git a/ci/test.py b/ci/test.py index bb45c572..3ea5cab7 100644 --- a/ci/test.py +++ b/ci/test.py @@ -19,7 +19,7 @@ def main(): - cmd = ["uv", "run", "cargo", "test"] + cmd = ["uv", "run", "soldr", "cargo", "test"] args = sys.argv[1:] full = "--full" in args diff --git a/lint b/lint index 1a36de72..33b5b226 100755 --- a/lint +++ b/lint @@ -49,13 +49,13 @@ def main() -> int: # --fix mode if fix: - rc = run(["uv", "run", "cargo", "fmt", "--all"]) + rc = run(["uv", "run", "soldr", "cargo", "fmt", "--all"]) if rc != 0: return rc if not file_arg: return run( [ - "uv", "run", "cargo", "clippy", + "uv", "run", "soldr", "cargo", "clippy", "--workspace", "--all-targets", "--", "-D", "warnings", ] ) @@ -66,27 +66,27 @@ def main() -> int: if not os.path.isfile(file_path): print(f"File not found: {file_path}", file=sys.stderr) return 1 - rc = run(["uv", "run", "rustfmt", file_path]) + rc = run(["uv", "run", "soldr", "rustfmt", file_path]) if rc != 0: return rc crate = detect_crate(file_path) if crate: return run( [ - "uv", "run", "cargo", "clippy", + "uv", "run", "soldr", "cargo", "clippy", "-p", crate, "--all-targets", "--", "-D", "warnings", ] ) else: return run( [ - "uv", "run", "cargo", "clippy", + "uv", "run", "soldr", "cargo", "clippy", "--workspace", "--all-targets", "--", "-D", "warnings", ] ) # Full workspace mode - rc = run(["uv", "run", "cargo", "fmt", "--all", "--check"]) + rc = run(["uv", "run", "soldr", "cargo", "fmt", "--all", "--check"]) if rc != 0: print( "Formatting issues found. Run 'uv run --script lint --fix' to auto-fix.", @@ -95,7 +95,7 @@ def main() -> int: return 1 return run( [ - "uv", "run", "cargo", "clippy", + "uv", "run", "soldr", "cargo", "clippy", "--workspace", "--all-targets", "--", "-D", "warnings", ] ) diff --git a/perf b/perf index 7bbf9f9b..5643ece9 100644 --- a/perf +++ b/perf @@ -18,7 +18,7 @@ SCRIPT_DIR = Path(__file__).parent.resolve() def main(): cmd = [ - "uv", "run", "cargo", "test", + "uv", "run", "soldr", "cargo", "test", "-p", "fbuild-daemon", "--test", "perf_bench_test", "--",