Let topology own CultMesh bootstrap
This commit is contained in:
parent
75ead942c2
commit
753707ff12
5 changed files with 14 additions and 113 deletions
|
|
@ -32,7 +32,6 @@ use epiphany_core::load_epiphany_cultmesh_daemon_status;
|
|||
use epiphany_core::load_epiphany_cultmesh_managed_service_policies;
|
||||
use epiphany_core::load_epiphany_cultmesh_managed_service_policy;
|
||||
use epiphany_core::load_epiphany_cultmesh_managed_service_policy_with_digest;
|
||||
use epiphany_core::load_epiphany_cultmesh_status;
|
||||
use epiphany_core::load_epiphany_cultmesh_swarm_brake;
|
||||
use epiphany_core::load_epiphany_packaged_release;
|
||||
use epiphany_core::load_latest_epiphany_cultmesh_daemon_heartbeat;
|
||||
|
|
@ -734,13 +733,6 @@ fn semantic_recover(args: Args) -> Result<()> {
|
|||
}
|
||||
|
||||
fn require_supervisor_bootstrap(args: &Args) -> Result<()> {
|
||||
load_epiphany_cultmesh_status(&args.store, args.runtime_id.clone())?
|
||||
.with_context(|| {
|
||||
format!(
|
||||
"local Verse is not bootstrapped at {}; run explicit bootstrap before daemon-supervisor commands",
|
||||
args.store.display()
|
||||
)
|
||||
})?;
|
||||
let topology = load_epiphany_cultmesh_cluster_topology(&args.store, args.runtime_id.clone())?;
|
||||
if topology.is_empty() {
|
||||
anyhow::bail!(
|
||||
|
|
|
|||
|
|
@ -41,9 +41,6 @@ use sha2::Sha256;
|
|||
use std::path::Path;
|
||||
use uuid::Uuid;
|
||||
|
||||
pub const EPIPHANY_CULTMESH_STATUS_TYPE: &str = "epiphany.cultmesh.status";
|
||||
pub const EPIPHANY_CULTMESH_STATUS_SCHEMA_VERSION: &str = "epiphany.cultmesh.status.v0";
|
||||
pub const EPIPHANY_CULTMESH_STATUS_KEY: &str = "epiphany-local/status";
|
||||
pub const EPIPHANY_CULTMESH_CLUSTER_TOPOLOGY_TYPE: &str = "epiphany.cultmesh.cluster_topology";
|
||||
pub const EPIPHANY_CULTMESH_CLUSTER_TOPOLOGY_SCHEMA_VERSION: &str =
|
||||
"epiphany.cultmesh.cluster_topology.v0";
|
||||
|
|
@ -181,26 +178,6 @@ pub struct EpiphanyCultMeshSemanticProjectionHealthEntry {
|
|||
pub query_eligible_display_only: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)]
|
||||
#[cultcache(
|
||||
type = "epiphany.cultmesh.status",
|
||||
schema = "EpiphanyCultMeshStatusEntry"
|
||||
)]
|
||||
pub struct EpiphanyCultMeshStatusEntry {
|
||||
#[cultcache(key = 0)]
|
||||
pub schema_version: String,
|
||||
#[cultcache(key = 1)]
|
||||
pub runtime_id: String,
|
||||
#[cultcache(key = 2)]
|
||||
pub verse_id: String,
|
||||
#[cultcache(key = 3)]
|
||||
pub app_id: String,
|
||||
#[cultcache(key = 4)]
|
||||
pub note: String,
|
||||
#[cultcache(key = 5, default)]
|
||||
pub verse_tier: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct EpiphanyVersePolicy {
|
||||
|
|
@ -865,7 +842,6 @@ pub struct EpiphanyLocalVerseContractSummary {
|
|||
}
|
||||
|
||||
cultmesh_documents!(EpiphanyCultMeshDocuments {
|
||||
EpiphanyCultMeshStatusEntry => EPIPHANY_CULTMESH_STATUS_SCHEMA_VERSION,
|
||||
EpiphanyCultMeshClusterTopologyEntry => EPIPHANY_CULTMESH_CLUSTER_TOPOLOGY_SCHEMA_VERSION,
|
||||
EpiphanyCultMeshDaemonStatusEntry => EPIPHANY_CULTMESH_DAEMON_STATUS_SCHEMA_VERSION,
|
||||
EpiphanyCultMeshDaemonHeartbeatEventEntry => EPIPHANY_CULTMESH_DAEMON_HEARTBEAT_EVENT_SCHEMA_VERSION,
|
||||
|
|
@ -1094,25 +1070,6 @@ fn bounded_opaque_health_id(value: &str) -> bool {
|
|||
.all(|byte| byte.is_ascii_alphanumeric() || matches!(byte, b'.' | b'_' | b'-' | b':'))
|
||||
}
|
||||
|
||||
pub fn write_epiphany_cultmesh_status(
|
||||
store_path: impl AsRef<Path>,
|
||||
status: EpiphanyCultMeshStatusEntry,
|
||||
) -> Result<EpiphanyCultMeshStatusEntry> {
|
||||
let mut node = open_epiphany_cultmesh_node(&store_path, status.runtime_id.clone())?;
|
||||
let written = node.put(EPIPHANY_CULTMESH_STATUS_KEY, &status)?;
|
||||
node.flush()?;
|
||||
Ok(written)
|
||||
}
|
||||
|
||||
pub fn load_epiphany_cultmesh_status(
|
||||
store_path: impl AsRef<Path>,
|
||||
runtime_id: impl Into<String>,
|
||||
) -> Result<Option<EpiphanyCultMeshStatusEntry>> {
|
||||
let store_path = store_path.as_ref();
|
||||
let node = open_epiphany_cultmesh_node(store_path, runtime_id)?;
|
||||
node.get(EPIPHANY_CULTMESH_STATUS_KEY)
|
||||
}
|
||||
|
||||
pub fn epiphany_cultmesh_daemon_poke_intent_from_status(
|
||||
intent_id: impl Into<String>,
|
||||
requesting_agent_id: impl Into<String>,
|
||||
|
|
@ -2584,15 +2541,6 @@ pub fn seed_epiphany_local_verse_context(
|
|||
if !body_domain.starts_with("repo:") || body_domain.trim() == "repo:" {
|
||||
anyhow::bail!("local Verse repository topology requires an explicit repo: Body domain");
|
||||
}
|
||||
let status = EpiphanyCultMeshStatusEntry {
|
||||
schema_version: EPIPHANY_CULTMESH_STATUS_SCHEMA_VERSION.to_string(),
|
||||
runtime_id: runtime_id.clone(),
|
||||
verse_id: EPIPHANY_CULTMESH_INTERNAL_VERSE_ID.to_string(),
|
||||
verse_tier: EPIPHANY_CULTMESH_INTERNAL_TIER.to_string(),
|
||||
app_id: "epiphany".to_string(),
|
||||
note: "Epiphany local Verse query context is typed CultMesh state; prompt assembly may read it, but Mind still owns durable adoption.".to_string(),
|
||||
};
|
||||
write_epiphany_cultmesh_status(store_path, status)?;
|
||||
write_epiphany_cultmesh_cluster_topology(store_path, runtime_id.clone(), body_domain)?;
|
||||
{
|
||||
let node = open_epiphany_cultmesh_node(store_path, runtime_id.clone())?;
|
||||
|
|
@ -4108,27 +4056,6 @@ mod tests {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn epiphany_status_round_trips_through_cultmesh() -> Result<()> {
|
||||
let temp = tempfile::tempdir()?;
|
||||
let store = temp.path().join("epiphany-local.ccmp");
|
||||
let status = EpiphanyCultMeshStatusEntry {
|
||||
schema_version: EPIPHANY_CULTMESH_STATUS_SCHEMA_VERSION.to_string(),
|
||||
runtime_id: "epiphany-test".to_string(),
|
||||
verse_id: EPIPHANY_CULTMESH_INTERNAL_VERSE_ID.to_string(),
|
||||
verse_tier: EPIPHANY_CULTMESH_INTERNAL_TIER.to_string(),
|
||||
app_id: "epiphany".to_string(),
|
||||
note: "CultMesh is the local abstraction over CultCache and CultNet.".to_string(),
|
||||
};
|
||||
|
||||
write_epiphany_cultmesh_status(&store, status.clone())?;
|
||||
assert_eq!(
|
||||
load_epiphany_cultmesh_status(&store, "epiphany-test")?,
|
||||
Some(status)
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn service_lifecycle_receipt_history_excludes_latest_mirror() -> Result<()> {
|
||||
let temp = tempfile::tempdir()?;
|
||||
|
|
@ -4420,10 +4347,6 @@ mod tests {
|
|||
let missing_parent = temp.path().join("missing-body");
|
||||
let store = missing_parent.join("missing-local-verse.ccmp");
|
||||
|
||||
assert_eq!(
|
||||
load_epiphany_cultmesh_status(&store, "epiphany-test")?,
|
||||
None
|
||||
);
|
||||
assert!(load_epiphany_cultmesh_cluster_topology(&store, "epiphany-test")?.is_empty());
|
||||
assert_eq!(
|
||||
load_epiphany_cultmesh_daemon_status(&store, "epiphany-test", "epiphany-daemon-hands")?,
|
||||
|
|
|
|||
|
|
@ -171,9 +171,6 @@ pub use cultmesh_integration::EPIPHANY_CULTMESH_MANAGED_SERVICE_POLICY_SCHEMA_VE
|
|||
pub use cultmesh_integration::EPIPHANY_CULTMESH_MANAGED_SERVICE_POLICY_TYPE;
|
||||
pub use cultmesh_integration::EPIPHANY_CULTMESH_SEMANTIC_PROJECTION_HEALTH_SCHEMA_VERSION;
|
||||
pub use cultmesh_integration::EPIPHANY_CULTMESH_SEMANTIC_PROJECTION_HEALTH_TYPE;
|
||||
pub use cultmesh_integration::EPIPHANY_CULTMESH_STATUS_KEY;
|
||||
pub use cultmesh_integration::EPIPHANY_CULTMESH_STATUS_SCHEMA_VERSION;
|
||||
pub use cultmesh_integration::EPIPHANY_CULTMESH_STATUS_TYPE;
|
||||
pub use cultmesh_integration::EPIPHANY_CULTMESH_SWARM_BRAKE_KEY;
|
||||
pub use cultmesh_integration::EPIPHANY_CULTMESH_SWARM_BRAKE_SCHEMA_VERSION;
|
||||
pub use cultmesh_integration::EPIPHANY_CULTMESH_SWARM_BRAKE_TYPE;
|
||||
|
|
@ -196,7 +193,6 @@ pub use cultmesh_integration::EpiphanyCultMeshIdunnAftercareAuditReceiptEntry;
|
|||
pub use cultmesh_integration::EpiphanyCultMeshIdunnDeploymentReceiptEntry;
|
||||
pub use cultmesh_integration::EpiphanyCultMeshManagedServicePolicyEntry;
|
||||
pub use cultmesh_integration::EpiphanyCultMeshSemanticProjectionHealthEntry;
|
||||
pub use cultmesh_integration::EpiphanyCultMeshStatusEntry;
|
||||
pub use cultmesh_integration::EpiphanyCultMeshSwarmBrakeEntry;
|
||||
pub use cultmesh_integration::EpiphanyGlobalRoomPolicy;
|
||||
pub use cultmesh_integration::EpiphanyLocalVerseContext;
|
||||
|
|
@ -236,7 +232,6 @@ pub use cultmesh_integration::load_epiphany_cultmesh_managed_service_policies;
|
|||
pub use cultmesh_integration::load_epiphany_cultmesh_managed_service_policy;
|
||||
pub use cultmesh_integration::load_epiphany_cultmesh_managed_service_policy_with_digest;
|
||||
pub use cultmesh_integration::load_epiphany_cultmesh_semantic_projection_health;
|
||||
pub use cultmesh_integration::load_epiphany_cultmesh_status;
|
||||
pub use cultmesh_integration::load_epiphany_cultmesh_swarm_brake;
|
||||
pub use cultmesh_integration::load_latest_epiphany_cultmesh_daemon_heartbeat;
|
||||
pub use cultmesh_integration::load_latest_epiphany_cultmesh_daemon_poke_intent;
|
||||
|
|
@ -267,7 +262,6 @@ pub use cultmesh_integration::write_epiphany_cultmesh_daemon_status;
|
|||
#[cfg(test)]
|
||||
pub use cultmesh_integration::write_epiphany_cultmesh_managed_service_policy;
|
||||
pub use cultmesh_integration::write_epiphany_cultmesh_semantic_projector_service_policy;
|
||||
pub use cultmesh_integration::write_epiphany_cultmesh_status;
|
||||
pub use cultmesh_integration::write_epiphany_cultmesh_swarm_brake;
|
||||
pub use cultmesh_integration::write_epiphany_cultmesh_workspace_coverage_projector_service_policy;
|
||||
pub use current_work::*;
|
||||
|
|
|
|||
|
|
@ -1241,17 +1241,8 @@ mod tests {
|
|||
|
||||
let mut local =
|
||||
crate::open_epiphany_cultmesh_node(&feedback_store, "epiphany-yggdrasil".to_string())?;
|
||||
local.put(
|
||||
"status",
|
||||
&crate::EpiphanyCultMeshStatusEntry {
|
||||
schema_version: crate::EPIPHANY_CULTMESH_STATUS_SCHEMA_VERSION.into(),
|
||||
runtime_id: "epiphany-yggdrasil".into(),
|
||||
verse_id: "gamecult-local".into(),
|
||||
app_id: "epiphany".into(),
|
||||
note: "existing local Verse state".into(),
|
||||
verse_tier: "local".into(),
|
||||
},
|
||||
)?;
|
||||
let existing_brake = crate::default_epiphany_cultmesh_swarm_brake("2026-08-23T00:00:00Z");
|
||||
local.put(crate::EPIPHANY_CULTMESH_SWARM_BRAKE_KEY, &existing_brake)?;
|
||||
|
||||
let imported = import_bifrost_persona_feedback_deliveries(
|
||||
&source_store,
|
||||
|
|
@ -1271,8 +1262,7 @@ mod tests {
|
|||
1
|
||||
);
|
||||
assert!(
|
||||
crate::open_epiphany_cultmesh_node(&feedback_store, "epiphany-yggdrasil".to_string())?
|
||||
.get::<crate::EpiphanyCultMeshStatusEntry>("status")?
|
||||
crate::load_epiphany_cultmesh_swarm_brake(&feedback_store, "epiphany-yggdrasil")?
|
||||
.is_some()
|
||||
);
|
||||
Ok(())
|
||||
|
|
|
|||
|
|
@ -772,6 +772,13 @@ fn credential_file_ready(path: &Path) -> bool {
|
|||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)]
|
||||
#[cultcache(type = "test.foreign_owner", schema = "ForeignOwnerEntry")]
|
||||
struct ForeignOwnerEntry {
|
||||
#[cultcache(key = 0)]
|
||||
value: String,
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn resident_process_singleton_excludes_only_the_same_store() -> Result<()> {
|
||||
let temp = tempfile::tempdir()?;
|
||||
|
|
@ -936,21 +943,16 @@ mod tests {
|
|||
let temp = tempfile::tempdir()?;
|
||||
let store = temp.path().join("mixed.cc");
|
||||
let mut mixed = CultCache::new();
|
||||
mixed.register_entry_type::<crate::EpiphanyCultMeshStatusEntry>()?;
|
||||
mixed.register_entry_type::<ForeignOwnerEntry>()?;
|
||||
mixed.add_generic_backing_store(SingleFileMessagePackBackingStore::new(&store));
|
||||
let foreign = crate::EpiphanyCultMeshStatusEntry {
|
||||
schema_version: crate::EPIPHANY_CULTMESH_STATUS_SCHEMA_VERSION.into(),
|
||||
runtime_id: "ygg".into(),
|
||||
verse_id: "gamecult-local".into(),
|
||||
app_id: "foreign-owner".into(),
|
||||
note: "must survive readiness CAS".into(),
|
||||
verse_tier: "local".into(),
|
||||
let foreign = ForeignOwnerEntry {
|
||||
value: "must survive readiness CAS".into(),
|
||||
};
|
||||
mixed.put("foreign/status", &foreign)?;
|
||||
publish_resident_provider_readiness(&store, provider())?;
|
||||
let entries = SingleFileMessagePackBackingStore::new(&store).pull_all()?;
|
||||
assert!(entries.iter().any(|entry| {
|
||||
entry.r#type == <crate::EpiphanyCultMeshStatusEntry as DatabaseEntry>::TYPE
|
||||
entry.r#type == <ForeignOwnerEntry as DatabaseEntry>::TYPE
|
||||
&& entry.key == "foreign/status"
|
||||
}));
|
||||
|
||||
|
|
|
|||
Reference in a new issue