From c43385962fca679b0443f960bdfebd3c575c045a Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 20 Nov 2026 00:34:03 +0100 Subject: [PATCH] Projector: a table without her row says so, whether or not its age is known Co-Authored-By: Claude Opus 5.5 --- crates/mind-body/src/projection.rs | 4 ++-- crates/mind-body/src/projection/tests.rs | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/mind-body/src/projection.rs b/crates/mind-body/src/projection.rs index 28f2ce9..303123f 100644 --- a/crates/mind-body/src/projection.rs +++ b/crates/mind-body/src/projection.rs @@ -146,9 +146,9 @@ fn own_addressee(addressing: Option<&dyn HeartbeatView>, own_sender: &str, publi let why = match (&table, written_at) { (None, _) => "no heartbeat addressing is configured (MIND_HEARTBEAT_STATE is not set)".to_owned(), (Some(Err(fault)), _) => format!("the heartbeat addressing could not be read: {fault:#}"), - (Some(Ok(_)), None) => "there is no heartbeat file".to_owned(), + (Some(Ok(Some(_))), _) => "the heartbeat's addressing table has no row for her".to_owned(), + (Some(Ok(None)), None) => "there is no heartbeat file".to_owned(), (Some(Ok(None)), Some(_)) => "the heartbeat file holds no addressing table".to_owned(), - (Some(Ok(Some(_))), Some(_)) => "the heartbeat's addressing table has no row for her".to_owned(), }; (Addressee::new(own_sender, [localpart(own_sender), public_name]), report("own names only", &why)) } diff --git a/crates/mind-body/src/projection/tests.rs b/crates/mind-body/src/projection/tests.rs index fdbbd01..1194be5 100644 --- a/crates/mind-body/src/projection/tests.rs +++ b/crates/mind-body/src/projection/tests.rs @@ -1287,8 +1287,10 @@ fn the_report_says_how_old_the_addressing_table_is_and_why_it_was_not_used() { let written = now() - chrono::Duration::minutes(90); let with_her = run(&Stale(Some(crate::heartbeat::Addressing { minds: vec![hers] }), Some(written))); assert_eq!((with_her["source"].as_str(), with_her["age_minutes"].as_i64()), (Some("heartbeat"), Some(90))); - let without_her = run(&Stale(Some(crate::heartbeat::Addressing { minds: vec![other] }), Some(written))); - assert!(without_her["why"].as_str().unwrap().contains("no row for her"), "{without_her}"); + for written_at in [Some(written), None] { + let without_her = run(&Stale(Some(crate::heartbeat::Addressing { minds: vec![other.clone()] }), written_at)); + assert!(without_her["why"].as_str().unwrap().contains("no row for her"), "a table without her is that, whatever its age: {without_her}"); + } let no_file = run(&Stale(None, None)); assert!(no_file["why"].as_str().unwrap().contains("no heartbeat file") && no_file["age_minutes"].is_null(), "{no_file}"); let no_table = run(&Stale(None, Some(written)));