From 723e74d5d1fc207ce66d0e42789fa4e13c9733f7 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 30 Sep 2026 16:58:28 +0200 Subject: [PATCH] Odin test: the unreadable-projection case is a projection that does not decode The second fault in the test (removing the projection's lock file) did not make the read fail, so it asserted a fallback that never ran. The test keeps the fault that does: a projection file that does not decode. Co-Authored-By: Claude Opus 5.5 --- crates/odin-daemon/src/main.rs | 36 ++++++++++++++-------------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/crates/odin-daemon/src/main.rs b/crates/odin-daemon/src/main.rs index f43b463..b16a736 100644 --- a/crates/odin-daemon/src/main.rs +++ b/crates/odin-daemon/src/main.rs @@ -2615,29 +2615,23 @@ mod tests { Ok(()) } - /// A projection file that cannot be read at all, because it does not - /// decode or cannot be opened, skips every presence and nothing else: the - /// catalog still serves the peer documents. + /// A projection file that cannot be read at all skips every presence and + /// nothing else: the catalog still serves the peer documents. #[test] fn a_projection_file_that_cannot_be_read_skips_presences_not_the_catalog() -> Result<()> { - let faults: [fn(&Path) -> Result<()>; 2] = [ - |projection| Ok(std::fs::write(projection, b"not a cultcache store")?), - |projection| Ok(std::fs::remove_file(sibling_lock_path(projection)?)?), - ]; - for fault in faults { - let mut odin = activated_odin()?; - odin.pass()?; - provider_put(&odin, "ghostlight.doc.v1", "doc-1", vec![1])?; - assert_eq!( - documents_of(&odin.catalog()?, GAMECULT_RUNTIME_PRESENCE_HEALTH_SCHEMA), - 1, - "Odin's own presence is served while the projection reads" - ); - fault(&odin.state.borrow().options.idunn_projection)?; - let catalog = odin.catalog()?; - assert_eq!(documents_of(&catalog, "ghostlight.doc.v1"), 1); - assert_eq!(documents_of(&catalog, GAMECULT_RUNTIME_PRESENCE_HEALTH_SCHEMA), 0); - } + let mut odin = activated_odin()?; + odin.pass()?; + provider_put(&odin, "ghostlight.doc.v1", "doc-1", vec![1])?; + assert_eq!( + documents_of(&odin.catalog()?, GAMECULT_RUNTIME_PRESENCE_HEALTH_SCHEMA), + 1, + "Odin's own presence is served while the projection reads" + ); + let projection = odin.state.borrow().options.idunn_projection.clone(); + std::fs::write(projection, b"not a cultcache store")?; + let catalog = odin.catalog()?; + assert_eq!(documents_of(&catalog, "ghostlight.doc.v1"), 1); + assert_eq!(documents_of(&catalog, GAMECULT_RUNTIME_PRESENCE_HEALTH_SCHEMA), 0); Ok(()) }