From c7097777063b02e09112284affcf22d6bac3804f Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Thu, 6 Aug 2026 13:21:35 +0100 Subject: [PATCH] Keep unadmitted models non-actuating --- .../admitted_model_direction_consideration.rs | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/epiphany-core/src/admitted_model_direction_consideration.rs b/epiphany-core/src/admitted_model_direction_consideration.rs index b8a6ae8a..670cb19c 100644 --- a/epiphany-core/src/admitted_model_direction_consideration.rs +++ b/epiphany-core/src/admitted_model_direction_consideration.rs @@ -116,6 +116,9 @@ pub fn commit_request( receipt.admitted_revision == model.model_revision && receipt.admitted_hash == model_hash }) .collect::>(); + if receipts.is_empty() { + return Ok(None); + } if receipts.len() != 1 { bail!("model direction consideration requires exactly one current model receipt"); } @@ -359,4 +362,46 @@ mod tests { ); Ok(()) } + + #[test] + fn bootstrap_model_without_admission_receipt_has_no_direction_request_yet() -> Result<()> { + let temp = tempfile::tempdir()?; + let store = temp.path().join("bootstrap-runtime.ccmp"); + let mut cache = crate::runtime_spine_cache(&store)?; + cache.put( + crate::RUNTIME_IDENTITY_KEY, + &crate::EpiphanyRuntimeIdentity { + schema_version: crate::RUNTIME_SPINE_SCHEMA_VERSION.into(), + runtime_id: "runtime-bootstrap".into(), + display_name: "Bootstrap runtime".into(), + runtime_kind: "resident".into(), + created_at: "2026-07-18T00:00:00Z".into(), + updated_at: "2026-07-18T00:00:00Z".into(), + supported_document_types: Vec::new(), + metadata: BTreeMap::new(), + }, + )?; + cache.put( + crate::THREAD_STATE_KEY, + &crate::EpiphanyThreadStateEntry::from_state( + "bootstrap-thread", + &epiphany_state_model::EpiphanyThreadState::default(), + )?, + )?; + cache.put( + crate::MEMORY_GRAPH_KEY, + &crate::EpiphanyMemoryGraphEntry::from_snapshot( + &crate::EpiphanyMemoryGraphSnapshot { + schema_version: Some(crate::MEMORY_GRAPH_SCHEMA_VERSION.into()), + graph_id: "bootstrap-model".into(), + ..Default::default() + }, + )?, + )?; + let before = std::fs::read(&store)?; + + assert!(commit_request(&store, "2026-07-18T00:01:00Z")?.is_none()); + assert_eq!(std::fs::read(&store)?, before); + Ok(()) + } }