fly-session: clippy (box the bus request), race test starts from its torn state

The admission race test (TASK-01 R2-3) spawned its hammer before the first
iteration set the queue up; on a loaded build box the hammer could admit into
the empty initial queue, which is a legitimate admission, and fail the test.
This commit is contained in:
acamilo 2026-09-30 02:55:51 +00:00
parent 9a2d7c0286
commit 8618e38a5f
2 changed files with 10 additions and 2 deletions

View file

@ -6123,6 +6123,14 @@ mod admission_race_tests {
}; };
let stop = AtomicBool::new(false); let stop = AtomicBool::new(false);
let torn = AtomicBool::new(false); let torn = AtomicBool::new(false);
// The hammer must never find the queue's empty initial state (no pulse, nothing
// pending), which is a legitimate admission, not a torn commit: on a loaded box it
// can run before the first iteration below sets the state up (PERF-01 saw it once).
{
let mut state = queue.lock();
state.in_flight = vec![in_flight.clone()];
state.set_remaining(&agent, Some(0.0));
}
std::thread::scope(|scope| { std::thread::scope(|scope| {
scope.spawn(|| { scope.spawn(|| {
while !stop.load(Ordering::Relaxed) { while !stop.load(Ordering::Relaxed) {

View file

@ -165,7 +165,7 @@ pub struct HandlerCtx<'a> {
/// How a domain request reached the shell, and so where its attachments are. /// How a domain request reached the shell, and so where its attachments are.
pub enum Incoming { pub enum Incoming {
/// A bus request delivery: the attachments are the delivery's. /// A bus request delivery: the attachments are the delivery's.
Bus(flybus::Request), Bus(Box<flybus::Request>),
/// The in-process local lane ([`LocalLane`]): the caller's own handles, in memory or /// The in-process local lane ([`LocalLane`]): the caller's own handles, in memory or
/// sealed, handed over without a bus message. /// sealed, handed over without a bus message.
Local(Vec<(String, flybus::Artifact)>), Local(Vec<(String, flybus::Artifact)>),
@ -620,7 +620,7 @@ async fn run<E: WorkerEndpoint>(shell: Arc<Shell<E>>, mut service: flybus::Servi
_ => {} _ => {}
} }
shell shell
.admit(method, request, Incoming::Bus(incoming), Answer::Bus(responder)) .admit(method, request, Incoming::Bus(Box::new(incoming)), Answer::Bus(responder))
.await; .await;
} }
shell.drain().await; shell.drain().await;