gatewayd: serve_answers waits for every reply it reads

nobody_else_and_nothing_else_answers_it read five replies after
waiting only for the first, so it failed whenever the other four were
not posted yet. It failed once in a full `make gate` run, when many
test binaries ran at once. The helper now waits for as many posts as
the test reads.

The M4b plan's copy is left as it was handed over.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-24 14:56:58 -07:00
co-authored by Claude Opus 5.5
parent 5ffca7a577
commit d80b0b3d8a
+8 -5
View File
@@ -105,10 +105,13 @@ impl Stage {
.posted(&post(&id('c', n), user, DM, root, text, at), "D"); .posted(&post(&id('c', n), user, DM, root, text, at), "D");
} }
/// The text posted in the thread after the approval, within five seconds. /// The first `count` posts after the first `after`, waiting up to five seconds for all of them.
fn replies(&self, after: usize) -> Vec<String> { fn replies(&self, after: usize, count: usize) -> Vec<String> {
let posts = self.mm.wait_posts(after + 1, WAIT); let posts = self.mm.wait_posts(after + count, WAIT);
posts[after..].iter().map(|(_, _, t)| t.clone()).collect() posts[after..after + count]
.iter()
.map(|(_, _, t)| t.clone())
.collect()
} }
} }
@@ -193,7 +196,7 @@ fn nobody_else_and_nothing_else_answers_it() {
s.command(4, KYLE, &root, "!approve 7", 7); s.command(4, KYLE, &root, "!approve 7", 7);
s.command(5, KYLE, &root, "!approve 42 please", 8); s.command(5, KYLE, &root, "!approve 42 please", 8);
assert_eq!( assert_eq!(
s.replies(1)[..5], s.replies(1, 5),
[ [
NOT_APPROVER.to_string(), NOT_APPROVER.to_string(),
"approval 42 is answered in its own thread".to_string(), "approval 42 is answered in its own thread".to_string(),