Skip to content

Commit bb73e2f

Browse files
CI: hermetic spawns in vex-vendor/rollback suites (#823) (#1518)
* Start fix for #823 (slice 17) Assisted-by: Claude Code:claude-opus-5-5 * Spawn vex-vendor and rollback tests hermetically e2e_vex_vendor.rs and rollback/rollback_multicopy_blob_gate.rs started socket-patch with a bare Command::new and their own SOCKET_* sweep. Both sweeps had drifted from the shared builder: the vex-vendor one let an ambient SOCKET_NO_CONFIG=0 through, so a developer's real `socket login` could reach the child, and neither forced the passive update check off. Both now spawn through tests/common/hermetic.rs and leave the PENDING_RAW_SPAWNS list, so the spawn_env_hygiene ratchet keeps them hermetic. Test-only change. Refs #823 Assisted-by: Claude Code:claude-opus-5-5 * Use binary_command in vex-vendor suite Matches e2e_vex.rs, which this suite cites, so the twin suites spawn the CLI the same way. Refs #823 Assisted-by: Claude Code:claude-opus-5-5 --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent a5ddcf7 commit bb73e2f

3 files changed

Lines changed: 7 additions & 27 deletions

File tree

‎crates/socket-patch-cli/tests/e2e_vex_vendor.rs‎

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,11 @@ const UUID: &str = "9f6b2c4e-1d3a-4f6b-8c2d-7e5a9b1c3d5f";
4141

4242
#[path = "common/mod.rs"]
4343
mod common;
44-
use common::binary;
4544

46-
/// CLI invocation with the ambient `SOCKET_*` environment scrubbed (same
47-
/// rationale as `e2e_vex.rs`: explicit flags must be the sole source of
48-
/// truth).
45+
/// CLI invocation through the shared hermetic builder (same rationale as
46+
/// `e2e_vex.rs`: explicit flags must be the sole source of truth).
4947
fn cli() -> Command {
50-
let mut cmd = Command::new(binary());
51-
for (key, _) in std::env::vars() {
52-
if key.starts_with("SOCKET_") && key != "SOCKET_NO_CONFIG" {
53-
cmd.env_remove(key);
54-
}
55-
}
56-
cmd
48+
common::hermetic::binary_command()
5749
}
5850

5951
/// Write `manifest` to `<cwd>/.socket/manifest.json`.
@@ -2310,8 +2302,6 @@ fn vex_json(cwd: &Path, extra: &[&str]) -> (Option<i32>, Value) {
23102302
];
23112303
args.extend(extra.iter().map(|s| s.to_string()));
23122304
let out = cli()
2313-
.env("SOCKET_TELEMETRY_DISABLED", "1")
2314-
.env("SOCKET_NO_CONFIG", "1")
23152305
.env("SOCKET_NO_API_TOKEN", "1")
23162306
.args(&args)
23172307
.output()

‎crates/socket-patch-cli/tests/rollback/rollback_multicopy_blob_gate.rs‎

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use std::path::{Path, PathBuf};
2121
use std::process::Command;
2222
use std::sync::{Arc, Mutex};
2323

24-
use crate::common::{binary, git_sha256};
24+
use crate::common::{binary, git_sha256, hermetic_command};
2525

2626
/// Minimal HTTP stub playing the authenticated API: serves `blob` bytes at
2727
/// any path ending in `/patches/blob/<hash>`, 404 otherwise, and records
@@ -161,19 +161,11 @@ fn build_diverged_two_copy_tree(root: &Path) -> (PathBuf, PathBuf, String, Vec<u
161161
(index_a, index_b, before_hash, original, patched)
162162
}
163163

164-
/// A `rollback` command with the full `SOCKET_*` environment scrubbed and
165-
/// hermeticity vars pinned, so behavior is driven only by the flags under
166-
/// test (prefix scrub — an explicit list rots as flags are added).
164+
/// A `rollback` command through the shared hermetic builder, so behavior is
165+
/// driven only by the flags under test.
167166
fn rollback_cmd(cwd: &Path) -> Command {
168-
let mut cmd = Command::new(binary());
167+
let mut cmd = hermetic_command(&binary());
169168
cmd.arg("rollback").current_dir(cwd);
170-
for (key, _) in std::env::vars_os() {
171-
if key.to_string_lossy().starts_with("SOCKET_") {
172-
cmd.env_remove(&key);
173-
}
174-
}
175-
cmd.env("SOCKET_NO_CONFIG", "1");
176-
cmd.env("SOCKET_TELEMETRY_DISABLED", "1");
177169
cmd
178170
}
179171

‎crates/socket-patch-cli/tests/spawn_env_hygiene.rs‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ const PENDING_RAW_SPAWNS: &[&str] = &[
3333
"e2e_maven.rs",
3434
"e2e_redirect_cargo_shapes.rs",
3535
"e2e_vendored_production.rs",
36-
"e2e_vex_vendor.rs",
37-
"rollback/rollback_multicopy_blob_gate.rs",
3836
];
3937

4038
/// The environment `cmd`'s child would see: the parent environment with

0 commit comments

Comments
 (0)