diff --git a/epiphany-core/src/cultmesh_integration.rs b/epiphany-core/src/cultmesh_integration.rs index 45b5a631..50f33bc2 100644 --- a/epiphany-core/src/cultmesh_integration.rs +++ b/epiphany-core/src/cultmesh_integration.rs @@ -44,29 +44,6 @@ 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_REPO_WORK_OVERVIEW_TYPE: &str = "epiphany.cultmesh.repo_work_overview"; -pub const EPIPHANY_CULTMESH_REPO_WORK_OVERVIEW_SCHEMA_VERSION: &str = - "epiphany.cultmesh.repo_work_overview.v0"; -pub const EPIPHANY_CULTMESH_REPO_WORK_OVERVIEW_LATEST_KEY: &str = - "gamecult-local/repo-work-overview/latest"; -pub const EPIPHANY_CULTMESH_REPO_WORK_READINESS_TYPE: &str = - "epiphany.cultmesh.repo_work_readiness"; -pub const EPIPHANY_CULTMESH_REPO_WORK_READINESS_SCHEMA_VERSION: &str = - "epiphany.cultmesh.repo_work_readiness.v0"; -pub const EPIPHANY_CULTMESH_REPO_WORK_READINESS_LATEST_KEY: &str = - "gamecult-local/repo-work-readiness/latest"; -pub const EPIPHANY_CULTMESH_REPO_WORK_MAP_ENTRY_TYPE: &str = - "epiphany.cultmesh.repo_work_map_entry"; -pub const EPIPHANY_CULTMESH_REPO_WORK_MAP_ENTRY_SCHEMA_VERSION: &str = - "epiphany.cultmesh.repo_work_map_entry.v0"; -pub const EPIPHANY_CULTMESH_REPO_WORK_MAP_ENTRY_LATEST_KEY: &str = - "gamecult-local/repo-work-map/latest"; -pub const EPIPHANY_CULTMESH_REPO_WORK_PUBLIC_PROOF_TYPE: &str = - "epiphany.cultmesh.repo_work_public_proof"; -pub const EPIPHANY_CULTMESH_REPO_WORK_PUBLIC_PROOF_SCHEMA_VERSION: &str = - "epiphany.cultmesh.repo_work_public_proof.v0"; -pub const EPIPHANY_CULTMESH_REPO_WORK_PUBLIC_PROOF_LATEST_KEY: &str = - "gamecult-local/repo-work-public-proof/latest"; 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"; @@ -145,23 +122,6 @@ pub const EPIPHANY_CULTMESH_BIFROST_GITHUB_PUBLICATION_RECEIPT_SCHEMA_VERSION: & "gamecult.bifrost.github_publication_receipt.v0"; pub const EPIPHANY_CULTMESH_BIFROST_GITHUB_PUBLICATION_RECEIPT_ARRIVAL_LATEST_KEY: &str = "gamecult-local/bifrost/github-publication-receipt/latest"; -pub const EPIPHANY_CULTMESH_BIFROST_PUBLIC_PROOF_PUBLICATION_RECEIPT_TYPE: &str = - "gamecult.bifrost.public_proof_publication_receipt"; -pub const EPIPHANY_CULTMESH_BIFROST_PUBLIC_PROOF_PUBLICATION_RECEIPT_SCHEMA_VERSION: &str = - "gamecult.bifrost.public_proof_publication_receipt.v0"; -pub const EPIPHANY_CULTMESH_BIFROST_PUBLIC_PROOF_PUBLICATION_RECEIPT_ARRIVAL_LATEST_KEY: &str = - "gamecult-local/bifrost/public-proof-publication-receipt/latest"; -pub const EPIPHANY_CULTMESH_BIFROST_ARTIFACT_ACCEPTANCE_RECEIPT_TYPE: &str = - "gamecult.bifrost.artifact_acceptance_receipt"; -pub const EPIPHANY_CULTMESH_BIFROST_ARTIFACT_ACCEPTANCE_RECEIPT_SCHEMA_VERSION: &str = - "gamecult.bifrost.artifact_acceptance_receipt.v0"; -pub const EPIPHANY_CULTMESH_BIFROST_ARTIFACT_ACCEPTANCE_RECEIPT_ARRIVAL_LATEST_KEY: &str = - "gamecult-local/bifrost/artifact-acceptance-receipt/latest"; -pub const EPIPHANY_CULTMESH_BIFROST_METRICS_RECEIPT_TYPE: &str = "gamecult.bifrost.metrics_receipt"; -pub const EPIPHANY_CULTMESH_BIFROST_METRICS_RECEIPT_SCHEMA_VERSION: &str = - "gamecult.bifrost.metrics_receipt.v0"; -pub const EPIPHANY_CULTMESH_BIFROST_METRICS_RECEIPT_ARRIVAL_LATEST_KEY: &str = - "gamecult-local/bifrost/metrics-receipt/latest"; pub const EPIPHANY_CULTMESH_INTERNAL_VERSE_ID: &str = "epiphany-internal"; pub const EPIPHANY_CULTMESH_LOCAL_AREA_VERSE_ID: &str = "gamecult-local"; pub const EPIPHANY_CULTMESH_GLOBAL_VERSE_ID: &str = "epiphany-global"; @@ -241,218 +201,6 @@ pub struct EpiphanyCultMeshStatusEntry { pub verse_tier: String, } -#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)] -#[cultcache( - type = "epiphany.cultmesh.repo_work_overview", - schema = "EpiphanyCultMeshRepoWorkOverviewEntry" -)] -pub struct EpiphanyCultMeshRepoWorkOverviewEntry { - #[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 overview_id: String, - #[cultcache(key = 4)] - pub generated_at: String, - #[cultcache(key = 5)] - pub workspace: String, - #[cultcache(key = 6)] - pub item: String, - #[cultcache(key = 7)] - pub branch: String, - #[cultcache(key = 8)] - pub current_gate: String, - #[cultcache(key = 9)] - pub blocker: String, - #[cultcache(key = 10)] - pub next_safe_move: String, - #[cultcache(key = 11)] - pub changed_paths: Vec, - #[cultcache(key = 12)] - pub commit_sha: String, - #[cultcache(key = 13)] - pub soul_verdict: String, - #[cultcache(key = 14)] - pub publication_status: String, - #[cultcache(key = 15)] - pub sync_status: String, - #[cultcache(key = 16)] - pub receipt_refs: Vec, - #[cultcache(key = 17)] - pub tui_rows: Vec, - #[cultcache(key = 18)] - pub proof_bundle_ref: String, - #[cultcache(key = 19)] - pub private_state_exposed: bool, - #[cultcache(key = 20)] - pub notes: Vec, -} - -#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)] -#[cultcache( - type = "epiphany.cultmesh.repo_work_readiness", - schema = "EpiphanyCultMeshRepoWorkReadinessEntry" -)] -pub struct EpiphanyCultMeshRepoWorkReadinessEntry { - #[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 readiness_id: String, - #[cultcache(key = 4)] - pub generated_at: String, - #[cultcache(key = 5)] - pub workspace: String, - #[cultcache(key = 6)] - pub item: String, - #[cultcache(key = 7)] - pub status: String, - #[cultcache(key = 8)] - pub missing_required_count: u32, - #[cultcache(key = 9)] - pub satisfied_required_count: u32, - #[cultcache(key = 10)] - pub readiness_receipt_ref: String, - #[cultcache(key = 11)] - pub overview_receipt_ref: String, - #[cultcache(key = 12)] - pub proof_bundle_id: String, - #[cultcache(key = 13)] - pub missing_kinds: Vec, - #[cultcache(key = 14)] - pub tui_rows: Vec, - #[cultcache(key = 15)] - pub sight_only: bool, - #[cultcache(key = 16)] - pub readiness_approval_authorized: bool, - #[cultcache(key = 17)] - pub publication_authorized: bool, - #[cultcache(key = 18)] - pub service_lifecycle_authority: bool, - #[cultcache(key = 19)] - pub hands_action_authorized: bool, - #[cultcache(key = 20)] - pub private_state_exposed: bool, - #[cultcache(key = 21)] - pub notes: Vec, -} - -#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)] -#[cultcache( - type = "epiphany.cultmesh.repo_work_map_entry", - schema = "EpiphanyCultMeshRepoWorkMapEntry" -)] -pub struct EpiphanyCultMeshRepoWorkMapEntry { - #[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 map_entry_id: String, - #[cultcache(key = 4)] - pub admitted_at: String, - #[cultcache(key = 5)] - pub mirrored_at: String, - #[cultcache(key = 6)] - pub workspace: String, - #[cultcache(key = 7)] - pub item: String, - #[cultcache(key = 8)] - pub branch: String, - #[cultcache(key = 9)] - pub changed_paths: Vec, - #[cultcache(key = 10)] - pub commit_sha: String, - #[cultcache(key = 11)] - pub safe_action_family: String, - #[cultcache(key = 12)] - pub modeling_summary: String, - #[cultcache(key = 13)] - pub soul_verdict_receipt_id: String, - #[cultcache(key = 14)] - pub mind_gateway_review_id: String, - #[cultcache(key = 15)] - pub mind_state_commit_receipt_id: String, - #[cultcache(key = 16)] - pub publication_gate: String, - #[cultcache(key = 17)] - pub durable_state_admitted: bool, - #[cultcache(key = 18)] - pub source_store_path: String, - #[cultcache(key = 19)] - pub tui_rows: Vec, - #[cultcache(key = 20)] - pub private_state_exposed: bool, - #[cultcache(key = 21)] - pub notes: Vec, - #[cultcache(key = 22)] - pub modeling_finding_receipt_id: String, - #[cultcache(key = 23)] - pub modeling_route_id: String, - #[cultcache(key = 24)] - pub modeling_generation: u64, -} - -#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)] -#[cultcache( - type = "epiphany.cultmesh.repo_work_public_proof", - schema = "EpiphanyCultMeshRepoWorkPublicProofEntry" -)] -pub struct EpiphanyCultMeshRepoWorkPublicProofEntry { - #[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 public_proof_id: String, - #[cultcache(key = 4)] - pub generated_at: String, - #[cultcache(key = 5)] - pub workspace: String, - #[cultcache(key = 6)] - pub item: String, - #[cultcache(key = 7)] - pub branch: String, - #[cultcache(key = 8)] - pub current_gate: String, - #[cultcache(key = 9)] - pub blocker: String, - #[cultcache(key = 10)] - pub next_safe_move: String, - #[cultcache(key = 11)] - pub changed_paths: Vec, - #[cultcache(key = 12)] - pub commit_sha: String, - #[cultcache(key = 13)] - pub soul_verdict: String, - #[cultcache(key = 14)] - pub upstream_main_synced: bool, - #[cultcache(key = 15)] - pub artifact_row_count: u32, - #[cultcache(key = 16)] - pub publication_row_count: u32, - #[cultcache(key = 17)] - pub public_proof_ref: String, - #[cultcache(key = 18)] - pub public_proof_sha256: String, - #[cultcache(key = 19)] - pub tui_rows: Vec, - #[cultcache(key = 20)] - pub private_state_exposed: bool, - #[cultcache(key = 21)] - pub notes: Vec, -} - #[derive(Clone, Debug, PartialEq, Eq, Serialize)] #[serde(rename_all = "camelCase")] pub struct EpiphanyVersePolicy { @@ -896,198 +644,6 @@ pub struct EpiphanyCultMeshIdunnAftercareAuditReceiptEntry { pub notes: Vec, } -#[derive(Clone, Debug, PartialEq, Eq, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct EpiphanyServiceExecutionAuditCheck { - pub service_id: Option, - pub action: String, - pub allowed_statuses: Vec, - pub receipt_id: Option, - pub observed_status: Option, - pub operator_artifact_ref: Option, - pub ok: bool, - pub private_state_sealed: bool, -} - -#[derive(Clone, Debug, PartialEq, Eq, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct EpiphanyServiceExecutionAuditReport { - pub status: String, - pub receipt_count: usize, - pub missing_count: usize, - pub failed_count: usize, - pub private_state_exposed: bool, - pub checks: Vec, -} - -pub fn epiphany_service_execution_audit_report( - receipts: &[EpiphanyCultMeshDaemonServiceLifecycleReceiptEntry], -) -> EpiphanyServiceExecutionAuditReport { - epiphany_service_execution_audit_report_for_expected( - receipts, - &[ - ("windows-service-execution-runbook", &["written"][..]), - ( - "windows-service-execution-readiness", - &["elevated-ready"][..], - ), - ( - "windows-service-install", - &["install-command-succeeded"][..], - ), - ("windows-service-start", &["start-requested"][..]), - ( - "windows-service-status", - &["running", "present", "stopped"][..], - ), - ("windows-service-reconcile", &["in-sync"][..]), - ("windows-service-stop", &["stop-requested"][..]), - ], - ) -} - -pub fn epiphany_cluster_service_execution_audit_report( - receipts: &[EpiphanyCultMeshDaemonServiceLifecycleReceiptEntry], -) -> EpiphanyServiceExecutionAuditReport { - epiphany_service_execution_audit_report_for_expected( - receipts, - &[ - ( - "cluster-windows-service-execution-runbook", - &["written"][..], - ), - ( - "cluster-windows-service-execution-readiness", - &["elevated-ready"][..], - ), - ( - "cluster-windows-service-install", - &["install-command-succeeded"][..], - ), - ("cluster-windows-service-start", &["start-requested"][..]), - ("cluster-windows-service-audit", &["complete"][..]), - ("cluster-windows-service-stop", &["stop-requested"][..]), - ], - ) -} - -fn epiphany_service_execution_audit_report_for_expected( - receipts: &[EpiphanyCultMeshDaemonServiceLifecycleReceiptEntry], - expected: &[(&str, &[&str])], -) -> EpiphanyServiceExecutionAuditReport { - let mut checks = Vec::new(); - let mut missing_count = 0_usize; - let mut failed_count = 0_usize; - let mut private_state_exposed = false; - let mut service_ids = receipts - .iter() - .map(|receipt| receipt.service_id.as_str()) - .collect::>(); - service_ids.sort(); - service_ids.dedup(); - let inferred_service_id = if service_ids.len() == 1 { - Some(service_ids[0].to_string()) - } else { - None - }; - - for (action, allowed_statuses) in expected { - let receipt = latest_lifecycle_receipt_for_action(receipts, action); - let (service_id, receipt_id, observed_status, operator_artifact_ref, ok, sealed) = - match receipt { - Some(receipt) => { - let status_ok = allowed_statuses - .iter() - .any(|allowed| *allowed == receipt.status); - ( - Some(receipt.service_id.clone()), - Some(receipt.receipt_id.clone()), - Some(receipt.status.clone()), - non_empty_operator_artifact_ref(receipt), - status_ok, - !receipt.private_state_exposed, - ) - } - None => { - missing_count += 1; - (inferred_service_id.clone(), None, None, None, false, true) - } - }; - - if !ok { - failed_count += 1; - } - if !sealed { - private_state_exposed = true; - } - - checks.push(EpiphanyServiceExecutionAuditCheck { - service_id, - action: (*action).to_string(), - allowed_statuses: allowed_statuses - .iter() - .map(|status| (*status).to_string()) - .collect(), - receipt_id, - observed_status, - operator_artifact_ref, - ok, - private_state_sealed: sealed, - }); - } - - let status = if missing_count == 0 && failed_count == 0 && !private_state_exposed { - "complete" - } else { - "incomplete" - } - .to_string(); - - EpiphanyServiceExecutionAuditReport { - status, - receipt_count: receipts.len(), - missing_count, - failed_count, - private_state_exposed, - checks, - } -} - -fn non_empty_operator_artifact_ref( - receipt: &EpiphanyCultMeshDaemonServiceLifecycleReceiptEntry, -) -> Option { - let artifact_ref = receipt.operator_artifact_ref.trim(); - if artifact_ref.is_empty() || artifact_ref == "none" { - None - } else { - Some(receipt.operator_artifact_ref.clone()) - } -} - -fn latest_lifecycle_receipt_for_action<'a>( - receipts: &'a [EpiphanyCultMeshDaemonServiceLifecycleReceiptEntry], - action: &str, -) -> Option<&'a EpiphanyCultMeshDaemonServiceLifecycleReceiptEntry> { - receipts - .iter() - .filter(|receipt| receipt.action == action) - .max_by(|left, right| { - lifecycle_receipt_sort_key(left).cmp(&lifecycle_receipt_sort_key(right)) - }) -} - -fn lifecycle_receipt_sort_key( - receipt: &EpiphanyCultMeshDaemonServiceLifecycleReceiptEntry, -) -> (&str, &str) { - ( - receipt - .completed_at_utc - .as_deref() - .unwrap_or(receipt.started_at_utc.as_str()), - receipt.receipt_id.as_str(), - ) -} - #[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)] #[cultcache( type = "epiphany.cultmesh.swarm_brake", @@ -1264,134 +820,6 @@ pub struct EpiphanyCultMeshBifrostGithubPublicationReceiptEntry { pub notes: Vec, } -#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)] -#[cultcache( - type = "gamecult.bifrost.public_proof_publication_receipt", - schema = "EpiphanyCultMeshBifrostPublicProofPublicationReceiptEntry" -)] -pub struct EpiphanyCultMeshBifrostPublicProofPublicationReceiptEntry { - #[cultcache(key = 0)] - pub schema_version: String, - #[cultcache(key = 1)] - pub receipt_id: String, - #[cultcache(key = 2)] - pub public_proof_id: String, - #[cultcache(key = 3)] - pub public_proof_ref: String, - #[cultcache(key = 4)] - pub public_proof_sha256: String, - #[cultcache(key = 5)] - pub item: String, - #[cultcache(key = 6)] - pub source_workspace: String, - #[cultcache(key = 7)] - pub source_branch: String, - #[cultcache(key = 8)] - pub target_public_verse_id: String, - #[cultcache(key = 9)] - pub public_room_id: String, - #[cultcache(key = 10)] - pub status: String, - #[cultcache(key = 11)] - pub bifrost_ledger_entry_id: String, - #[cultcache(key = 12)] - pub credit_receipt_ids: Vec, - #[cultcache(key = 13)] - pub reviewer_ids: Vec, - #[cultcache(key = 14)] - pub publication_url: String, - #[cultcache(key = 15)] - pub private_state_exposed: bool, - #[cultcache(key = 16)] - pub notes: Vec, -} - -#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)] -#[cultcache( - type = "gamecult.bifrost.artifact_acceptance_receipt", - schema = "EpiphanyCultMeshBifrostArtifactAcceptanceReceiptEntry" -)] -pub struct EpiphanyCultMeshBifrostArtifactAcceptanceReceiptEntry { - #[cultcache(key = 0)] - pub schema_version: String, - #[cultcache(key = 1)] - pub receipt_id: String, - #[cultcache(key = 2)] - pub item: String, - #[cultcache(key = 3)] - pub source_workspace: String, - #[cultcache(key = 4)] - pub source_branch: String, - #[cultcache(key = 5)] - pub commit_sha: String, - #[cultcache(key = 6)] - pub changed_paths: Vec, - #[cultcache(key = 7)] - pub artifact_ref: String, - #[cultcache(key = 8)] - pub public_proof_ref: String, - #[cultcache(key = 9)] - pub maintainer_review_receipt_ids: Vec, - #[cultcache(key = 10)] - pub bifrost_ledger_entry_id: String, - #[cultcache(key = 11)] - pub status: String, - #[cultcache(key = 12)] - pub accepted_by: String, - #[cultcache(key = 13)] - pub private_state_exposed: bool, - #[cultcache(key = 14)] - pub notes: Vec, -} - -#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)] -#[cultcache( - type = "gamecult.bifrost.metrics_receipt", - schema = "EpiphanyCultMeshBifrostMetricsReceiptEntry" -)] -pub struct EpiphanyCultMeshBifrostMetricsReceiptEntry { - #[cultcache(key = 0)] - pub schema_version: String, - #[cultcache(key = 1)] - pub receipt_id: String, - #[cultcache(key = 2)] - pub item: String, - #[cultcache(key = 3)] - pub source_workspace: String, - #[cultcache(key = 4)] - pub source_branch: String, - #[cultcache(key = 5)] - pub artifact_acceptance_receipt_id: String, - #[cultcache(key = 6)] - pub model_spend_receipt_ids: Vec, - #[cultcache(key = 7)] - pub review_load_receipt_ids: Vec, - #[cultcache(key = 8)] - pub credit_readback_receipt_ids: Vec, - #[cultcache(key = 9)] - pub public_proof_ref: String, - #[cultcache(key = 10)] - pub metrics_summary: String, - #[cultcache(key = 11)] - pub status: String, - #[cultcache(key = 12)] - pub private_state_exposed: bool, - #[cultcache(key = 13)] - pub notes: Vec, - #[cultcache(key = 14)] - pub token_summary_ref: Option, - #[cultcache(key = 15)] - pub cost_availability_status: Option, - #[cultcache(key = 16)] - pub cost_summary_ref: Option, - #[cultcache(key = 17)] - pub cost_unavailable_reason: Option, - #[cultcache(key = 18)] - pub review_duration_ms: Option, - #[cultcache(key = 19)] - pub review_event_count: Option, -} - #[derive(Clone, Debug, PartialEq, Eq, Serialize)] #[serde(rename_all = "camelCase")] pub struct EpiphanyLocalVerseContext { @@ -1422,10 +850,6 @@ pub struct EpiphanyLocalVerseContext { Option, pub arrival_latest_bifrost_github_publication_receipt: Option, - pub arrival_latest_bifrost_public_proof_publication_receipt: - Option, - pub latest_repo_work_overview: Option, - pub latest_repo_work_map_entry: Option, pub contract_summaries: Vec, } @@ -1442,10 +866,6 @@ pub struct EpiphanyLocalVerseContractSummary { cultmesh_documents!(EpiphanyCultMeshDocuments { EpiphanyCultMeshStatusEntry => EPIPHANY_CULTMESH_STATUS_SCHEMA_VERSION, - EpiphanyCultMeshRepoWorkOverviewEntry => EPIPHANY_CULTMESH_REPO_WORK_OVERVIEW_SCHEMA_VERSION, - EpiphanyCultMeshRepoWorkReadinessEntry => EPIPHANY_CULTMESH_REPO_WORK_READINESS_SCHEMA_VERSION, - EpiphanyCultMeshRepoWorkMapEntry => EPIPHANY_CULTMESH_REPO_WORK_MAP_ENTRY_SCHEMA_VERSION, - EpiphanyCultMeshRepoWorkPublicProofEntry => EPIPHANY_CULTMESH_REPO_WORK_PUBLIC_PROOF_SCHEMA_VERSION, EpiphanyCultMeshClusterTopologyEntry => EPIPHANY_CULTMESH_CLUSTER_TOPOLOGY_SCHEMA_VERSION, EpiphanyCultMeshDaemonStatusEntry => EPIPHANY_CULTMESH_DAEMON_STATUS_SCHEMA_VERSION, EpiphanyCultMeshDaemonHeartbeatEventEntry => EPIPHANY_CULTMESH_DAEMON_HEARTBEAT_EVENT_SCHEMA_VERSION, @@ -1473,9 +893,6 @@ cultmesh_documents!(EpiphanyCultMeshDocuments { EpiphanyCultMeshBifrostBodyChangePublicationIntentEntry => EPIPHANY_CULTMESH_BIFROST_BODY_CHANGE_PUBLICATION_INTENT_SCHEMA_VERSION, EpiphanyCultMeshBifrostBodyChangePublicationReceiptEntry => EPIPHANY_CULTMESH_BIFROST_BODY_CHANGE_PUBLICATION_RECEIPT_SCHEMA_VERSION, EpiphanyCultMeshBifrostGithubPublicationReceiptEntry => EPIPHANY_CULTMESH_BIFROST_GITHUB_PUBLICATION_RECEIPT_SCHEMA_VERSION, - EpiphanyCultMeshBifrostPublicProofPublicationReceiptEntry => EPIPHANY_CULTMESH_BIFROST_PUBLIC_PROOF_PUBLICATION_RECEIPT_SCHEMA_VERSION, - EpiphanyCultMeshBifrostArtifactAcceptanceReceiptEntry => EPIPHANY_CULTMESH_BIFROST_ARTIFACT_ACCEPTANCE_RECEIPT_SCHEMA_VERSION, - EpiphanyCultMeshBifrostMetricsReceiptEntry => EPIPHANY_CULTMESH_BIFROST_METRICS_RECEIPT_SCHEMA_VERSION, crate::persona_feedback_admission::LocalAdmittedPersonaFeedback => crate::persona_feedback_admission::LOCAL_PERSONA_FEEDBACK_SCHEMA_VERSION, EpiphanyCultMeshSemanticProjectionHealthEntry => EPIPHANY_CULTMESH_SEMANTIC_PROJECTION_HEALTH_SCHEMA_VERSION, }); @@ -3039,202 +2456,6 @@ pub fn load_arrival_latest_epiphany_cultmesh_bifrost_github_publication_receipt( node.get(EPIPHANY_CULTMESH_BIFROST_GITHUB_PUBLICATION_RECEIPT_ARRIVAL_LATEST_KEY) } -#[allow(clippy::too_many_arguments)] -#[cfg(test)] -pub fn epiphany_cultmesh_bifrost_public_proof_publication_receipt_for_proof( - receipt_id: impl Into, - proof: &EpiphanyCultMeshRepoWorkPublicProofEntry, - status: impl Into, - target_public_verse_id: impl Into, - public_room_id: impl Into, - bifrost_ledger_entry_id: impl Into, - credit_receipt_ids: Vec, - reviewer_ids: Vec, - publication_url: impl Into, -) -> EpiphanyCultMeshBifrostPublicProofPublicationReceiptEntry { - EpiphanyCultMeshBifrostPublicProofPublicationReceiptEntry { - schema_version: - EPIPHANY_CULTMESH_BIFROST_PUBLIC_PROOF_PUBLICATION_RECEIPT_SCHEMA_VERSION.to_string(), - receipt_id: receipt_id.into(), - public_proof_id: proof.public_proof_id.clone(), - public_proof_ref: proof.public_proof_ref.clone(), - public_proof_sha256: proof.public_proof_sha256.clone(), - item: proof.item.clone(), - source_workspace: proof.workspace.clone(), - source_branch: proof.branch.clone(), - target_public_verse_id: target_public_verse_id.into(), - public_room_id: public_room_id.into(), - status: status.into(), - bifrost_ledger_entry_id: bifrost_ledger_entry_id.into(), - credit_receipt_ids, - reviewer_ids, - publication_url: publication_url.into(), - private_state_exposed: false, - notes: vec![ - "Bifrost public-proof publication receipt binds a redacted repo-work proof bundle to a public Verse room.".to_string(), - "The receipt carries only proof refs, hashes, ledger, review, and credit ids; private worker/operator/agent state remains sealed.".to_string(), - "Downstream consumers may read this closure, but Bifrost owns public publication authority.".to_string(), - ], - } -} - -#[cfg(test)] -pub fn write_epiphany_cultmesh_bifrost_public_proof_publication_receipt( - store_path: impl AsRef, - runtime_id: impl Into, - receipt: EpiphanyCultMeshBifrostPublicProofPublicationReceiptEntry, -) -> Result { - validate_bifrost_public_proof_publication_receipt(&receipt)?; - let mut node = open_epiphany_cultmesh_node(store_path, runtime_id)?; - let receipt_key = - epiphany_cultmesh_bifrost_public_proof_publication_receipt_key(&receipt.receipt_id); - let written = node.put(receipt_key.as_str(), &receipt)?; - node.put( - EPIPHANY_CULTMESH_BIFROST_PUBLIC_PROOF_PUBLICATION_RECEIPT_ARRIVAL_LATEST_KEY, - &written, - )?; - node.flush()?; - Ok(written) -} - -pub fn load_arrival_latest_epiphany_cultmesh_bifrost_public_proof_publication_receipt( - store_path: impl AsRef, - runtime_id: impl Into, -) -> Result> { - let node = open_epiphany_cultmesh_node(store_path, runtime_id)?; - node.get(EPIPHANY_CULTMESH_BIFROST_PUBLIC_PROOF_PUBLICATION_RECEIPT_ARRIVAL_LATEST_KEY) -} - -#[allow(clippy::too_many_arguments)] -#[cfg(test)] -pub fn epiphany_cultmesh_bifrost_artifact_acceptance_receipt_for_map_entry( - receipt_id: impl Into, - map_entry: &EpiphanyCultMeshRepoWorkMapEntry, - artifact_ref: impl Into, - public_proof_ref: impl Into, - maintainer_review_receipt_ids: Vec, - bifrost_ledger_entry_id: impl Into, - status: impl Into, - accepted_by: impl Into, -) -> EpiphanyCultMeshBifrostArtifactAcceptanceReceiptEntry { - EpiphanyCultMeshBifrostArtifactAcceptanceReceiptEntry { - schema_version: EPIPHANY_CULTMESH_BIFROST_ARTIFACT_ACCEPTANCE_RECEIPT_SCHEMA_VERSION - .to_string(), - receipt_id: receipt_id.into(), - item: map_entry.item.clone(), - source_workspace: map_entry.workspace.clone(), - source_branch: map_entry.branch.clone(), - commit_sha: map_entry.commit_sha.clone(), - changed_paths: map_entry.changed_paths.clone(), - artifact_ref: artifact_ref.into(), - public_proof_ref: public_proof_ref.into(), - maintainer_review_receipt_ids, - bifrost_ledger_entry_id: bifrost_ledger_entry_id.into(), - status: status.into(), - accepted_by: accepted_by.into(), - private_state_exposed: false, - notes: vec![ - "Bifrost artifact acceptance receipt closes accepted-artifact accounting for Mind-admitted branch work.".to_string(), - "This receipt carries artifact, review, ledger, commit, and path refs only; private worker/operator/agent state remains sealed.".to_string(), - "Repo-work request cargo may ask for this receipt; Maintainer owns acceptance and Bifrost owns accounting.".to_string(), - ], - } -} - -#[cfg(test)] -pub fn write_epiphany_cultmesh_bifrost_artifact_acceptance_receipt( - store_path: impl AsRef, - runtime_id: impl Into, - receipt: EpiphanyCultMeshBifrostArtifactAcceptanceReceiptEntry, -) -> Result { - validate_bifrost_artifact_acceptance_receipt(&receipt)?; - let mut node = open_epiphany_cultmesh_node(store_path, runtime_id)?; - let receipt_key = - epiphany_cultmesh_bifrost_artifact_acceptance_receipt_key(&receipt.receipt_id); - let written = node.put(receipt_key.as_str(), &receipt)?; - node.put( - EPIPHANY_CULTMESH_BIFROST_ARTIFACT_ACCEPTANCE_RECEIPT_ARRIVAL_LATEST_KEY, - &written, - )?; - node.flush()?; - Ok(written) -} - -pub fn load_arrival_latest_epiphany_cultmesh_bifrost_artifact_acceptance_receipt( - store_path: impl AsRef, - runtime_id: impl Into, -) -> Result> { - let node = open_epiphany_cultmesh_node(store_path, runtime_id)?; - node.get(EPIPHANY_CULTMESH_BIFROST_ARTIFACT_ACCEPTANCE_RECEIPT_ARRIVAL_LATEST_KEY) -} - -#[allow(clippy::too_many_arguments)] -#[cfg(test)] -pub fn epiphany_cultmesh_bifrost_metrics_receipt_for_map_entry( - receipt_id: impl Into, - map_entry: &EpiphanyCultMeshRepoWorkMapEntry, - artifact_acceptance_receipt_id: impl Into, - model_spend_receipt_ids: Vec, - review_load_receipt_ids: Vec, - credit_readback_receipt_ids: Vec, - public_proof_ref: impl Into, - metrics_summary: impl Into, - status: impl Into, -) -> EpiphanyCultMeshBifrostMetricsReceiptEntry { - EpiphanyCultMeshBifrostMetricsReceiptEntry { - schema_version: EPIPHANY_CULTMESH_BIFROST_METRICS_RECEIPT_SCHEMA_VERSION.to_string(), - receipt_id: receipt_id.into(), - item: map_entry.item.clone(), - source_workspace: map_entry.workspace.clone(), - source_branch: map_entry.branch.clone(), - artifact_acceptance_receipt_id: artifact_acceptance_receipt_id.into(), - model_spend_receipt_ids, - review_load_receipt_ids, - credit_readback_receipt_ids, - public_proof_ref: public_proof_ref.into(), - metrics_summary: metrics_summary.into(), - status: status.into(), - private_state_exposed: false, - token_summary_ref: Some("metrics://model-spend/tokens".to_string()), - cost_availability_status: Some("known".to_string()), - cost_summary_ref: Some("metrics://model-spend/cost".to_string()), - cost_unavailable_reason: None, - review_duration_ms: Some(1), - review_event_count: Some(1), - notes: vec![ - "Bifrost metrics receipt closes model-spend, review-load, accepted-artifact, and credit-readback accounting for branch work.".to_string(), - "Metrics are operator-safe refs and summaries, not private worker transcripts or raw model streams.".to_string(), - "Repo-work request cargo may ask for this receipt; Bifrost owns accounting and Maintainer owns review-load evidence.".to_string(), - ], - } -} - -#[cfg(test)] -pub fn write_epiphany_cultmesh_bifrost_metrics_receipt( - store_path: impl AsRef, - runtime_id: impl Into, - receipt: EpiphanyCultMeshBifrostMetricsReceiptEntry, -) -> Result { - validate_bifrost_metrics_receipt(&receipt)?; - let mut node = open_epiphany_cultmesh_node(store_path, runtime_id)?; - let receipt_key = epiphany_cultmesh_bifrost_metrics_receipt_key(&receipt.receipt_id); - let written = node.put(receipt_key.as_str(), &receipt)?; - node.put( - EPIPHANY_CULTMESH_BIFROST_METRICS_RECEIPT_ARRIVAL_LATEST_KEY, - &written, - )?; - node.flush()?; - Ok(written) -} - -pub fn load_arrival_latest_epiphany_cultmesh_bifrost_metrics_receipt( - store_path: impl AsRef, - runtime_id: impl Into, -) -> Result> { - let node = open_epiphany_cultmesh_node(store_path, runtime_id)?; - node.get(EPIPHANY_CULTMESH_BIFROST_METRICS_RECEIPT_ARRIVAL_LATEST_KEY) -} - fn validate_bifrost_body_change_publication_intent( intent: &EpiphanyCultMeshBifrostBodyChangePublicationIntentEntry, ) -> Result<()> { @@ -3350,325 +2571,6 @@ fn validate_bifrost_github_publication_receipt( Ok(()) } -#[cfg(test)] -fn validate_bifrost_public_proof_publication_receipt( - receipt: &EpiphanyCultMeshBifrostPublicProofPublicationReceiptEntry, -) -> Result<()> { - if receipt.schema_version - != EPIPHANY_CULTMESH_BIFROST_PUBLIC_PROOF_PUBLICATION_RECEIPT_SCHEMA_VERSION - { - return Err(anyhow!( - "Bifrost public proof publication receipts require schema version {}", - EPIPHANY_CULTMESH_BIFROST_PUBLIC_PROOF_PUBLICATION_RECEIPT_SCHEMA_VERSION - )); - } - if receipt.private_state_exposed { - return Err(anyhow!( - "Bifrost public proof publication receipts must not expose private state" - )); - } - if receipt.public_proof_id.trim().is_empty() - || receipt.public_proof_ref.trim().is_empty() - || receipt.public_proof_sha256.trim().is_empty() - { - return Err(anyhow!( - "Bifrost public proof publication receipts require proof id, ref, and SHA-256" - )); - } - if receipt.target_public_verse_id != EPIPHANY_CULTMESH_GLOBAL_VERSE_ID { - return Err(anyhow!( - "Bifrost public proof publication receipts must target the global public Verse" - )); - } - if receipt.public_room_id.trim().is_empty() || receipt.publication_url.trim().is_empty() { - return Err(anyhow!( - "Bifrost public proof publication receipts require a public room and publication URL" - )); - } - if receipt.bifrost_ledger_entry_id.trim().is_empty() { - return Err(anyhow!( - "Bifrost public proof publication receipts require a ledger entry" - )); - } - if receipt.credit_receipt_ids.is_empty() { - return Err(anyhow!( - "Bifrost public proof publication receipts require credit receipts" - )); - } - if receipt.reviewer_ids.is_empty() { - return Err(anyhow!( - "Bifrost public proof publication receipts require reviewer receipts" - )); - } - Ok(()) -} - -#[cfg(test)] -fn validate_bifrost_artifact_acceptance_receipt( - receipt: &EpiphanyCultMeshBifrostArtifactAcceptanceReceiptEntry, -) -> Result<()> { - if receipt.schema_version - != EPIPHANY_CULTMESH_BIFROST_ARTIFACT_ACCEPTANCE_RECEIPT_SCHEMA_VERSION - { - return Err(anyhow!( - "Bifrost artifact acceptance receipts require schema version {}", - EPIPHANY_CULTMESH_BIFROST_ARTIFACT_ACCEPTANCE_RECEIPT_SCHEMA_VERSION - )); - } - if receipt.private_state_exposed { - return Err(anyhow!( - "Bifrost artifact acceptance receipts must not expose private state" - )); - } - if receipt.item.trim().is_empty() { - return Err(anyhow!( - "Bifrost artifact acceptance receipts require an item" - )); - } - if receipt.artifact_ref.trim().is_empty() { - return Err(anyhow!( - "Bifrost artifact acceptance receipts require an artifact ref" - )); - } - if receipt.public_proof_ref.trim().is_empty() { - return Err(anyhow!( - "Bifrost artifact acceptance receipts require a public proof ref" - )); - } - if receipt.commit_sha.trim().is_empty() || receipt.commit_sha == "none" { - return Err(anyhow!( - "Bifrost artifact acceptance receipts require a commit SHA" - )); - } - if receipt.changed_paths.is_empty() { - return Err(anyhow!( - "Bifrost artifact acceptance receipts require changed paths" - )); - } - if receipt.maintainer_review_receipt_ids.is_empty() { - return Err(anyhow!( - "Bifrost artifact acceptance receipts require maintainer review receipts" - )); - } - if receipt.bifrost_ledger_entry_id.trim().is_empty() { - return Err(anyhow!( - "Bifrost artifact acceptance receipts require a ledger entry" - )); - } - if receipt.accepted_by.trim().is_empty() { - return Err(anyhow!( - "Bifrost artifact acceptance receipts require an accepted-by authority" - )); - } - Ok(()) -} - -#[cfg(test)] -fn validate_bifrost_metrics_receipt( - receipt: &EpiphanyCultMeshBifrostMetricsReceiptEntry, -) -> Result<()> { - if receipt.schema_version != EPIPHANY_CULTMESH_BIFROST_METRICS_RECEIPT_SCHEMA_VERSION { - return Err(anyhow!( - "Bifrost metrics receipts require schema version {}", - EPIPHANY_CULTMESH_BIFROST_METRICS_RECEIPT_SCHEMA_VERSION - )); - } - if receipt.private_state_exposed { - return Err(anyhow!( - "Bifrost metrics receipts must not expose private state" - )); - } - if receipt.item.trim().is_empty() { - return Err(anyhow!("Bifrost metrics receipts require an item")); - } - if receipt.artifact_acceptance_receipt_id.trim().is_empty() { - return Err(anyhow!( - "Bifrost metrics receipts require an artifact acceptance receipt" - )); - } - if receipt.model_spend_receipt_ids.is_empty() { - return Err(anyhow!( - "Bifrost metrics receipts require model spend receipts" - )); - } - if receipt.review_load_receipt_ids.is_empty() { - return Err(anyhow!( - "Bifrost metrics receipts require review load receipts" - )); - } - if receipt.credit_readback_receipt_ids.is_empty() { - return Err(anyhow!( - "Bifrost metrics receipts require credit readback receipts" - )); - } - if receipt.public_proof_ref.trim().is_empty() { - return Err(anyhow!( - "Bifrost metrics receipts require a public proof ref" - )); - } - if receipt.metrics_summary.trim().is_empty() { - return Err(anyhow!( - "Bifrost metrics receipts require a metrics summary" - )); - } - if receipt - .token_summary_ref - .as_deref() - .unwrap_or_default() - .trim() - .is_empty() - { - return Err(anyhow!( - "Bifrost metrics receipts require a token summary ref" - )); - } - match receipt.cost_availability_status.as_deref() { - Some("known") - if receipt - .cost_summary_ref - .as_deref() - .unwrap_or_default() - .trim() - .is_empty() => - { - return Err(anyhow!("known metric cost requires a cost summary ref")); - } - Some("unavailable") - if receipt - .cost_unavailable_reason - .as_deref() - .unwrap_or_default() - .trim() - .is_empty() => - { - return Err(anyhow!("unavailable metric cost requires a reason")); - } - Some("known" | "unavailable") => {} - _ => { - return Err(anyhow!( - "metric cost availability must be known or unavailable" - )); - } - } - if receipt.review_duration_ms.unwrap_or_default() == 0 { - return Err(anyhow!("Bifrost metrics receipts require review duration")); - } - if receipt.review_event_count.unwrap_or_default() == 0 { - return Err(anyhow!( - "Bifrost metrics receipts require review event count" - )); - } - Ok(()) -} - -pub fn load_latest_epiphany_cultmesh_repo_work_overview( - store_path: impl AsRef, - runtime_id: impl Into, -) -> Result> { - let node = open_epiphany_cultmesh_node(store_path, runtime_id)?; - node.get(EPIPHANY_CULTMESH_REPO_WORK_OVERVIEW_LATEST_KEY) -} - -pub fn load_epiphany_cultmesh_repo_work_overviews( - store_path: impl AsRef, - runtime_id: impl Into, -) -> Result> { - let node = open_epiphany_cultmesh_node(store_path, runtime_id)?; - let mut overviews = node - .get_all_with_keys::()? - .into_iter() - .filter(|(key, _)| key != EPIPHANY_CULTMESH_REPO_WORK_OVERVIEW_LATEST_KEY) - .map(|(_, overview)| overview) - .collect::>(); - overviews.sort_by(|a, b| { - b.generated_at - .cmp(&a.generated_at) - .then_with(|| a.overview_id.cmp(&b.overview_id)) - }); - Ok(overviews) -} - -pub fn load_latest_epiphany_cultmesh_repo_work_readiness( - store_path: impl AsRef, - runtime_id: impl Into, -) -> Result> { - let node = open_epiphany_cultmesh_node(store_path, runtime_id)?; - node.get(EPIPHANY_CULTMESH_REPO_WORK_READINESS_LATEST_KEY) -} - -pub fn load_epiphany_cultmesh_repo_work_readiness_reports( - store_path: impl AsRef, - runtime_id: impl Into, -) -> Result> { - let node = open_epiphany_cultmesh_node(store_path, runtime_id)?; - let mut reports = node - .get_all_with_keys::()? - .into_iter() - .filter(|(key, _)| key != EPIPHANY_CULTMESH_REPO_WORK_READINESS_LATEST_KEY) - .map(|(_, report)| report) - .collect::>(); - reports.sort_by(|a, b| { - b.generated_at - .cmp(&a.generated_at) - .then_with(|| a.readiness_id.cmp(&b.readiness_id)) - }); - Ok(reports) -} - -pub fn load_latest_epiphany_cultmesh_repo_work_map_entry( - store_path: impl AsRef, - runtime_id: impl Into, -) -> Result> { - let node = open_epiphany_cultmesh_node(store_path, runtime_id)?; - node.get(EPIPHANY_CULTMESH_REPO_WORK_MAP_ENTRY_LATEST_KEY) -} - -pub fn load_epiphany_cultmesh_repo_work_map_entries( - store_path: impl AsRef, - runtime_id: impl Into, -) -> Result> { - let node = open_epiphany_cultmesh_node(store_path, runtime_id)?; - let mut entries = node - .get_all_with_keys::()? - .into_iter() - .filter(|(key, _)| key != EPIPHANY_CULTMESH_REPO_WORK_MAP_ENTRY_LATEST_KEY) - .map(|(_, entry)| entry) - .collect::>(); - entries.sort_by(|a, b| { - b.admitted_at - .cmp(&a.admitted_at) - .then_with(|| a.map_entry_id.cmp(&b.map_entry_id)) - }); - Ok(entries) -} - -pub fn load_latest_epiphany_cultmesh_repo_work_public_proof( - store_path: impl AsRef, - runtime_id: impl Into, -) -> Result> { - let node = open_epiphany_cultmesh_node(store_path, runtime_id)?; - node.get(EPIPHANY_CULTMESH_REPO_WORK_PUBLIC_PROOF_LATEST_KEY) -} - -pub fn load_epiphany_cultmesh_repo_work_public_proofs( - store_path: impl AsRef, - runtime_id: impl Into, -) -> Result> { - let node = open_epiphany_cultmesh_node(store_path, runtime_id)?; - let mut proofs = node - .get_all_with_keys::()? - .into_iter() - .filter(|(key, _)| key != EPIPHANY_CULTMESH_REPO_WORK_PUBLIC_PROOF_LATEST_KEY) - .map(|(_, proof)| proof) - .collect::>(); - proofs.sort_by(|a, b| { - b.generated_at - .cmp(&a.generated_at) - .then_with(|| a.public_proof_id.cmp(&b.public_proof_id)) - }); - Ok(proofs) -} - pub fn seed_epiphany_local_verse_context( store_path: impl AsRef, runtime_id: impl Into, @@ -3817,10 +2719,6 @@ pub fn query_epiphany_local_verse_context( .get(EPIPHANY_CULTMESH_BIFROST_BODY_CHANGE_PUBLICATION_RECEIPT_ARRIVAL_LATEST_KEY)?, arrival_latest_bifrost_github_publication_receipt: node .get(EPIPHANY_CULTMESH_BIFROST_GITHUB_PUBLICATION_RECEIPT_ARRIVAL_LATEST_KEY)?, - arrival_latest_bifrost_public_proof_publication_receipt: node - .get(EPIPHANY_CULTMESH_BIFROST_PUBLIC_PROOF_PUBLICATION_RECEIPT_ARRIVAL_LATEST_KEY)?, - latest_repo_work_overview: node.get(EPIPHANY_CULTMESH_REPO_WORK_OVERVIEW_LATEST_KEY)?, - latest_repo_work_map_entry: node.get(EPIPHANY_CULTMESH_REPO_WORK_MAP_ENTRY_LATEST_KEY)?, contract_summaries, }) } @@ -3980,21 +2878,6 @@ fn epiphany_cultmesh_bifrost_github_publication_receipt_key(receipt_id: &str) -> format!("gamecult-local/bifrost/github-publication-receipt/{receipt_id}") } -#[cfg(test)] -fn epiphany_cultmesh_bifrost_public_proof_publication_receipt_key(receipt_id: &str) -> String { - format!("gamecult-local/bifrost/public-proof-publication-receipt/{receipt_id}") -} - -#[cfg(test)] -fn epiphany_cultmesh_bifrost_artifact_acceptance_receipt_key(receipt_id: &str) -> String { - format!("gamecult-local/bifrost/artifact-acceptance-receipt/{receipt_id}") -} - -#[cfg(test)] -fn epiphany_cultmesh_bifrost_metrics_receipt_key(receipt_id: &str) -> String { - format!("gamecult-local/bifrost/metrics-receipt/{receipt_id}") -} - pub fn epiphany_verse_policies() -> Vec { vec![ EpiphanyVersePolicy { @@ -4483,36 +3366,6 @@ pub fn epiphany_cultmesh_bifrost_contracts() -> Vec Result<()> { - let report = epiphany_service_execution_audit_report(&[ - EpiphanyCultMeshDaemonServiceLifecycleReceiptEntry { - schema_version: EPIPHANY_CULTMESH_DAEMON_SERVICE_LIFECYCLE_RECEIPT_SCHEMA_VERSION - .to_string(), - receipt_id: "service-execution-runbook-receipt".to_string(), - service_id: "epiphany-daemon-supervisor-service".to_string(), - scheduler_id: "epiphany-daemon-supervisor".to_string(), - runtime_id: "epiphany-test".to_string(), - daemon_selector: "epiphany-daemon-supervisor".to_string(), - action: "windows-service-execution-runbook".to_string(), - status: "written".to_string(), - command: "epiphany-daemon-supervisor".to_string(), - args: vec!["windows-service-execution-runbook".to_string()], - cwd: Some("E:/Projects/EpiphanyAgent".to_string()), - process_id: None, - exit_code: Some(0), - started_at_utc: "2026-06-18T00:00:00Z".to_string(), - completed_at_utc: Some("2026-06-18T00:00:01Z".to_string()), - operator_artifact_ref: "E:/Projects/EpiphanyAgent/.epiphany-run/runbook.ps1" - .to_string(), - private_state_exposed: false, - notes: Vec::new(), - executable_sha256: String::new(), - preflight_witness_id: String::new(), - required_document_types: Vec::new(), - schema_preflight_passed: false, - schema_catalog_sha256: String::new(), - managed_policy_id: String::new(), - managed_policy_digest: String::new(), - provider_daemon_id: String::new(), - startup_correlation_id: String::new(), - process_creation_token: 0, - process_created_at_rfc3339: None, - process_executable_path: String::new(), - }, - ]); - let runbook_check = report - .checks - .iter() - .find(|check| check.action == "windows-service-execution-runbook") - .context("missing runbook audit check")?; - assert!(runbook_check.ok); - assert_eq!( - runbook_check.operator_artifact_ref.as_deref(), - Some("E:/Projects/EpiphanyAgent/.epiphany-run/runbook.ps1") - ); - Ok(()) - } - #[test] fn cluster_topology_names_private_verses_body_daemons_and_eve_surfaces() -> Result<()> { let temp = tempfile::tempdir()?; @@ -6143,144 +4945,6 @@ mod tests { Ok(()) } - #[test] - fn bifrost_public_proof_publication_receipt_round_trips() -> Result<()> { - let temp = tempfile::tempdir()?; - let store = temp - .path() - .join("epiphany-bifrost-public-proof-publication.ccmp"); - let proof = EpiphanyCultMeshRepoWorkPublicProofEntry { - schema_version: EPIPHANY_CULTMESH_REPO_WORK_PUBLIC_PROOF_SCHEMA_VERSION.to_string(), - runtime_id: "epiphany-test".to_string(), - verse_id: EPIPHANY_CULTMESH_LOCAL_AREA_VERSE_ID.to_string(), - public_proof_id: "repo-work-public-proof-test".to_string(), - generated_at: "2026-06-20T12:00:00Z".to_string(), - workspace: "E:/Projects/EpiphanyAgent".to_string(), - item: "test-item".to_string(), - branch: "codex/test-item".to_string(), - current_gate: "awaiting-publication".to_string(), - blocker: "bifrost-publication-missing".to_string(), - next_safe_move: "publish-redacted-proof".to_string(), - changed_paths: vec!["notes/test.md".to_string()], - commit_sha: "abc123".to_string(), - soul_verdict: "passed".to_string(), - upstream_main_synced: true, - artifact_row_count: 3, - publication_row_count: 5, - public_proof_ref: "public-proof.json".to_string(), - public_proof_sha256: "0123456789abcdef".to_string(), - tui_rows: vec!["proof row".to_string()], - private_state_exposed: false, - notes: vec!["redacted proof".to_string()], - }; - let receipt = epiphany_cultmesh_bifrost_public_proof_publication_receipt_for_proof( - "bifrost-public-proof-publication-test", - &proof, - "published-to-public-verse", - EPIPHANY_CULTMESH_GLOBAL_VERSE_ID, - "epiphany-global/repo-work/public-proofs", - "bifrost-ledger-public-proof-test", - vec!["credit-receipt-test".to_string()], - vec!["maintainer-review-test".to_string()], - "cultmesh://epiphany-global/repo-work/public-proofs/repo-work-public-proof-test", - ); - - write_epiphany_cultmesh_bifrost_public_proof_publication_receipt( - &store, - "epiphany-test", - receipt.clone(), - )?; - - assert_eq!( - load_arrival_latest_epiphany_cultmesh_bifrost_public_proof_publication_receipt( - &store, - "epiphany-test" - )?, - Some(receipt.clone()) - ); - assert_eq!(receipt.public_proof_id, proof.public_proof_id); - assert_eq!(receipt.public_proof_sha256, proof.public_proof_sha256); - assert_eq!( - receipt.target_public_verse_id, - EPIPHANY_CULTMESH_GLOBAL_VERSE_ID - ); - assert_eq!(receipt.credit_receipt_ids, vec!["credit-receipt-test"]); - assert_eq!(receipt.reviewer_ids, vec!["maintainer-review-test"]); - assert!(!receipt.private_state_exposed); - Ok(()) - } - - #[test] - fn bifrost_public_proof_publication_refuses_private_or_wrong_verse() -> Result<()> { - let temp = tempfile::tempdir()?; - let store = temp - .path() - .join("epiphany-bifrost-public-proof-publication-refusal.ccmp"); - let proof = EpiphanyCultMeshRepoWorkPublicProofEntry { - schema_version: EPIPHANY_CULTMESH_REPO_WORK_PUBLIC_PROOF_SCHEMA_VERSION.to_string(), - runtime_id: "epiphany-test".to_string(), - verse_id: EPIPHANY_CULTMESH_LOCAL_AREA_VERSE_ID.to_string(), - public_proof_id: "repo-work-public-proof-test".to_string(), - generated_at: "2026-06-20T12:00:00Z".to_string(), - workspace: "E:/Projects/EpiphanyAgent".to_string(), - item: "test-item".to_string(), - branch: "codex/test-item".to_string(), - current_gate: "awaiting-publication".to_string(), - blocker: "bifrost-publication-missing".to_string(), - next_safe_move: "publish-redacted-proof".to_string(), - changed_paths: vec!["notes/test.md".to_string()], - commit_sha: "abc123".to_string(), - soul_verdict: "passed".to_string(), - upstream_main_synced: true, - artifact_row_count: 3, - publication_row_count: 5, - public_proof_ref: "public-proof.json".to_string(), - public_proof_sha256: "0123456789abcdef".to_string(), - tui_rows: vec!["proof row".to_string()], - private_state_exposed: false, - notes: vec!["redacted proof".to_string()], - }; - let mut receipt = epiphany_cultmesh_bifrost_public_proof_publication_receipt_for_proof( - "bifrost-public-proof-publication-private-test", - &proof, - "published-to-public-verse", - EPIPHANY_CULTMESH_GLOBAL_VERSE_ID, - "epiphany-global/repo-work/public-proofs", - "bifrost-ledger-public-proof-test", - vec!["credit-receipt-test".to_string()], - vec!["maintainer-review-test".to_string()], - "cultmesh://epiphany-global/repo-work/public-proofs/repo-work-public-proof-test", - ); - receipt.private_state_exposed = true; - let error = write_epiphany_cultmesh_bifrost_public_proof_publication_receipt( - &store, - "epiphany-test", - receipt, - ) - .expect_err("private proof publication receipts must be refused"); - assert!(error.to_string().contains("must not expose private state")); - - let wrong_verse = epiphany_cultmesh_bifrost_public_proof_publication_receipt_for_proof( - "bifrost-public-proof-publication-wrong-verse-test", - &proof, - "published-to-public-verse", - EPIPHANY_CULTMESH_LOCAL_AREA_VERSE_ID, - "gamecult-local/repo-work/public-proofs", - "bifrost-ledger-public-proof-test", - vec!["credit-receipt-test".to_string()], - vec!["maintainer-review-test".to_string()], - "cultmesh://gamecult-local/repo-work/public-proofs/repo-work-public-proof-test", - ); - let error = write_epiphany_cultmesh_bifrost_public_proof_publication_receipt( - &store, - "epiphany-test", - wrong_verse, - ) - .expect_err("non-public Verse proof publication receipts must be refused"); - assert!(error.to_string().contains("global public Verse")); - Ok(()) - } - #[test] fn local_verse_bootstrap_does_not_publish_provider_owned_state() -> Result<()> { let temp = tempfile::tempdir()?; @@ -6333,7 +4997,7 @@ mod tests { let temp = tempfile::tempdir()?; let store = temp.path().join("epiphany-bifrost-contracts.ccmp"); let written = write_epiphany_cultmesh_bifrost_contracts(&store, "epiphany-test")?; - assert_eq!(written.len(), 2); + assert_eq!(written.len(), 1); let node = open_epiphany_cultmesh_node(&store, "epiphany-test")?; let publication = node.get_required::( @@ -6345,10 +5009,6 @@ mod tests { )? .is_none() ); - let public_proof = node.get_required::( - "gamecult.bifrost.public_proof.publication", - )?; - assert_eq!(publication.verse_id, EPIPHANY_CULTMESH_LOCAL_AREA_VERSE_ID); assert_eq!(publication.authority, "bifrost"); assert!( @@ -6369,24 +5029,6 @@ mod tests { .iter() .any(|note| note.contains("GitHub publication")) ); - assert_eq!(public_proof.authority, "bifrost"); - assert_eq!( - public_proof.document_type, - EPIPHANY_CULTMESH_BIFROST_PUBLIC_PROOF_PUBLICATION_RECEIPT_TYPE - ); - assert!( - public_proof - .intent_document_types - .iter() - .any(|intent| intent == EPIPHANY_CULTMESH_REPO_WORK_PUBLIC_PROOF_TYPE) - ); - assert!( - public_proof - .receipt_document_types - .iter() - .any(|receipt| receipt - == EPIPHANY_CULTMESH_BIFROST_PUBLIC_PROOF_PUBLICATION_RECEIPT_TYPE) - ); Ok(()) } diff --git a/epiphany-core/src/lib.rs b/epiphany-core/src/lib.rs index 85429523..098f8a4a 100644 --- a/epiphany-core/src/lib.rs +++ b/epiphany-core/src/lib.rs @@ -132,9 +132,6 @@ pub use cultcache_rs::RedbMessagePackBackingStore; pub use cultcache_rs::SingleFileMessagePackBackingStore; pub use cultmesh_integration::EPIPHANY_CANONICAL_SWARM_BRAKE_ID; pub use cultmesh_integration::EPIPHANY_CANONICAL_SWARM_BRAKE_OWNER; -pub use cultmesh_integration::EPIPHANY_CULTMESH_BIFROST_ARTIFACT_ACCEPTANCE_RECEIPT_ARRIVAL_LATEST_KEY; -pub use cultmesh_integration::EPIPHANY_CULTMESH_BIFROST_ARTIFACT_ACCEPTANCE_RECEIPT_SCHEMA_VERSION; -pub use cultmesh_integration::EPIPHANY_CULTMESH_BIFROST_ARTIFACT_ACCEPTANCE_RECEIPT_TYPE; pub use cultmesh_integration::EPIPHANY_CULTMESH_BIFROST_BODY_CHANGE_PUBLICATION_INTENT_ARRIVAL_LATEST_KEY; pub use cultmesh_integration::EPIPHANY_CULTMESH_BIFROST_BODY_CHANGE_PUBLICATION_INTENT_SCHEMA_VERSION; pub use cultmesh_integration::EPIPHANY_CULTMESH_BIFROST_BODY_CHANGE_PUBLICATION_INTENT_TYPE; @@ -146,9 +143,6 @@ pub use cultmesh_integration::EPIPHANY_CULTMESH_BIFROST_CONTRACT_TYPE; pub use cultmesh_integration::EPIPHANY_CULTMESH_BIFROST_GITHUB_PUBLICATION_RECEIPT_ARRIVAL_LATEST_KEY; pub use cultmesh_integration::EPIPHANY_CULTMESH_BIFROST_GITHUB_PUBLICATION_RECEIPT_SCHEMA_VERSION; pub use cultmesh_integration::EPIPHANY_CULTMESH_BIFROST_GITHUB_PUBLICATION_RECEIPT_TYPE; -pub use cultmesh_integration::EPIPHANY_CULTMESH_BIFROST_METRICS_RECEIPT_ARRIVAL_LATEST_KEY; -pub use cultmesh_integration::EPIPHANY_CULTMESH_BIFROST_METRICS_RECEIPT_SCHEMA_VERSION; -pub use cultmesh_integration::EPIPHANY_CULTMESH_BIFROST_METRICS_RECEIPT_TYPE; pub use cultmesh_integration::EPIPHANY_CULTMESH_DAEMON_HEARTBEAT_EVENT_SCHEMA_VERSION; pub use cultmesh_integration::EPIPHANY_CULTMESH_DAEMON_HEARTBEAT_EVENT_TYPE; pub use cultmesh_integration::EPIPHANY_CULTMESH_DAEMON_POKE_INTENT_LATEST_KEY; @@ -175,18 +169,6 @@ pub use cultmesh_integration::EPIPHANY_CULTMESH_LOCAL_AREA_TIER; pub use cultmesh_integration::EPIPHANY_CULTMESH_LOCAL_AREA_VERSE_ID; pub use cultmesh_integration::EPIPHANY_CULTMESH_MANAGED_SERVICE_POLICY_SCHEMA_VERSION; pub use cultmesh_integration::EPIPHANY_CULTMESH_MANAGED_SERVICE_POLICY_TYPE; -pub use cultmesh_integration::EPIPHANY_CULTMESH_REPO_WORK_MAP_ENTRY_LATEST_KEY; -pub use cultmesh_integration::EPIPHANY_CULTMESH_REPO_WORK_MAP_ENTRY_SCHEMA_VERSION; -pub use cultmesh_integration::EPIPHANY_CULTMESH_REPO_WORK_MAP_ENTRY_TYPE; -pub use cultmesh_integration::EPIPHANY_CULTMESH_REPO_WORK_OVERVIEW_LATEST_KEY; -pub use cultmesh_integration::EPIPHANY_CULTMESH_REPO_WORK_OVERVIEW_SCHEMA_VERSION; -pub use cultmesh_integration::EPIPHANY_CULTMESH_REPO_WORK_OVERVIEW_TYPE; -pub use cultmesh_integration::EPIPHANY_CULTMESH_REPO_WORK_PUBLIC_PROOF_LATEST_KEY; -pub use cultmesh_integration::EPIPHANY_CULTMESH_REPO_WORK_PUBLIC_PROOF_SCHEMA_VERSION; -pub use cultmesh_integration::EPIPHANY_CULTMESH_REPO_WORK_PUBLIC_PROOF_TYPE; -pub use cultmesh_integration::EPIPHANY_CULTMESH_REPO_WORK_READINESS_LATEST_KEY; -pub use cultmesh_integration::EPIPHANY_CULTMESH_REPO_WORK_READINESS_SCHEMA_VERSION; -pub use cultmesh_integration::EPIPHANY_CULTMESH_REPO_WORK_READINESS_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; @@ -197,13 +179,10 @@ pub use cultmesh_integration::EPIPHANY_CULTMESH_SWARM_BRAKE_SCHEMA_VERSION; pub use cultmesh_integration::EPIPHANY_CULTMESH_SWARM_BRAKE_TYPE; pub use cultmesh_integration::EPIPHANY_WORKSPACE_COVERAGE_PROJECTOR_DAEMON_ID; pub use cultmesh_integration::EPIPHANY_WORKSPACE_COVERAGE_PROJECTOR_SERVICE_ID; -pub use cultmesh_integration::EpiphanyCultMeshBifrostArtifactAcceptanceReceiptEntry; pub use cultmesh_integration::EpiphanyCultMeshBifrostBodyChangePublicationIntentEntry; pub use cultmesh_integration::EpiphanyCultMeshBifrostBodyChangePublicationReceiptEntry; pub use cultmesh_integration::EpiphanyCultMeshBifrostContractEntry; pub use cultmesh_integration::EpiphanyCultMeshBifrostGithubPublicationReceiptEntry; -pub use cultmesh_integration::EpiphanyCultMeshBifrostMetricsReceiptEntry; -pub use cultmesh_integration::EpiphanyCultMeshBifrostPublicProofPublicationReceiptEntry; pub use cultmesh_integration::EpiphanyCultMeshClusterTopologyEntry; pub use cultmesh_integration::EpiphanyCultMeshDaemonHeartbeatEventEntry; pub use cultmesh_integration::EpiphanyCultMeshDaemonPokeIntentEntry; @@ -216,48 +195,31 @@ pub use cultmesh_integration::EpiphanyCultMeshDocuments; pub use cultmesh_integration::EpiphanyCultMeshIdunnAftercareAuditReceiptEntry; pub use cultmesh_integration::EpiphanyCultMeshIdunnDeploymentReceiptEntry; pub use cultmesh_integration::EpiphanyCultMeshManagedServicePolicyEntry; -pub use cultmesh_integration::EpiphanyCultMeshRepoWorkMapEntry; -pub use cultmesh_integration::EpiphanyCultMeshRepoWorkOverviewEntry; -pub use cultmesh_integration::EpiphanyCultMeshRepoWorkPublicProofEntry; -pub use cultmesh_integration::EpiphanyCultMeshRepoWorkReadinessEntry; 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; pub use cultmesh_integration::EpiphanyLocalVerseContractSummary; -pub use cultmesh_integration::EpiphanyServiceExecutionAuditCheck; -pub use cultmesh_integration::EpiphanyServiceExecutionAuditReport; pub use cultmesh_integration::EpiphanyVersePolicy; pub use cultmesh_integration::authenticate_epiphany_cultmesh_semantic_projector_launch; pub use cultmesh_integration::canonical_epiphany_swarm_brake_protected_surfaces; pub use cultmesh_integration::default_epiphany_cultmesh_swarm_brake; pub use cultmesh_integration::engage_epiphany_cultmesh_swarm_brake; -pub use cultmesh_integration::epiphany_cluster_service_execution_audit_report; -#[cfg(test)] -pub use cultmesh_integration::epiphany_cultmesh_bifrost_artifact_acceptance_receipt_for_map_entry; pub use cultmesh_integration::epiphany_cultmesh_bifrost_body_change_publication_intent; #[cfg(test)] pub use cultmesh_integration::epiphany_cultmesh_bifrost_body_change_publication_receipt_for_intent; pub use cultmesh_integration::epiphany_cultmesh_bifrost_contracts; #[cfg(test)] pub use cultmesh_integration::epiphany_cultmesh_bifrost_github_publication_receipt_for_publication; -#[cfg(test)] -pub use cultmesh_integration::epiphany_cultmesh_bifrost_metrics_receipt_for_map_entry; -#[cfg(test)] -pub use cultmesh_integration::epiphany_cultmesh_bifrost_public_proof_publication_receipt_for_proof; pub use cultmesh_integration::epiphany_cultmesh_daemon_poke_intent_from_status; pub use cultmesh_integration::epiphany_cultmesh_daemon_poke_receipt_for_intent; pub use cultmesh_integration::epiphany_global_room_policies; -pub use cultmesh_integration::epiphany_service_execution_audit_report; pub use cultmesh_integration::epiphany_verse_policies; pub use cultmesh_integration::idunn_recover_memory_semantic_projection_from_cultmesh; -pub use cultmesh_integration::load_arrival_latest_epiphany_cultmesh_bifrost_artifact_acceptance_receipt; pub use cultmesh_integration::load_arrival_latest_epiphany_cultmesh_bifrost_body_change_publication_intent; pub use cultmesh_integration::load_arrival_latest_epiphany_cultmesh_bifrost_body_change_publication_receipt; pub use cultmesh_integration::load_arrival_latest_epiphany_cultmesh_bifrost_github_publication_receipt; -pub use cultmesh_integration::load_arrival_latest_epiphany_cultmesh_bifrost_metrics_receipt; -pub use cultmesh_integration::load_arrival_latest_epiphany_cultmesh_bifrost_public_proof_publication_receipt; pub use cultmesh_integration::load_epiphany_cultmesh_cluster_topology; pub use cultmesh_integration::load_epiphany_cultmesh_daemon_heartbeat_event; pub use cultmesh_integration::load_epiphany_cultmesh_daemon_liveness; @@ -273,10 +235,6 @@ pub use cultmesh_integration::load_epiphany_cultmesh_idunn_deployment_receipt; 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_repo_work_map_entries; -pub use cultmesh_integration::load_epiphany_cultmesh_repo_work_overviews; -pub use cultmesh_integration::load_epiphany_cultmesh_repo_work_public_proofs; -pub use cultmesh_integration::load_epiphany_cultmesh_repo_work_readiness_reports; 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; @@ -288,27 +246,17 @@ pub use cultmesh_integration::load_latest_epiphany_cultmesh_daemon_service_lifec pub use cultmesh_integration::load_latest_epiphany_cultmesh_daemon_service_lifecycle_receipt_for_service; pub use cultmesh_integration::load_latest_epiphany_cultmesh_idunn_aftercare_audit_receipt; pub use cultmesh_integration::load_latest_epiphany_cultmesh_idunn_deployment_receipt; -pub use cultmesh_integration::load_latest_epiphany_cultmesh_repo_work_map_entry; -pub use cultmesh_integration::load_latest_epiphany_cultmesh_repo_work_overview; -pub use cultmesh_integration::load_latest_epiphany_cultmesh_repo_work_public_proof; -pub use cultmesh_integration::load_latest_epiphany_cultmesh_repo_work_readiness; pub use cultmesh_integration::open_epiphany_cultmesh_node; pub use cultmesh_integration::publish_epiphany_cultmesh_semantic_projection_health; pub use cultmesh_integration::query_epiphany_local_verse_context; pub use cultmesh_integration::release_epiphany_cultmesh_swarm_brake; pub use cultmesh_integration::seed_epiphany_local_verse_context; -#[cfg(test)] -pub use cultmesh_integration::write_epiphany_cultmesh_bifrost_artifact_acceptance_receipt; pub use cultmesh_integration::write_epiphany_cultmesh_bifrost_body_change_publication_intent; #[cfg(test)] pub use cultmesh_integration::write_epiphany_cultmesh_bifrost_body_change_publication_receipt; pub use cultmesh_integration::write_epiphany_cultmesh_bifrost_contracts; #[cfg(test)] pub use cultmesh_integration::write_epiphany_cultmesh_bifrost_github_publication_receipt; -#[cfg(test)] -pub use cultmesh_integration::write_epiphany_cultmesh_bifrost_metrics_receipt; -#[cfg(test)] -pub use cultmesh_integration::write_epiphany_cultmesh_bifrost_public_proof_publication_receipt; pub use cultmesh_integration::write_epiphany_cultmesh_daemon_heartbeat_event; pub use cultmesh_integration::write_epiphany_cultmesh_daemon_poke_intent; pub use cultmesh_integration::write_epiphany_cultmesh_daemon_poke_receipt;