From 3db5cecf542e9dcb4b283f2c389b7ce4d416f780 Mon Sep 17 00:00:00 2001 From: ScriptedAlchemy Date: Mon, 5 Oct 2026 02:43:27 +0000 Subject: [PATCH] test(cli): bound the version probe by the wedge, not a clock `a_descendant_holding_stdout_cannot_hold_the_probe_past_its_deadline` asserted `elapsed() < 5s` while its descendant held the inherited pipe for 20 s. The 5 s stood in for "the probe did not wait for the pipe" without saying so. The hold is now a named constant, and the bound is that hold: a probe returning at or after it waited for the descendant. The overfill test's bare 2 s becomes `VERSION_PROBE_DEADLINE`, the deadline a wait-before-read probe would run into. Not reproduced on master: 30 runs of the version_probe module at 16 test threads pinned to cores 0-1 with 128 competing spinners passed. The same harness passes 30 of 30 with this change. --- crates/tracedecay-cli/src/upgrade.rs | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/crates/tracedecay-cli/src/upgrade.rs b/crates/tracedecay-cli/src/upgrade.rs index 0b2c8da952..b6dbcd179e 100644 --- a/crates/tracedecay-cli/src/upgrade.rs +++ b/crates/tracedecay-cli/src/upgrade.rs @@ -1318,8 +1318,8 @@ mod tests { use tracedecay_runtime_core::git::GitCommandError; use super::super::{ - UpgradeOutcome, VersionProbeError, finish_versioned_upgrade, installed_binary_version, - installed_binary_version_within, + UpgradeOutcome, VERSION_PROBE_DEADLINE, VersionProbeError, finish_versioned_upgrade, + installed_binary_version, installed_binary_version_within, }; use tracedecay_runtime_core::test_executable::write_executable_script; @@ -1395,7 +1395,11 @@ mod tests { ), "{error}" ); - assert!(started.elapsed() < Duration::from_secs(2)); + assert!( + started.elapsed() < VERSION_PROBE_DEADLINE, + "the byte bound must refuse the flood before the deadline a \ + blocked pipe would reach" + ); } #[test] @@ -1481,10 +1485,16 @@ mod tests { #[test] fn a_descendant_holding_stdout_cannot_hold_the_probe_past_its_deadline() { + // The descendant keeps the inherited pipe open this long, so a probe + // that returns at or after it waited for the pipe, not its deadline. + const DESCENDANT_PIPE_HOLD: Duration = Duration::from_secs(30); let dir = tempfile::tempdir().unwrap(); let leaky = script( dir.path(), - "printf 'tracedecay 1.2.3\\n'; sleep 20 & exit 0", + &format!( + "printf 'tracedecay 1.2.3\\n'; sleep {} & exit 0", + DESCENDANT_PIPE_HOLD.as_secs() + ), ); let started = Instant::now(); @@ -1499,7 +1509,7 @@ mod tests { "{error}" ); assert!( - started.elapsed() < Duration::from_secs(5), + started.elapsed() < DESCENDANT_PIPE_HOLD, "a successful parent exit does not close an inherited pipe; the deadline must" ); }