Delete counterfeit Eve provider

This commit is contained in:
Meta Vens 2026-07-12 22:31:29 +01:00
commit 32fceda3a5
10 changed files with 35 additions and 117 deletions

View file

@ -1,99 +0,0 @@
use anyhow::{Context, Result};
use epiphany_core::{
epiphany_cultmesh_eve_connection_receipt_for_intent,
load_latest_epiphany_cultmesh_eve_connection_intent,
write_epiphany_cultmesh_eve_connection_receipt,
};
use serde_json::json;
use std::{env, path::PathBuf};
fn main() -> Result<()> {
let args = Args::parse()?;
let intent =
load_latest_epiphany_cultmesh_eve_connection_intent(&args.store, args.runtime_id.clone())?
.context("Eve provider found no pending connection intent")?;
if intent.target_cluster_id != args.provider_cluster_id {
anyhow::bail!(
"Eve provider {} cannot answer intent owned by {}",
args.provider_cluster_id,
intent.target_cluster_id
);
}
if let Some(expected_intent_id) = args.intent_id.as_deref() {
if intent.intent_id != expected_intent_id {
anyhow::bail!(
"latest Eve connection intent {:?} does not match requested {:?}",
intent.intent_id,
expected_intent_id
);
}
}
let receipt =
epiphany_cultmesh_eve_connection_receipt_for_intent(args.receipt_id, &intent, args.status);
let written = write_epiphany_cultmesh_eve_connection_receipt(
&args.store,
args.runtime_id.clone(),
receipt,
)?;
println!(
"{}",
serde_json::to_string_pretty(&json!({
"schemaVersion": "epiphany.eve_provider_connection_receipt.v0",
"status": written.status,
"runtimeId": args.runtime_id,
"providerClusterId": args.provider_cluster_id,
"intentId": written.intent_id,
"receiptId": written.receipt_id,
"feedbackRoute": written.feedback_route,
"privateStateExposed": written.private_state_exposed,
}))?
);
Ok(())
}
struct Args {
store: PathBuf,
runtime_id: String,
provider_cluster_id: String,
intent_id: Option<String>,
receipt_id: String,
status: String,
}
impl Args {
fn parse() -> Result<Self> {
let mut values = env::args().skip(1);
let command = values.next().unwrap_or_else(|| "accept".to_string());
if command != "accept" {
anyhow::bail!("unknown command {command:?}; use accept");
}
let mut store = PathBuf::from(".epiphany-run/cultmesh/local-verse.ccmp");
let mut runtime_id = "epiphany-local".to_string();
let mut provider_cluster_id = None;
let mut intent_id = None;
let mut receipt_id = None;
let mut status = "accepted".to_string();
while let Some(arg) = values.next() {
match arg.as_str() {
"--store" => store = PathBuf::from(values.next().context("missing --store")?),
"--runtime-id" => runtime_id = values.next().context("missing --runtime-id")?,
"--provider-cluster-id" => {
provider_cluster_id =
Some(values.next().context("missing --provider-cluster-id")?)
}
"--intent-id" => intent_id = Some(values.next().context("missing --intent-id")?),
"--receipt-id" => receipt_id = Some(values.next().context("missing --receipt-id")?),
"--status" => status = values.next().context("missing --status")?,
_ => anyhow::bail!("unknown argument {arg:?}"),
}
}
Ok(Self {
store,
runtime_id,
provider_cluster_id: provider_cluster_id.context("missing --provider-cluster-id")?,
intent_id,
receipt_id: receipt_id.context("missing --receipt-id")?,
status,
})
}
}

View file

@ -45,7 +45,6 @@ use epiphany_core::epiphany_cultmesh_daemon_poke_receipt_for_intent;
use epiphany_core::epiphany_cultmesh_daemon_tool_invocation_intent_from_capability;
use epiphany_core::epiphany_cultmesh_daemon_tool_invocation_receipt_for_intent;
use epiphany_core::epiphany_cultmesh_eve_connection_intent_from_advertisement;
use epiphany_core::epiphany_cultmesh_eve_connection_receipt_for_intent;
use epiphany_core::epiphany_service_execution_audit_report;
use epiphany_core::load_agent_state_soa_entry;
use epiphany_core::load_epiphany_cultmesh_cluster_topology;
@ -98,7 +97,6 @@ use epiphany_core::write_epiphany_cultmesh_daemon_status;
use epiphany_core::write_epiphany_cultmesh_daemon_tool_invocation_intent;
use epiphany_core::write_epiphany_cultmesh_daemon_tool_invocation_receipt;
use epiphany_core::write_epiphany_cultmesh_eve_connection_intent;
use epiphany_core::write_epiphany_cultmesh_eve_connection_receipt;
use epiphany_core::write_epiphany_cultmesh_swarm_brake;
use epiphany_core::write_epiphany_cultmesh_work_loop_telemetry;
use serde::Serialize;
@ -1504,21 +1502,13 @@ fn run_cli() -> Result<()> {
args.runtime_id.clone(),
intent.clone(),
)?;
let receipt = epiphany_cultmesh_eve_connection_receipt_for_intent(
"eve-receipt-smoke",
&intent,
"accepted-for-consensus-discovery",
);
write_epiphany_cultmesh_eve_connection_receipt(
&args.store,
args.runtime_id.clone(),
receipt,
)?;
let context = query_epiphany_local_verse_context(&args.store, args.runtime_id.clone())?;
if context.latest_eve_connection_intent.is_none()
|| context.latest_eve_connection_receipt.is_none()
|| context.latest_eve_connection_receipt.is_some()
{
anyhow::bail!("local Verse query smoke lost Eve connection intent/receipt");
anyhow::bail!(
"local Verse query smoke lost Eve intent or manufactured a provider receipt"
);
}
if context.daemon_tool_capabilities.len() < 19 {
anyhow::bail!("local Verse query smoke expected daemon tool capabilities");

View file

@ -3281,6 +3281,7 @@ pub fn epiphany_cultmesh_eve_connection_intent_from_advertisement(
}
}
#[cfg(test)]
pub fn epiphany_cultmesh_eve_connection_receipt_for_intent(
receipt_id: impl Into<String>,
intent: &EpiphanyCultMeshEveConnectionIntentEntry,
@ -3321,6 +3322,7 @@ pub fn write_epiphany_cultmesh_eve_connection_intent(
Ok(written)
}
#[cfg(test)]
pub fn write_epiphany_cultmesh_eve_connection_receipt(
store_path: impl AsRef<Path>,
runtime_id: impl Into<String>,
@ -6162,6 +6164,7 @@ fn epiphany_cultmesh_eve_connection_intent_key(intent_id: &str) -> String {
format!("epiphany-local/eve-connection-intent/{intent_id}")
}
#[cfg(test)]
fn epiphany_cultmesh_eve_connection_receipt_key(receipt_id: &str) -> String {
format!("epiphany-local/eve-connection-receipt/{receipt_id}")
}

View file

@ -393,6 +393,7 @@ pub use cultmesh_integration::epiphany_cultmesh_daemon_tool_invocation_from_stat
pub use cultmesh_integration::epiphany_cultmesh_daemon_tool_invocation_intent_from_capability;
pub use cultmesh_integration::epiphany_cultmesh_daemon_tool_invocation_receipt_for_intent;
pub use cultmesh_integration::epiphany_cultmesh_eve_connection_intent_from_advertisement;
#[cfg(test)]
pub use cultmesh_integration::epiphany_cultmesh_eve_connection_receipt_for_intent;
pub use cultmesh_integration::epiphany_cultmesh_eyes_contracts;
pub use cultmesh_integration::epiphany_cultmesh_global_room_policies;
@ -491,6 +492,7 @@ pub use cultmesh_integration::write_epiphany_cultmesh_daemon_statuses;
pub use cultmesh_integration::write_epiphany_cultmesh_daemon_tool_invocation_intent;
pub use cultmesh_integration::write_epiphany_cultmesh_daemon_tool_invocation_receipt;
pub use cultmesh_integration::write_epiphany_cultmesh_eve_connection_intent;
#[cfg(test)]
pub use cultmesh_integration::write_epiphany_cultmesh_eve_connection_receipt;
pub use cultmesh_integration::write_epiphany_cultmesh_eyes_contracts;
pub use cultmesh_integration::write_epiphany_cultmesh_global_room_policies;