crates/gunnar-front/tests/one_update_step.rs
//! **ONE update step** (T16 / P4-REST, A28 M11): Gunnar's front runs the shared
//! nordisk-pairing `frontside::update` step, as Holger's front does since P4a. Gunnar's own copy
//! of the decision, the fetch proof, the confirm wait, the busy mark and its 2026-10-25
//! re-admission moved there (the shared step's tests carry Gunnar's cases word for word,
//! `frontside::update::tests`, and the real door's `installer::tests::
//! the_shared_update_step_readmits_boxes_left_at_their_open_listener_together`).
fn update_rs() -> String {
std::fs::read_to_string(concat!(env!("CARGO_MANIFEST_DIR"), "/src/update.rs"))
.expect("src/update.rs")
}
/// ★ No copy of the shared step is left in Gunnar's front.
#[test]
fn gunnars_update_rs_carries_no_copy_of_the_shared_step() {
let u = update_rs();
for gone in [
"fn on_trial",
"fn decide",
"fn wait_confirmed",
"fn staged_of",
"fn step(",
"static BUSY",
"fn awaits_readmission",
"pub trait Hands",
"pub struct Take",
"pub struct LiveApp",
"fn take_of",
"fn reachable",
] {
assert!(
!u.contains(gone),
"update.rs still carries `{gone}`: it is nordisk-pairing::frontside::update's"
);
}
assert!(
u.contains("pub use nordisk_pairing::frontside::update::*;"),
"the step is the shared one"
);
assert!(
u.contains("pub use nordisk_pairing::frontside::busy::busy;"),
"the busy mark is the shared one"
);
}
/// ★ The recharge watcher reads the shared busy mark (the step marks it).
#[test]
fn the_recharge_watcher_reads_the_shared_busy_mark() {
let r =
std::fs::read_to_string(concat!(env!("CARGO_MANIFEST_DIR"), "/src/recharge.rs")).unwrap();
assert!(
r.contains("crate::update::busy(Some(role))"),
"the watcher leaves a box the update works on alone"
);
let guard = nordisk_pairing::frontside::busy::on("twin");
assert!(gunnar_front::update::busy(Some("twin")) && gunnar_front::update::busy(None));
drop(guard);
assert!(!gunnar_front::update::busy(Some("twin")));
}
/// ★ A re-admission says each line ONCE (gunnar.rs 2026-10-25, 1.9 M nested `readmit:` lines):
/// Gunnar's front re-admits through nordisk-pairing's sink, never a sink of its own.
#[test]
fn the_front_readmits_through_the_shared_sink_that_says_each_line_once() {
let r =
std::fs::read_to_string(concat!(env!("CARGO_MANIFEST_DIR"), "/src/recharge.rs")).unwrap();
assert!(
!r.contains("impl Sink for MemSink"),
"recharge.rs carries its own installer sink"
);
// A32-30: the kept bundle, its re-admission and their sink are one re-export.
assert!(
r.contains("pub use nordisk_pairing::kept::{") && r.contains(" MemSink,"),
"the sink is nordisk-pairing's"
);
}