test: the burst-close test accepts the upload command's own words when the close lands in that step
The close lands in whichever step the poster is in. Most steps are calls through the bridge, which are told "the owner closed the books". One step is the `wanderbooks upload` command, a process of its own that holds no lease and can't know who closed the books: with nothing running it says "Start Wanderbooks first: nothing has the books open" and does nothing (WB-app-5). The test asserted the bridge's words for every stop, so it failed whenever the close met that command (about half the iterations here, once on GitHub's slower machine). A stop by the command now has to carry the command's words or "the books were closed just now"; a stop by a bridge call still has to say the owner closed them; neither may say a call "may or may not" have been made; and the books still hold exactly the entries that were answered, none lost and none twice. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
c206652abe
commit
6255c99d87
1 file changed
+27
-4
@@ -382,7 +382,10 @@ impl Agent {
|
||||
.unwrap();
|
||||
let _ = std::fs::remove_file(&path);
|
||||
if !out.status.success() {
|
||||
return Err(String::from_utf8_lossy(&out.stderr).to_string());
|
||||
return Err(format!(
|
||||
"{UPLOAD_COMMAND}{}",
|
||||
String::from_utf8_lossy(&out.stderr)
|
||||
));
|
||||
}
|
||||
Ok(begun["upload_id"].as_str().unwrap().to_string())
|
||||
}
|
||||
@@ -464,6 +467,12 @@ fn chart(a: &mut Agent) {
|
||||
}
|
||||
}
|
||||
|
||||
/// What a stop is prefixed with when it is the `wanderbooks upload`
|
||||
/// command that met it (not `books.begin_upload`, a call through the
|
||||
/// bridge): a command of its own that holds no lease, so it can't know who
|
||||
/// closed the books.
|
||||
const UPLOAD_COMMAND: &str = "the upload command: ";
|
||||
|
||||
fn post_one(a: &mut Agent, n: u64) -> Result<u64, String> {
|
||||
let e = a.call(
|
||||
"books.draft_entry",
|
||||
@@ -905,9 +914,23 @@ fn closing_during_a_burst_of_posts_through_the_bridge_loses_nothing() {
|
||||
}
|
||||
let (mut posted, why) = poster.join().unwrap();
|
||||
assert!(!posted.is_empty(), "{how}: nothing posted");
|
||||
// Told the owner closed them: never "closing, not run", which the
|
||||
// bridge sends again, and never "may have run".
|
||||
assert!(why.contains("closed the books"), "{how}: stopped by {why}");
|
||||
// The step the close met decides the words. A call through the
|
||||
// bridge is told the owner closed them: never "closing, not run",
|
||||
// which the bridge sends again, and never "may have run". The
|
||||
// upload step is a command of its own (it holds no lease, so it
|
||||
// can't know who closed the books): with nothing running it says
|
||||
// so, or that the books closed under it, and did nothing. Which
|
||||
// step the close lands in is up to the timing, and either is a
|
||||
// clean stop: what the rest of the test proves is that nothing
|
||||
// posted is lost and nothing is posted twice.
|
||||
match why.strip_prefix(UPLOAD_COMMAND) {
|
||||
Some(words) => assert!(
|
||||
words.contains("Start Wanderbooks first: nothing has the books open")
|
||||
|| words.contains("the books were closed just now"),
|
||||
"{how}: the upload command stopped by {words}"
|
||||
),
|
||||
None => assert!(why.contains("closed the books"), "{how}: stopped by {why}"),
|
||||
}
|
||||
assert!(
|
||||
!why.contains("may or may not"),
|
||||
"{how}: a call was cut off: {why}"
|
||||
|
||||
Reference in new issue
Block a user