From 2ba6b9dc7efbd701f5afc1a6d8366af0b284b3c0 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 16 Aug 2026 20:52:37 +0200 Subject: [PATCH] Project both semantic Mind partitions --- epiphany-core/src/cultmesh_integration.rs | 7 ++- .../src/semantic_projector_service.rs | 51 ++++++++++++++++--- 2 files changed, 49 insertions(+), 9 deletions(-) diff --git a/epiphany-core/src/cultmesh_integration.rs b/epiphany-core/src/cultmesh_integration.rs index 4828f7ec..d9bc9c46 100644 --- a/epiphany-core/src/cultmesh_integration.rs +++ b/epiphany-core/src/cultmesh_integration.rs @@ -2764,7 +2764,7 @@ fn validate_semantic_projection_health( let has_receipt = row.receipt_id.is_some() && row.indexed_document_count.is_some() && row.vector_dimensions.is_some(); - if row.query_eligible_display_only != (row.status == "ready") + if (row.query_eligible_display_only && row.status != "ready") || has_receipt != (row.status == "ready") { return Err(anyhow!( @@ -8421,6 +8421,11 @@ mod tests { )?; assert_eq!(ready.status, "ready"); assert!(ready.query_eligible_display_only); + let mut empty_ready = ready.clone(); + empty_ready.indexed_document_count = Some(0); + empty_ready.vector_dimensions = Some(0); + empty_ready.query_eligible_display_only = false; + validate_semantic_projection_health(&empty_ready)?; let repair = crate::memory_graph::semantic_projector::idunn_acquire_memory_semantic_projection( diff --git a/epiphany-core/src/semantic_projector_service.rs b/epiphany-core/src/semantic_projector_service.rs index 203f8db9..a3a9ddf0 100644 --- a/epiphany-core/src/semantic_projector_service.rs +++ b/epiphany-core/src/semantic_projector_service.rs @@ -9,7 +9,7 @@ use crate::memory_graph::{ }; use crate::{ MemorySemanticIndexConfig, MemorySemanticProjectionInput, - agent_memory_semantic_projection_input, + agent_memory_semantic_projection_input, runtime_modeling_semantic_projection_input, }; use anyhow::{Result, anyhow}; use chrono::{SecondsFormat, Utc}; @@ -189,7 +189,6 @@ impl SemanticProjectorServiceBody { config: MemorySemanticIndexConfig, ) -> Result { let singleton = acquire_semantic_projector_singleton(&mind_store, &modeling_store)?; - agent_memory_semantic_projection_input(&mind_store)?; let session = LocalIdunnSemanticProjectorSession::new( mind_store, modeling_store, @@ -210,12 +209,10 @@ impl SemanticProjectorServiceBody { pub fn pulse(&self, fairness_cursor: Option<&str>) -> SemanticProjectorServicePulse { let session = &self.pulser.port; - let mut source_fault_count = 0; - let mut inputs = Vec::with_capacity(1); - match agent_memory_semantic_projection_input(&session.mind_store) { - Ok(input) => inputs.push(input), - Err(_) => source_fault_count += 1, - } + let (inputs, source_fault_count) = collect_semantic_projection_inputs( + agent_memory_semantic_projection_input(&session.mind_store), + runtime_modeling_semantic_projection_input(&session.modeling_store), + ); let outcome = self.pulser.pulse(&inputs, fairness_cursor); SemanticProjectorServicePulse { outcome, @@ -225,6 +222,23 @@ impl SemanticProjectorServiceBody { } } +fn collect_semantic_projection_inputs( + mind: Result, + modeling: Result, +) -> (Vec, u32) { + match (mind, modeling) { + (Ok(mind), Ok(modeling)) + if validate_semantic_projector_source_pair(&mind, &modeling).is_ok() => + { + (vec![mind, modeling], 0) + } + (Ok(_), Ok(_)) => (Vec::new(), 2), + (Ok(mind), Err(_)) => (vec![mind], 1), + (Err(_), Ok(modeling)) => (vec![modeling], 1), + (Err(_), Err(_)) => (Vec::new(), 2), + } +} + impl MemorySemanticProjectorPulsePort for LocalIdunnSemanticProjectorSession { fn classify( &self, @@ -371,6 +385,27 @@ mod tests { ); } + #[test] + fn pulse_source_collection_keeps_both_partitions_and_does_not_hide_one_survivor() { + let (both, faults) = + collect_semantic_projection_inputs(Ok(input("a", "mind")), Ok(input("a", "modeling"))); + assert_eq!(both.len(), 2); + assert_eq!(faults, 0); + + let (modeling, faults) = collect_semantic_projection_inputs( + Err(anyhow!("Mind source failed")), + Ok(input("a", "modeling")), + ); + assert_eq!(modeling.len(), 1); + assert_eq!(modeling[0].obligation().partition, "modeling"); + assert_eq!(faults, 1); + + let (foreign_pair, faults) = + collect_semantic_projection_inputs(Ok(input("a", "mind")), Ok(input("b", "modeling"))); + assert!(foreign_pair.is_empty()); + assert_eq!(faults, 2); + } + #[test] fn session_refuses_one_physical_store_as_two_owners() -> Result<()> { let temp = tempfile::tempdir()?;