Verify held whisper reconnect and persisted bookmark folder moves

This commit is contained in:
omar committed 2026-11-27 06:39:05 +03:00
1 parent 8a98e3dcc6
commit 20e6008fd4
4 files changed
+65 -6

No files matched your search

+30 -4
View File
@@ -661,8 +661,7 @@ fn set_whisper_receive(qa: &mut Duplex, mode: &str) -> Result<()> {
Ok(())
}
fn whisper_spurt(qa: &mut Duplex, target_id: u64, target_uid: &str, tone: usize) -> Result<Burst> {
let epoch = WHISPER_TAGS[tone].ok_or("whisper probe must carry an epoch")?;
fn start_whisper(qa: &mut Duplex, target_id: u64, target_uid: &str, epoch: u32) -> Result<()> {
let ack = qa.a.request(&qa.tones, "whisper_start", json!({
"epoch": epoch,
"target": {"kind": "ids", "clients": [{"id": target_id, "uid": target_uid}], "channel_ids": []}
@@ -672,6 +671,12 @@ fn whisper_spurt(qa: &mut Duplex, target_id: u64, target_uid: &str, tone: usize)
{
return Err("whisper_start did not acknowledge the exact direct route".into());
}
Ok(())
}
fn whisper_spurt(qa: &mut Duplex, target_id: u64, target_uid: &str, tone: usize) -> Result<Burst> {
let epoch = WHISPER_TAGS[tone].ok_or("whisper probe must carry an epoch")?;
start_whisper(qa, target_id, target_uid, epoch)?;
let burst = qa.burst(Some(tone), None, 42)?;
if !qa.a.transmitting || !qa.a.seen.iter().any(|&(at, seen)| at >= burst.first && seen == Seen::LocalStarted) {
return Err(format!("{} Hz whisper did not start transmitting; {}", HZ[tone], Duplex::evidence(&qa.a, burst.first)));
@@ -759,6 +764,27 @@ fn exercise_whisper(exe: &Path, root: &Path) -> Result<String> {
Duplex::check_gate(&qa.a, stale_phase, stale.first, true, ReceiveGate::Closed)?;
Duplex::check_gate(&qa.b, stale_phase, stale.first, true, ReceiveGate::Closed)?;
// Disconnect with a proven live route, without whisper_stop or audio_end.
let held_epoch = RESTORED_EPOCH + 1;
qa.tones[OLD_TONE] = Tone::new(HZ[OLD_TONE], Some(held_epoch));
start_whisper(&mut qa, b_id, &b_uid, held_epoch)?;
let held = qa.burst(Some(OLD_TONE), None, 42)?;
Duplex::receipt(&qa.b, "held whisper before disconnect", a_id, OLD_TONE, held.first)?;
check_whisper_event(&qa.b, "held whisper before disconnect", held.first, Some(a_id))?;
if !qa.a.transmitting { return Err("sender was not transmitting at disconnect".into()); }
let held_confirmed = Duplex::disconnect(&mut qa.a, &qa.tones)?;
qa.wait_until("held whisper sender leaving roster", CONTROL, |qa| {
qa.b.snapshot["clients"].as_array().is_some_and(|clients| clients.iter().all(|c| c["id"] != a_id))
})?;
let a_id = Duplex::connect(&mut qa.a, &qa.tones)?;
qa.party(a_id, b_id)?;
qa.observe_for(GATE_OBSERVATION)?;
let stale = qa.burst(Some(OLD_TONE), None, 24)?;
qa.observe_for(GATE_OBSERVATION)?;
for peer in [&qa.a, &qa.b] {
Duplex::check_gate(peer, "held epoch from previous connection", stale.first, true, ReceiveGate::Closed)?;
}
let ordinary = qa.burst(Some(NEW_TONE), None, 42)?;
qa.release(ordinary.last)?;
qa.observe_for(GATE_OBSERVATION)?;
@@ -769,8 +795,8 @@ fn exercise_whisper(exe: &Path, root: &Path) -> Result<String> {
let b_confirmed = Duplex::disconnect(&mut qa.b, &qa.tones)?;
qa.a.shutdown(&qa.tones)?;
qa.b.shutdown(&qa.tones)?;
let confirmed = [a_confirmed, b_confirmed].into_iter().filter(|confirmed| *confirmed).count();
Ok(format!("Whisper IPC passed: direct 650 Hz + whisper_received ({} frames); deny_all 900 Hz suppressed (no playback or whisper_received); restored allow_all 1150 Hz + whisper_received ({} frames); stale tag 1450 Hz dropped after stop (no ordinary voice); untagged 1750 Hz ordinary voice ({} frames, no whisper_received). Server confirmed {confirmed}/2 disconnects. No device audio.",
let confirmed = [held_confirmed, a_confirmed, b_confirmed].into_iter().filter(|confirmed| *confirmed).count();
Ok(format!("Whisper IPC passed: direct 650 Hz + whisper_received ({} frames); deny_all 900 Hz suppressed (no playback or whisper_received); restored allow_all 1150 Hz + whisper_received ({} frames); stale tag 1450 Hz dropped after stop and after reconnect during a live whisper; untagged 1750 Hz ordinary voice after reconnect ({} frames, no whisper_received). Server confirmed {confirmed}/3 disconnects. No device audio.",
first.frames, again.frames, voice.frames))
}