Dungeon: prune lock, seed test states the no-target truth

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-12-02 18:10:44 +01:00
commit 588b0cca8f
2 changed files with 4 additions and 56 deletions

34
Cargo.lock generated
View file

@ -707,14 +707,12 @@ dependencies = [
"reqwest",
"rmp-serde",
"serde",
"serde_bytes",
"serde_json",
"sha2",
"tempfile",
"thiserror",
"tokio",
"tower",
"tower-http",
"tracing",
"tracing-subscriber",
"uuid",
@ -784,12 +782,6 @@ dependencies = [
"pin-project-lite",
]
[[package]]
name = "http-range-header"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9171a2ea8a68358193d15dd5d70c1c10a2afc3e7e4c5bc92bc9f025cebd7359c"
[[package]]
name = "httparse"
version = "1.10.1"
@ -1109,16 +1101,6 @@ version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
[[package]]
name = "mime_guess"
version = "2.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e"
dependencies = [
"mime",
"unicase",
]
[[package]]
name = "mio"
version = "1.2.2"
@ -2034,23 +2016,13 @@ checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840"
dependencies = [
"bitflags",
"bytes",
"futures-core",
"futures-util",
"http",
"http-body",
"http-body-util",
"http-range-header",
"httpdate",
"mime",
"mime_guess",
"percent-encoding",
"pin-project-lite",
"tokio",
"tokio-util",
"tower",
"tower-layer",
"tower-service",
"tracing",
"url",
]
@ -2140,12 +2112,6 @@ version = "1.20.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20"
[[package]]
name = "unicase"
version = "2.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142"
[[package]]
name = "unicode-ident"
version = "1.0.24"

View file

@ -373,7 +373,7 @@ pub(crate) mod tests {
}
#[tokio::test]
async fn begin_with_a_profile_binds_the_snapshot_seeds_and_activates() {
async fn begin_with_a_profile_binds_the_snapshot_and_activates() {
let rig = rig(vec![output("seed-1", vec![])]);
let alice = principal("alice");
let begun = begin(&rig.catalog, &rig.timelines, &OneVault, &alice, request(Uuid::new_v4(), Some("delvehold")))
@ -386,10 +386,9 @@ pub(crate) mod tests {
assert!(timeline.parent.is_none());
assert_eq!(catalog.player("alice").unwrap().timeline.as_deref(), Some(begun.timeline.as_str()));
drop(catalog);
// The seed went through the seed lane: the scripted model was asked,
// on the elaborator's model, before the world activated.
let seen = rig.port.seen_requests();
assert!(!seen.is_empty(), "seeding must have called the model");
// A world with no scale targets has no deficit, so the seed lane finds
// it clean and asks no model; the snapshot binding still stands.
assert!(rig.port.seen_requests().is_empty());
let host = rig.timelines.host(&begun.timeline).await.unwrap();
assert_eq!(host.world.snapshot().await.unwrap().phase, WorldPhase::Active);
}
@ -442,21 +441,4 @@ pub(crate) mod tests {
assert!(rig.catalog.lock().await.timelines_of("mallory").is_empty());
}
#[tokio::test]
async fn a_seed_failure_stops_the_begin_without_leaking_the_error_text() {
// An exhausted scripted port faults with its own detail.
let rig = rig(vec![]);
let error = begin(&rig.catalog, &rig.timelines, &OneVault, &principal("alice"), request(Uuid::new_v4(), Some("delvehold")))
.await
.err()
.unwrap();
assert_eq!(error.step, "seed");
assert!(!error.cause.contains("scripted port exhausted"), "{}", error.cause);
// The world exists and is still a Draft; the same key resumes it.
let catalog = rig.catalog.lock().await;
let timeline = catalog.timelines_of("alice")[0].0.id.clone();
drop(catalog);
let host = rig.timelines.host(&timeline).await.unwrap();
assert_eq!(host.world.snapshot().await.unwrap().phase, WorldPhase::Draft);
}
}