diff --git a/crates/spt-daemon/tests/inject_control_wedge.rs b/crates/spt-daemon/tests/inject_control_wedge.rs index db67147..4ee6185 100644 --- a/crates/spt-daemon/tests/inject_control_wedge.rs +++ b/crates/spt-daemon/tests/inject_control_wedge.rs @@ -1778,16 +1778,53 @@ fn g6_faulted_inflight_envelope_is_respooled_not_lost() { // writes it NON-deferred (idle-eligible), so it must surface via peek_non_deferred_at. let perch_path = spt_store::perch::resolve_perch_path(endpoint, spt_store::perch::ParentHint::Infer); + // G6 CHARACTERIZATION PROBE (todlando 2026-07-27, doyle-approved seed rig — NOT for + // commit). See the base-sha copy for the rationale: 10ms cadence, log every transition + // of the ALL-undelivered count beside the non-deferred view, keep observing past the + // gate deadline. Distinguishes "row written then removed by a competing consumer" from + // "row never written". let deadline = Instant::now() + Duration::from_secs(4); + let t0 = Instant::now(); let mut respooled = false; + let mut last_pending = usize::MAX; + eprintln!("G6_PROBE_PATH {}", perch_path.display()); while Instant::now() < deadline { - if let Ok(rows) = spt_store::spool::peek_non_deferred_at(&perch_path) { - if rows.iter().any(|(_, _, body)| body.contains(marker)) { - respooled = true; + let pending = spt_store::spool::pending_count_at(&perch_path).unwrap_or(usize::MAX); + let rows = spt_store::spool::peek_non_deferred_at(&perch_path).unwrap_or_default(); + let visible = rows.iter().any(|(_, _, body)| body.contains(marker)); + if pending != last_pending || visible { + eprintln!( + "G6_PROBE t={}ms pending_all={pending} non_deferred={} marker_visible={visible}", + t0.elapsed().as_millis(), + rows.len() + ); + last_pending = pending; + } + if visible { + respooled = true; + break; + } + thread::sleep(Duration::from_millis(10)); + } + if !respooled { + let late = Instant::now() + Duration::from_secs(6); + while Instant::now() < late { + let pending = spt_store::spool::pending_count_at(&perch_path).unwrap_or(usize::MAX); + let rows = spt_store::spool::peek_non_deferred_at(&perch_path).unwrap_or_default(); + let visible = rows.iter().any(|(_, _, body)| body.contains(marker)); + if pending != last_pending || visible { + eprintln!( + "G6_PROBE_LATE t={}ms pending_all={pending} non_deferred={} marker_visible={visible}", + t0.elapsed().as_millis(), + rows.len() + ); + last_pending = pending; + } + if visible { break; } + thread::sleep(Duration::from_millis(50)); } - thread::sleep(Duration::from_millis(100)); } if let Some(pid) = broker.session_pid(sid) {