From ab2bad13731c05edaa413c51fe7c305a0cddd6e7 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Fri, 20 Nov 2026 21:34:03 -0800 Subject: [PATCH 1/3] fix(driver): turn mbx's target seeding off, and show why cargo clean fails mbx's target seeding creates the drivers' own target directories, such as target/rust2-ffi, without the CACHEDIR.TAG cargo writes, and `cargo clean --target-dir` refuses them; under `--quiet` cargo printed nothing, so the failure was silent. Co-Authored-By: Claude Opus 5.5 --- driver/src/cargo.rs | 22 +++++++++++++--------- flake.nix | 5 +++++ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/driver/src/cargo.rs b/driver/src/cargo.rs index e9a1d84d1..5792a0ad1 100644 --- a/driver/src/cargo.rs +++ b/driver/src/cargo.rs @@ -178,7 +178,19 @@ impl Check<'_> { } cmd }; - run_cargo(cargo("clean").arg("--quiet").args(resolution(self.args)))?; + // Show what it says only when it fails: `--quiet` would hide even its error. + let clean = cargo("clean") + .args(resolution(self.args)) + .output() + .map_err(|err| format!("running cargo clean: {err}"))?; + if !clean.status.success() { + return Err(format!( + "cargo clean of {} failed ({}): {}", + target_dir.display(), + clean.status, + String::from_utf8_lossy(&clean.stderr).trim() + )); + } // Its own, since runs may share a target directory. let ran = target_dir.join(format!("{}-{}.ran", self.tool, std::process::id())); match std::fs::remove_file(&ran) { @@ -226,14 +238,6 @@ fn cargo() -> Command { Command::new(std::env::var_os("CARGO").unwrap_or_else(|| "cargo".into())) } -fn run_cargo(cmd: &mut Command) -> Result<(), String> { - let status = cmd.status().map_err(|err| format!("running cargo: {err}"))?; - match status.success() { - true => Ok(()), - false => Err(format!("{cmd:?} failed")), - } -} - /// The cargo args that pick how the workspace resolves, which `cargo clean` resolves it /// by too: `--config`, and the lockfile and network flags. fn resolution(args: &[String]) -> Vec<&str> { diff --git a/flake.nix b/flake.nix index 417d2b8ac..05121061b 100644 --- a/flake.nix +++ b/flake.nix @@ -300,6 +300,11 @@ # The free-threaded CPython the generated Python must refuse. By path, since its # python3 would shadow the GIL build's on PATH. PYTHON_FREE_THREADED = "${pkgs.python314FreeThreading}/bin/python3.14t"; + # mbx's target seeding creates the drivers' own target directories, such as + # target/rust2-ffi, without the CACHEDIR.TAG cargo writes into each it creates, and + # `cargo clean --target-dir` refuses a directory without one. It saves about 4% of a + # fresh checkout's first build, which mbx's cache already serves. + MBX_TARGET_SEED = "false"; # The pinned toolchain goes on PATH ahead of everything the host had, which # shadows the Cargo shim `mbx setup` installs. Put it back in front, as moq's dev # shell does, so cargo builds through mbx's cache wherever the host set one up, From e00ac7f98d5571b650b7e3b3574b297bf85110a4 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Fri, 20 Nov 2026 21:45:51 -0800 Subject: [PATCH 2/3] chore(quest): turn mbx's target seeding back on once mbx fixes it Co-Authored-By: Claude Opus 5.5 --- flake.nix | 3 ++- quest/m0/mbx-seed.md | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 quest/m0/mbx-seed.md diff --git a/flake.nix b/flake.nix index 05121061b..10f622b36 100644 --- a/flake.nix +++ b/flake.nix @@ -303,7 +303,8 @@ # mbx's target seeding creates the drivers' own target directories, such as # target/rust2-ffi, without the CACHEDIR.TAG cargo writes into each it creates, and # `cargo clean --target-dir` refuses a directory without one. It saves about 4% of a - # fresh checkout's first build, which mbx's cache already serves. + # fresh checkout's first build, which mbx's cache already serves. Off until mbx + # fixes it: quest/m0/mbx-seed.md. MBX_TARGET_SEED = "false"; # The pinned toolchain goes on PATH ahead of everything the host had, which # shadows the Cargo shim `mbx setup` installs. Put it back in front, as moq's dev diff --git a/quest/m0/mbx-seed.md b/quest/m0/mbx-seed.md new file mode 100644 index 000000000..5db7d7404 --- /dev/null +++ b/quest/m0/mbx-seed.md @@ -0,0 +1,21 @@ +# [XS] Turn mbx's target seeding back on + +## Goal + +`flake.nix` no longer sets `MBX_TARGET_SEED`, and a fresh checkout's `just ffi surface` +passes with seeding on, locally and in the merge queue. + +## Plan + +mbx's seeding copies registry build units into every target directory it learned from +another checkout, nested ones such as `target/rust2-ffi` included, and creates them +without cargo's `CACHEDIR.TAG`; `cargo clean --target-dir` then refuses them. Once mbx +tags what it creates, or stops seeding a directory the checkout never built in, delete the +setting, bump the queue's mbx pin in `.github/workflows/queue-build.yml` to that release, +and check a fresh worktree whose first build seeds `target/rust2-ffi` from another. + +## Waiting + +- Maintainer: file the mbx issue drafted for this, and link it here +- jdx/mr-boxington: a release whose seeding writes `CACHEDIR.TAG` or skips nested target + directories From eb4cbc7b0914d3afbce21148161c2699d102508f Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sat, 21 Nov 2026 01:48:57 -0800 Subject: [PATCH 3/3] quest(mbx-seed): check either mbx fix, tagging or skipping Co-Authored-By: Claude Opus 5.5 --- quest/m0/mbx-seed.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/quest/m0/mbx-seed.md b/quest/m0/mbx-seed.md index 5db7d7404..a134fd743 100644 --- a/quest/m0/mbx-seed.md +++ b/quest/m0/mbx-seed.md @@ -12,7 +12,10 @@ another checkout, nested ones such as `target/rust2-ffi` included, and creates t without cargo's `CACHEDIR.TAG`; `cargo clean --target-dir` then refuses them. Once mbx tags what it creates, or stops seeding a directory the checkout never built in, delete the setting, bump the queue's mbx pin in `.github/workflows/queue-build.yml` to that release, -and check a fresh worktree whose first build seeds `target/rust2-ffi` from another. +and check a fresh worktree whose first build seeds from another, with a donor that has a +`target/rust2-ffi`. If mbx tags what it creates, check that the seeded `target/rust2-ffi` +holds a `CACHEDIR.TAG`; if it skips the directory, check that it creates no +`target/rust2-ffi`. Either way, `just ffi surface` passes. ## Waiting