From 3140d3054affec5e2196e31d51f4d5341f50ef6d Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 24 Aug 2026 04:51:24 +0200 Subject: [PATCH] Delete dead Resident Self receipt contract --- epiphany-core/src/lib.rs | 1 - epiphany-core/src/resident_self.rs | 51 +++++++------------ .../src/surfaces/coordinator_contract.rs | 14 ----- 3 files changed, 17 insertions(+), 49 deletions(-) diff --git a/epiphany-core/src/lib.rs b/epiphany-core/src/lib.rs index 2d523c9b..f8888625 100644 --- a/epiphany-core/src/lib.rs +++ b/epiphany-core/src/lib.rs @@ -353,7 +353,6 @@ pub use surfaces::AdmittedModelDirectionConsiderationContextProjection; pub use surfaces::EpiphanyCoordinatorAction; pub use surfaces::EpiphanyCoordinatorDecision; pub use surfaces::EpiphanyCoordinatorInput; -pub use surfaces::EpiphanyCoordinatorRoleResultStatus; pub use surfaces::EpiphanyCoordinatorRoleStatus; pub use surfaces::EpiphanyCrrcAction; pub use surfaces::EpiphanyCrrcResultStatus; diff --git a/epiphany-core/src/resident_self.rs b/epiphany-core/src/resident_self.rs index aee8a9a6..692cd8bf 100644 --- a/epiphany-core/src/resident_self.rs +++ b/epiphany-core/src/resident_self.rs @@ -8,9 +8,7 @@ use std::collections::{BTreeSet, HashSet}; use std::path::{Path, PathBuf}; pub const RESIDENT_SELF_STATE_KEY: &str = "resident-self"; -pub const RESIDENT_SELF_STATE_SCHEMA_VERSION: &str = "epiphany.resident_self.state.v1"; -pub const RESIDENT_SELF_RUNTIME_RECEIPT_SCHEMA_VERSION: &str = - "epiphany.resident_self.runtime_receipt.v0"; +pub const RESIDENT_SELF_STATE_SCHEMA_VERSION: &str = "epiphany.resident_self.state.v2"; pub const RESIDENT_SELF_PRESSURE_SCHEMA_VERSION: &str = "epiphany.resident_self.pressure.v0"; pub const RESIDENT_SELF_COORDINATOR_CONTINUATION_PRESSURE_KIND: &str = "coordinator-internal-continuation"; @@ -530,32 +528,6 @@ impl Default for ResidentSelfState { } } -#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)] -#[cultcache( - type = "epiphany.resident_self.runtime_receipt.v0", - schema = "ResidentSelfRuntimeReceipt" -)] -pub struct ResidentSelfRuntimeReceipt { - #[cultcache(key = 0)] - pub schema_version: String, - #[cultcache(key = 1)] - pub receipt_id: String, - #[cultcache(key = 2)] - pub occurred_at_millis: u64, - #[cultcache(key = 3)] - pub status: String, - #[cultcache(key = 4)] - pub reason: String, - #[cultcache(key = 5, default)] - pub turn_id: Option, - #[cultcache(key = 6, default)] - pub coordinator_receipt_id: Option, - #[cultcache(key = 7, default)] - pub process_id: Option, - #[cultcache(key = 8, default)] - pub private_state_exposed: bool, -} - #[derive(Clone, Debug, PartialEq, Eq)] pub enum ChildObservation { Running, @@ -785,7 +757,6 @@ pub fn resident_prepared_launch_thread_id(prepared: &ResidentSelfPreparedLaunch) fn state_cache(path: &Path) -> Result { let mut cache = CultCache::new(); cache.register_entry_type::()?; - cache.register_entry_type::()?; cache.register_entry_type::()?; cache.register_entry_type::()?; cache.register_entry_type::()?; @@ -802,7 +773,6 @@ fn state_cache(path: &Path) -> Result { )); } let owned = envelope.r#type == ResidentSelfState::TYPE - || envelope.r#type == ResidentSelfRuntimeReceipt::TYPE || envelope.r#type == ResidentSelfPressure::TYPE || envelope.r#type == ResidentSelfGrant::TYPE || envelope.r#type == ResidentSelfTerminalReceipt::TYPE @@ -822,9 +792,6 @@ fn state_cache(path: &Path) -> Result { ResidentSelfState::TYPE => { cache.load_envelope::(envelope)?; } - ResidentSelfRuntimeReceipt::TYPE => { - cache.load_envelope::(envelope)?; - } ResidentSelfPressure::TYPE => { cache.load_envelope::(envelope)?; } @@ -2742,6 +2709,22 @@ mod pressure_replay_tests { } } + #[test] + fn obsolete_state_epoch_refuses_without_mutation() -> Result<()> { + let temp = tempfile::tempdir()?; + let store = temp.path().join("resident.cc"); + let cache = state_cache(&store)?; + let mut state = ResidentSelfState::default(); + state.schema_version = "epiphany.resident_self.state.v1".into(); + SingleFileMessagePackBackingStore::new(&store) + .push(&cache.prepare_entry(RESIDENT_SELF_STATE_KEY, &state)?.0)?; + let before = std::fs::read(&store)?; + let error = load_resident_self_state(&store).unwrap_err(); + assert!(error.to_string().contains("obsolete writable state epoch")); + assert_eq!(std::fs::read(&store)?, before); + Ok(()) + } + #[test] fn configured_operator_pressure_replay_preserves_the_first_document() -> Result<()> { let temp = tempfile::tempdir()?; diff --git a/epiphany-core/src/surfaces/coordinator_contract.rs b/epiphany-core/src/surfaces/coordinator_contract.rs index 479e432b..609a8b8c 100644 --- a/epiphany-core/src/surfaces/coordinator_contract.rs +++ b/epiphany-core/src/surfaces/coordinator_contract.rs @@ -12,20 +12,6 @@ pub enum EpiphanyCoordinatorRoleStatus { Blocked, } -#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub enum EpiphanyCoordinatorRoleResultStatus { - MissingState, - MissingBinding, - BackendUnavailable, - BackendMissing, - Pending, - Running, - Completed, - Failed, - Cancelled, -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub enum EpiphanyCoordinatorAction {