From f5f644d5411857d248ce8adc5646ac6a213be7e8 Mon Sep 17 00:00:00 2001 From: jdalton Date: Sun, 2 Aug 2026 10:35:10 -0400 Subject: [PATCH] test(hosted): isolate package-manager caches in the production e2e suite MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit e2e_hosted_production.rs drives a real install for every ecosystem it covers — npm, pnpm, yarn, bun, go, pip, gem, bundler, composer, nuget — through one `tool()` helper. That helper pins a private cache per leg for the toolchains each leg names, but everything it does not name still resolves out of the caller's home directory. Corepack is the big one: the first `pnpm`/`yarn` invocation downloads a whole package manager into ~/.cache/node/corepack. `cache_env::isolate()` is the same one-liner the rest of the CLI integration suites use. It goes in before the per-leg `env` entries so those still win, which is what keeps the deliberately-cold reinstall legs cold. Split out of the sibling change that isolates the other suites, because this file's CI leg (`hosted-e2e`) is currently red for an unrelated server-side reason and should not hold that PR up. --- crates/socket-patch-cli/tests/e2e_hosted_production.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/crates/socket-patch-cli/tests/e2e_hosted_production.rs b/crates/socket-patch-cli/tests/e2e_hosted_production.rs index 47ce23c..1caeed9 100644 --- a/crates/socket-patch-cli/tests/e2e_hosted_production.rs +++ b/crates/socket-patch-cli/tests/e2e_hosted_production.rs @@ -82,6 +82,9 @@ use std::process::{Command, Output}; use socket_patch_cli::args::{GLOBAL_ARG_ENV_VARS, LOCAL_ARG_ENV_VARS}; +#[path = "common/cache_env.rs"] +mod cache_env; + // --------------------------------------------------------------------------- // Production endpoints + required-patch catalog // --------------------------------------------------------------------------- @@ -358,6 +361,10 @@ fn redirected_count(env: &serde_json::Value) -> u64 { fn tool(cwd: &Path, program: &str, args: &[&str], env: &[(&str, &str)]) -> Output { let mut cmd = Command::new(program); cmd.args(args).current_dir(cwd); + // Sandbox everything the per-leg `env` below does not name — corepack's + // downloaded package managers most of all — so a run leaves the caller's + // home alone. + cache_env::isolate(&mut cmd); // Keep every toolchain's cache inside the fixture so the reinstall leg // starts genuinely cold and cannot be satisfied from a warm host cache // holding the *pristine* artifact.