warning: in the working copy of 'crates/spt/tests/attach_wedge_e2e.rs', LF will be replaced by CRLF the next time Git touches it warning: in the working copy of 'crates/spt/tests/common/reap.rs', LF will be replaced by CRLF the next time Git touches it diff --git a/crates/spt/tests/attach_wedge_e2e.rs b/crates/spt/tests/attach_wedge_e2e.rs index 90e418f0..907e0806 100644 --- a/crates/spt/tests/attach_wedge_e2e.rs +++ b/crates/spt/tests/attach_wedge_e2e.rs @@ -45,8 +45,6 @@ fn kill_pid(pid: u32) { let _ = Command::new("kill").args(["-9", &pid.to_string()]).output(); } - - fn ready_pid(path: &Path) -> Option { let s = std::fs::read_to_string(path).ok()?; serde_json::from_str::(&s) @@ -67,8 +65,6 @@ fn wait_for_ready_pid(path: &Path, budget: Duration) -> Option { None } - - /// Mint the endpoint, then start its first session (the U3 two-verb bringup) /// against the registered dummyharness adapter; returns the START's captured /// output and the broker-spawned harness pid (parsed from the terse @@ -204,18 +200,18 @@ fn attach_wedge_dead_child_plus_dropped_pump_does_not_wedge_the_broker() { .stderr(Stdio::from(brain_log_file)) .spawn() .expect("spawn spt daemon run (broker process)"); - let brain_pid = match wait_for_ready_pid(&home.path().join("brain.ready"), Duration::from_secs(30)) - { - Some(p) => p, - None => { - let _ = broker.kill(); - let _ = broker.wait(); - panic!( - "PRECONDITION: brain never came up.\n{}", - common::daemon_stderr_panel(&brain_log) - ); - } - }; + let brain_pid = + match wait_for_ready_pid(&home.path().join("brain.ready"), Duration::from_secs(30)) { + Some(p) => p, + None => { + let _ = broker.kill(); + let _ = broker.wait(); + panic!( + "PRECONDITION: brain never came up.\n{}", + common::daemon_stderr_panel(&brain_log) + ); + } + }; // ── (4) Bring up the VICTIM endpoint and prove it is SERVED (rc sees the tick). ── let victim = "wedge1"; @@ -252,7 +248,12 @@ fn attach_wedge_dead_child_plus_dropped_pump_does_not_wedge_the_broker() { // `--force`: `wedge2` is a live hosted session by design, so the W3 // STOP-LIVE-SESSION-WARN contract refuses a plain stop — this teardown // intends to kill it. [int->REQ-DAEMON-STOP-LIVE-SESSION-WARN] - cmd.no_window().args(["daemon", "stop", "--force"]).env("SPT_HOME", home.path()); + cmd.no_window() + .env_remove("OWL_SESSION_ID") + .env_remove("SPT_AGENT_ID") + .env_remove("SPT_ENDPOINT_ID") + .args(["daemon", "stop", "--force"]) + .env("SPT_HOME", home.path()); common::output_bounded(cmd, Duration::from_secs(20)) }; @@ -285,7 +286,10 @@ fn attach_wedge_dead_child_plus_dropped_pump_does_not_wedge_the_broker() { let _ = broker.wait(); // ── Assertions. ── - assert!(victim_online, "PRECONDITION: the victim endpoint must come ONLINE"); + assert!( + victim_online, + "PRECONDITION: the victim endpoint must come ONLINE" + ); assert!( victim_served, "PRECONDITION: the victim must be SERVED (rc saw its tick) before we wedge it" diff --git a/crates/spt/tests/common/reap.rs b/crates/spt/tests/common/reap.rs index 7e84d63e..bc9f9ad5 100644 --- a/crates/spt/tests/common/reap.rs +++ b/crates/spt/tests/common/reap.rs @@ -146,7 +146,10 @@ pub fn authenticated_kill( return refuse("gone", "the breadcrumb outlived its writer".to_string()) } ProcIdentity::Unproven => { - return refuse("unproven-identity", "no creation time to compare".to_string()) + return refuse( + "unproven-identity", + "no creation time to compare".to_string(), + ) } ProcIdentity::Present(started_at) => started_at, }; @@ -154,7 +157,10 @@ pub fn authenticated_kill( if obs.started_at != started_at { return refuse( "reused", - format!("observed_started_at={} current={started_at}", obs.started_at), + format!( + "observed_started_at={} current={started_at}", + obs.started_at + ), ); } } diff --git a/crates/spt/tests/daemon_stop_convoy_e2e.rs b/crates/spt/tests/daemon_stop_convoy_e2e.rs index 273cbefc..4cd8e8ba 100644 --- a/crates/spt/tests/daemon_stop_convoy_e2e.rs +++ b/crates/spt/tests/daemon_stop_convoy_e2e.rs @@ -50,6 +50,14 @@ fn spt_bin() -> PathBuf { PathBuf::from(env!("CARGO_BIN_EXE_spt")) } +/// Commands modeling a human terminal must not inherit the agent identity of +/// the runner that launched this test. +fn bare_human(cmd: &mut Command) -> &mut Command { + cmd.env_remove("OWL_SESSION_ID") + .env_remove("SPT_AGENT_ID") + .env_remove("SPT_ENDPOINT_ID") +} + /// Ask the way any user would: `spt daemon status` reports `daemon: running` /// (never a substring of the `daemon: not running` line, so this is unambiguous). fn daemon_running(home: &Path) -> bool { @@ -108,7 +116,8 @@ fn count_lines_containing(logs: &[String], needle: &str) -> usize { /// Best-effort teardown: never leave a daemon behind on the shared runner, on /// ANY exit path (including a failing assertion). fn teardown(home: &Path) { - let _ = Command::new(spt_bin()) + let mut cmd = Command::new(spt_bin()); + let _ = bare_human(&mut cmd) .no_window() .args(["daemon", "stop", "--force"]) .env("SPT_HOME", home) @@ -144,7 +153,8 @@ fn stop_under_an_api_storm_stays_down_then_start_brings_up_exactly_one() { // The storm is launched FIRST so its members are inside their own // ensure_daemon() while the teardown lands — the field race exactly. let kids: Vec<_> = (0..STORM).map(|_| storm_member(home)).collect(); - let stopped = Command::new(spt_bin()) + let mut stop_cmd = Command::new(spt_bin()); + let stopped = bare_human(&mut stop_cmd) .no_window() .args(["daemon", "stop", "--force"]) .env("SPT_HOME", home) @@ -215,7 +225,8 @@ fn stop_under_an_api_storm_stays_down_then_start_brings_up_exactly_one() { // (a crash, a box that never had one). `daemon run`'s own process is the // one to end, so stop it via the seed-control stop and then clear the // inhibit the operator-stop verb just wrote. - let _ = Command::new(spt_bin()) + let mut down_cmd = Command::new(spt_bin()); + let _ = bare_human(&mut down_cmd) .no_window() .args(["daemon", "stop", "--force"]) .env("SPT_HOME", home)