From 67f9d510e433f326ef9e237f9b200709a76e81ce Mon Sep 17 00:00:00 2001 From: roboomp Date: Wed, 12 Aug 2026 15:21:56 +0000 Subject: [PATCH] test(natives): waited past background delay in leak check The leak regression waited only 100ms while the leaked job could not write its marker until a 1s sleep elapsed, so the pre-fix path passed vacuously. Wait past the delay; verified the test fails when the drop-time abort is neutralized. Fixes #8341 --- crates/pi-shell/src/shell.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/pi-shell/src/shell.rs b/crates/pi-shell/src/shell.rs index 90be597da..63631f9fe 100644 --- a/crates/pi-shell/src/shell.rs +++ b/crates/pi-shell/src/shell.rs @@ -4458,7 +4458,13 @@ replace = [{ pattern = "hello", replacement = "HI" }] ) .await .expect("one-shot shell execution"); - time::sleep(Duration::from_millis(100)).await; + // `execute_shell` returns after its short post-exit idle drain (~250ms), + // while the background job cannot write the marker until its 1s sleep + // elapses. Wait well past that delay so a job that outlived the dropped + // session has demonstrably had its chance to run — the pre-fix leak fires + // at ~1s and is caught here; the fixed path aborts the task on drop and the + // marker never appears. + time::sleep(Duration::from_millis(2000)).await; assert!( !marker.path().exists(),