diff --git a/epiphany-core/src/bin/epiphany-verse-query.rs b/epiphany-core/src/bin/epiphany-verse-query.rs index 9c5ae071..7243bc15 100644 --- a/epiphany-core/src/bin/epiphany-verse-query.rs +++ b/epiphany-core/src/bin/epiphany-verse-query.rs @@ -91,7 +91,6 @@ use epiphany_core::write_epiphany_cultmesh_bifrost_collaboration_feedback; use epiphany_core::write_epiphany_cultmesh_daemon_poke_intent; use epiphany_core::write_epiphany_cultmesh_daemon_poke_receipt; use epiphany_core::write_epiphany_cultmesh_daemon_restart_policy; -use epiphany_core::write_epiphany_cultmesh_daemon_service_lifecycle_receipt; use epiphany_core::write_epiphany_cultmesh_daemon_status; use epiphany_core::write_epiphany_cultmesh_daemon_tool_invocation_intent; use epiphany_core::write_epiphany_cultmesh_eve_connection_intent; @@ -2690,551 +2689,6 @@ fn run_cli() -> Result<()> { anyhow::bail!("local Verse query smoke lost compact receipt directory readback"); } let service_smoke_started_at = Utc::now().to_rfc3339(); - let service_smoke_runbook_path = args - .store - .with_file_name("epiphany-cluster-daemon-services-execution-runbook-smoke.ps1"); - let service_smoke_single_runbook_path = args - .store - .with_file_name("epiphany-daemon-supervisor-service-execution-runbook-smoke.ps1"); - if let Some(parent) = service_smoke_runbook_path.parent() { - fs::create_dir_all(parent).with_context(|| { - format!( - "failed to create service smoke artifact dir {}", - parent.display() - ) - })?; - } - fs::write( - &service_smoke_runbook_path, - "# synthetic service execution runbook smoke artifact\n", - ) - .with_context(|| { - format!( - "failed to write service smoke runbook artifact {}", - service_smoke_runbook_path.display() - ) - })?; - fs::write( - &service_smoke_single_runbook_path, - "# synthetic single-service execution runbook smoke artifact\n", - ) - .with_context(|| { - format!( - "failed to write single-service smoke runbook artifact {}", - service_smoke_single_runbook_path.display() - ) - })?; - for (receipt_id, action, status) in [ - ( - "daemon-service-lifecycle-receipt-smoke-cluster-execution-runbook", - "cluster-windows-service-execution-runbook", - "written", - ), - ( - "daemon-service-lifecycle-receipt-smoke-cluster-execution-audit", - "cluster-windows-service-execution-audit", - "incomplete", - ), - ] { - write_epiphany_cultmesh_daemon_service_lifecycle_receipt( - &args.store, - args.runtime_id.clone(), - EpiphanyCultMeshDaemonServiceLifecycleReceiptEntry { - schema_version: - EPIPHANY_CULTMESH_DAEMON_SERVICE_LIFECYCLE_RECEIPT_SCHEMA_VERSION - .to_string(), - receipt_id: receipt_id.to_string(), - service_id: "epiphany-cluster-daemon-services".to_string(), - scheduler_id: "epiphany-daemon-supervisor".to_string(), - runtime_id: args.runtime_id.clone(), - daemon_selector: "all".to_string(), - action: action.to_string(), - status: status.to_string(), - command: "smoke-service-lifecycle".to_string(), - args: vec![action.to_string()], - cwd: Some("E:/Projects/EpiphanyAgent".to_string()), - process_id: None, - exit_code: Some(0), - started_at_utc: service_smoke_started_at.clone(), - completed_at_utc: Some(Utc::now().to_rfc3339()), - operator_artifact_ref: if action - == "cluster-windows-service-execution-runbook" - { - service_smoke_runbook_path.display().to_string() - } else { - format!("smoke://verse-query/{action}") - }, - private_state_exposed: false, - notes: vec![ - "Synthetic verse-query smoke receipt for service lifecycle action rows." - .to_string(), - ], - executable_sha256: String::new(), - preflight_witness_id: String::new(), - required_document_types: Vec::new(), - schema_preflight_passed: false, - schema_catalog_sha256: String::new(), - }, - )?; - } - write_epiphany_cultmesh_daemon_service_lifecycle_receipt( - &args.store, - args.runtime_id.clone(), - EpiphanyCultMeshDaemonServiceLifecycleReceiptEntry { - schema_version: EPIPHANY_CULTMESH_DAEMON_SERVICE_LIFECYCLE_RECEIPT_SCHEMA_VERSION - .to_string(), - receipt_id: "daemon-service-lifecycle-receipt-smoke-service-execution-runbook" - .to_string(), - service_id: "epiphany-daemon-supervisor-service".to_string(), - scheduler_id: "epiphany-daemon-supervisor".to_string(), - runtime_id: args.runtime_id.clone(), - daemon_selector: "epiphany-daemon-supervisor".to_string(), - action: "windows-service-execution-runbook".to_string(), - status: "written".to_string(), - command: "smoke-service-lifecycle".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: service_smoke_started_at.clone(), - completed_at_utc: Some(Utc::now().to_rfc3339()), - operator_artifact_ref: service_smoke_single_runbook_path.display().to_string(), - private_state_exposed: false, - notes: vec![ - "Synthetic verse-query smoke receipt for single-service execution runbook action row." - .to_string(), - ], - executable_sha256: String::new(), - preflight_witness_id: String::new(), - required_document_types: Vec::new(), - schema_preflight_passed: false, - schema_catalog_sha256: String::new(), - }, - )?; - write_epiphany_cultmesh_daemon_service_lifecycle_receipt( - &args.store, - args.runtime_id.clone(), - EpiphanyCultMeshDaemonServiceLifecycleReceiptEntry { - schema_version: EPIPHANY_CULTMESH_DAEMON_SERVICE_LIFECYCLE_RECEIPT_SCHEMA_VERSION - .to_string(), - receipt_id: "daemon-service-lifecycle-receipt-smoke-service-execution-audit" - .to_string(), - service_id: "epiphany-daemon-supervisor-service".to_string(), - scheduler_id: "epiphany-daemon-supervisor".to_string(), - runtime_id: args.runtime_id.clone(), - daemon_selector: "epiphany-daemon-supervisor".to_string(), - action: "windows-service-execution-audit".to_string(), - status: "incomplete".to_string(), - command: "smoke-service-lifecycle".to_string(), - args: vec!["windows-service-execution-audit".to_string()], - cwd: Some("E:/Projects/EpiphanyAgent".to_string()), - process_id: None, - exit_code: Some(0), - started_at_utc: service_smoke_started_at.clone(), - completed_at_utc: Some(Utc::now().to_rfc3339()), - operator_artifact_ref: - "smoke://verse-query/windows-service-execution-audit".to_string(), - private_state_exposed: false, - notes: vec![ - "Synthetic verse-query smoke receipt for single-service lifecycle action rows." - .to_string(), - ], - executable_sha256: String::new(), - preflight_witness_id: String::new(), - required_document_types: Vec::new(), - schema_preflight_passed: false, - schema_catalog_sha256: String::new(), - }, - )?; - let service_overview = load_swarm_overview_report(&args)?; - let (service_health_readback, service_health_private_state_exposed) = - service_health_readback_from_idunn(&args)?; - let (swarm_online_runbook_readback, swarm_online_runbook_private_state_exposed) = - swarm_online_runbook_readback_from_idunn(&args)?; - let service_health_action_rows = service_health_readback["serviceActionRows"] - .as_array() - .context("service-health readback lost service action rows")?; - let service_health_action_tui_rows = service_health_readback["serviceActionTuiRows"] - .as_array() - .context("service-health readback lost service action TUI rows")?; - let service_health_preflight_rows = service_health_readback["onlinePreflightRows"] - .as_array() - .context("service-health readback lost online preflight rows")?; - let service_health_diagnostic = format!( - "status={:?}, mode={:?}, command={:?}, preflight={:?}, preflightCommand={:?}, childRunbooks={:?}, present={:?}, hashVerified={:?}, hashMismatch={:?}, missingArtifacts={:?}, attention={:?}, failed={:?}, missing={:?}, actions={}, preflightRows={}, swarmOnline={:?}, swarmOnlinePrivate={}, privateHelper={}, privateJson={:?}", - service_health_readback["status"].as_str(), - service_health_readback["recommendedWrapperMode"].as_str(), - service_health_readback["recommendedWrapperCommand"].as_str(), - service_health_readback["onlinePreflightStatus"].as_str(), - service_health_readback["onlinePreflightCommand"].as_str(), - service_health_readback["onlinePreflightChildRunbookCount"].as_u64(), - service_health_readback["onlinePreflightPresentCount"].as_u64(), - service_health_readback["onlinePreflightHashVerifiedCount"].as_u64(), - service_health_readback["onlinePreflightMismatchCount"].as_u64(), - service_health_readback["onlinePreflightMissingArtifactCount"].as_u64(), - service_health_readback["serviceLifecycleAttentionCount"].as_u64(), - service_health_readback["serviceExecutionFailedCheckCount"].as_u64(), - service_health_readback["serviceExecutionMissingCheckCount"].as_u64(), - service_health_action_rows.len(), - service_health_preflight_rows.len(), - swarm_online_runbook_readback["status"].as_str(), - swarm_online_runbook_private_state_exposed, - service_health_private_state_exposed, - service_health_readback["privateStateExposed"].as_bool(), - ); - let service_receipt_directory = { - let context = - query_epiphany_local_verse_context(&args.store, args.runtime_id.clone())?; - let lifecycle_receipts = load_epiphany_cultmesh_daemon_service_lifecycle_receipts( - &args.store, - args.runtime_id.clone(), - )?; - receipt_directory_report(&context, &lifecycle_receipts, None) - }; - if service_overview.service_lifecycle_recommended_wrapper_mode - != "cluster-service-execution-audit" - || service_receipt_directory.artifact_external_ref_count < 1 - || service_receipt_directory.artifact_present_count < 2 - || service_receipt_directory.artifact_missing_count != 0 - || !service_receipt_directory - .attention_route_rows - .iter() - .any(|row| row.starts_with("cluster-service-lifecycle:")) - || !service_receipt_directory.rows.iter().any(|row| { - row.family == "cluster-service-execution-runbook" - && row.service_id == "epiphany-cluster-daemon-services" - && row.service_route - == "epiphany-cluster-daemon-services::cluster-windows-service-execution-runbook" - && row.artifact_status == "present" - && row.artifact_sha256 - == operator_artifact_sha256( - &service_smoke_runbook_path.display().to_string(), - "present", - ) - }) - || !service_receipt_directory.tui_rows.iter().any(|row| { - row.contains("cluster-service-execution-runbook") - && row.contains("service=epiphany-cluster-daemon-services") - && row.contains("artifact=present") - && row.contains(&format!( - "sha256={}", - operator_artifact_sha256( - &service_smoke_runbook_path.display().to_string(), - "present", - ) - )) - }) - || !service_overview.swarm_action_rows.iter().any(|row| { - row.priority == 40 - && row.family == "service-lifecycle" - && row.effect_class == "service-lifecycle-readback" - && row.lifecycle_owner == SERVICE_LIFECYCLE_OWNER - && row.hosted_body == SERVICE_LIFECYCLE_HOSTED_BODY - && row.operator_artifact_ref - == "smoke://verse-query/cluster-windows-service-execution-audit" - && row.operator_artifact_status == "external-ref" - && row.operator_artifact_sha256 == "none" - && row.service_execution_failed_check_count == 5 - && row.service_execution_missing_check_count == 4 - && !row.mutates_state - && !row.requires_elevated_authority - && !row.private_state_exposed - }) - || !service_overview.swarm_action_rows.iter().any(|row| { - row.priority == 41 - && row.family == "service-lifecycle" - && row.wrapper_mode == "service-execution-audit" - && row.operator_artifact_ref - == "smoke://verse-query/windows-service-execution-audit" - && row.operator_artifact_status == "external-ref" - && row.operator_artifact_sha256 == "none" - && row.service_execution_failed_check_count == 6 - && row.service_execution_missing_check_count == 6 - && !row.mutates_state - && !row.requires_elevated_authority - && !row.private_state_exposed - }) - || !service_overview.swarm_action_tui_rows.iter().any(|row| { - row.contains("service-lifecycle") - && row.contains("owner=Idunn") - && row.contains("hostedBody=Epiphany") - && row.contains("artifact=external-ref") - && row.contains("sha256=none") - && row.contains("failedChecks=5") - && row.contains("missingChecks=4") - && row.contains("audit=none") - }) - || !service_overview.swarm_action_rows.iter().any(|row| { - row.priority == 50 - && row.family == "service-execution-authority" - && row.effect_class == "elevated-service-control" - && row.lifecycle_owner == SERVICE_LIFECYCLE_OWNER - && row.hosted_body == SERVICE_LIFECYCLE_HOSTED_BODY - && row.operator_artifact_ref - == service_smoke_runbook_path.display().to_string() - && row.operator_artifact_status == "present" - && row.operator_artifact_sha256 - == operator_artifact_sha256( - &service_smoke_runbook_path.display().to_string(), - "present", - ) - && row.operator_artifact_execution_command - == elevated_powershell_runbook_command( - &service_smoke_runbook_path.display().to_string(), - ) - && row.operator_aftercare_command - == WRAPPER_CLUSTER_SERVICE_EXECUTION_AUDIT_COMMAND - && row.completion_audit_wrapper_mode == "cluster-service-execution-audit" - && row.completion_audit_wrapper_command - == WRAPPER_CLUSTER_SERVICE_EXECUTION_AUDIT_COMMAND - && row.service_id == "epiphany-cluster-daemon-services" - && row.service_route - == "epiphany-cluster-daemon-services::cluster-windows-service-execution-runbook" - && row.mutates_state - && row.requires_elevated_authority - && row.service_execution_failed_check_count == 5 - && row.service_execution_missing_check_count == 4 - && !row.private_state_exposed - }) - || !service_overview.swarm_action_rows.iter().any(|row| { - row.priority == 51 - && row.family == "service-execution-authority" - && row.effect_class == "elevated-service-control" - && row.lifecycle_owner == SERVICE_LIFECYCLE_OWNER - && row.hosted_body == SERVICE_LIFECYCLE_HOSTED_BODY - && row.operator_aftercare_command == WRAPPER_SERVICE_EXECUTION_AUDIT_COMMAND - && row.completion_audit_wrapper_mode == "service-execution-audit" - && row.completion_audit_wrapper_command == WRAPPER_SERVICE_EXECUTION_AUDIT_COMMAND - && row.service_id == "epiphany-daemon-supervisor-service" - && row.service_route - == "epiphany-daemon-supervisor-service::windows-service-execution-runbook" - && row.mutates_state - && row.requires_elevated_authority - && row.service_execution_failed_check_count == 6 - && row.service_execution_missing_check_count == 6 - && !row.private_state_exposed - }) - || !service_overview.swarm_action_tui_rows.iter().any(|row| { - row.contains("service-execution-authority") - && row.contains("owner=Idunn") - && row.contains("hostedBody=Epiphany") - && row.contains("command=tools/epiphany_local_run.ps1 -Mode cluster-service-execution-runbook") - && row.contains("service=epiphany-cluster-daemon-services") - && row.contains("route=epiphany-cluster-daemon-services::cluster-windows-service-execution-runbook") - && row.contains("failedChecks=5") - && row.contains("missingChecks=4") - && row.contains("artifact=present") - && row.contains(&format!( - "sha256={}", - operator_artifact_sha256( - &service_smoke_runbook_path.display().to_string(), - "present", - ) - )) - && row.contains(&format!( - "exec={}", - elevated_powershell_runbook_command( - &service_smoke_runbook_path.display().to_string(), - ) - )) - && row.contains("audit=cluster-service-execution-audit") - && row.contains("aftercare=tools/epiphany_local_run.ps1 -Mode cluster-service-execution-audit") - }) - || !service_overview.swarm_action_tui_rows.iter().any(|row| { - row.contains("service-execution-authority") - && row.contains("owner=Idunn") - && row.contains("hostedBody=Epiphany") - && row.contains("command=tools/epiphany_local_run.ps1 -Mode service-execution-runbook") - && row.contains("service=epiphany-daemon-supervisor-service") - && row.contains("route=epiphany-daemon-supervisor-service::windows-service-execution-runbook") - && row.contains("failedChecks=6") - && row.contains("missingChecks=6") - && row.contains("artifact=present") - && row.contains("exec=Start-Process PowerShell") - && row.contains("audit=service-execution-audit") - && row.contains("aftercare=tools/epiphany_local_run.ps1 -Mode service-execution-audit") - }) - || !service_overview - .service_lifecycle_attention_rows - .iter() - .any(|row| { - row.family == "cluster-service-lifecycle" - && row.service_id == "epiphany-cluster-daemon-services" - && row.artifact_status == "external-ref" - }) - || !service_overview - .service_lifecycle_attention_tui_rows - .iter() - .any(|row| { - row.contains("service=epiphany-cluster-daemon-services") - && row.contains("artifact=external-ref") - && row.contains(&format!( - "followUp={WRAPPER_CLUSTER_SERVICE_EXECUTION_AUDIT_COMMAND}" - )) - }) - || service_overview.service_execution_failed_check_count == 0 - || service_overview.service_execution_missing_check_count == 0 - || !service_overview - .service_execution_failed_check_rows - .iter() - .any(|check| { - check.action == "cluster-windows-service-execution-readiness" - && check.service_id.as_deref() - == Some("epiphany-cluster-daemon-services") - && check.observed_status.is_none() - && !check.ok - && check.private_state_sealed - }) - || !service_overview - .service_execution_failed_check_rows - .iter() - .any(|check| { - check.action == "cluster-windows-service-execution-audit" - && check.service_id.as_deref() - == Some("epiphany-cluster-daemon-services") - && check.observed_status.as_deref() == Some("incomplete") - && !check.ok - && check.private_state_sealed - }) - || !service_overview - .service_execution_failed_check_rows - .iter() - .any(|check| { - check.action == "windows-service-execution-readiness" - && check.service_id.as_deref() - == Some("epiphany-daemon-supervisor-service") - && check.observed_status.is_none() - && !check.ok - && check.private_state_sealed - }) - || !service_overview - .service_execution_failed_check_tui_rows - .iter() - .any(|row| { - row.contains("epiphany-cluster-daemon-services::cluster-windows-service-execution-audit=incomplete") - && row.contains("followUp=tools/epiphany_local_run.ps1 -Mode cluster-service-execution-audit") - }) - || !service_overview - .service_execution_failed_check_tui_rows - .iter() - .any(|row| { - row.contains( - "epiphany-daemon-supervisor-service::windows-service-execution-readiness=missing", - ) - && row.contains("followUp=tools/epiphany_local_run.ps1 -Mode service-execution-readiness") - }) - || service_health_readback["status"].as_str() != Some("attention") - || service_health_readback["lifecycleOwner"].as_str() - != Some(SERVICE_LIFECYCLE_OWNER) - || service_health_readback["hostedBody"].as_str() - != Some(SERVICE_LIFECYCLE_HOSTED_BODY) - || service_health_readback["recommendedWrapperMode"].as_str() - != Some("cluster-service-execution-audit") - || service_health_readback["recommendedWrapperCommand"].as_str() - != Some(WRAPPER_CLUSTER_SERVICE_EXECUTION_AUDIT_COMMAND) - || service_health_readback["onlinePreflightStatus"].as_str() - != Some("ready-for-elevated-operator") - || service_health_readback["onlinePreflightCommand"].as_str() - != Some(WRAPPER_SWARM_ONLINE_RUNBOOK_COMMAND) - || service_health_readback["onlinePreflightChildRunbookCount"].as_u64() - != Some(2) - || service_health_readback["onlinePreflightPresentCount"].as_u64() != Some(2) - || service_health_readback["onlinePreflightHashVerifiedCount"].as_u64() - != Some(2) - || service_health_readback["onlinePreflightMismatchCount"].as_u64() != Some(0) - || service_health_readback["onlinePreflightMissingArtifactCount"].as_u64() - != Some(0) - || service_health_readback["onlinePreflightFailedCheckCount"].as_u64() - != Some(11) - || service_health_readback["onlinePreflightMissingCheckCount"].as_u64() - != Some(10) - || service_health_preflight_rows.len() != 2 - || swarm_online_runbook_readback["status"].as_str() - != Some("ready-for-elevated-operator") - || swarm_online_runbook_readback["lifecycleOwner"].as_str() - != Some(SERVICE_LIFECYCLE_OWNER) - || swarm_online_runbook_readback["hostedBody"].as_str() - != Some(SERVICE_LIFECYCLE_HOSTED_BODY) - || swarm_online_runbook_readback["wrapperMode"].as_str() - != Some("swarm-online-runbook") - || swarm_online_runbook_readback["wrapperCommand"].as_str() - != Some(WRAPPER_SWARM_ONLINE_RUNBOOK_COMMAND) - || swarm_online_runbook_readback["elevatedExecutionRequiresOperator"].as_bool() - != Some(true) - || swarm_online_runbook_readback["childRunbookCount"].as_u64() != Some(2) - || swarm_online_runbook_readback["childArtifactPresentCount"].as_u64() != Some(2) - || swarm_online_runbook_readback["childArtifactHashVerifiedCount"].as_u64() - != Some(2) - || swarm_online_runbook_readback["childArtifactMissingCount"].as_u64() != Some(0) - || swarm_online_runbook_readback["serviceExecutionFailedCheckCount"].as_u64() - != Some(11) - || swarm_online_runbook_readback["serviceExecutionMissingCheckCount"].as_u64() - != Some(10) - || swarm_online_runbook_readback["privateStateExposed"].as_bool() != Some(false) - || swarm_online_runbook_private_state_exposed - || service_health_readback["serviceLifecycleAttentionCount"].as_u64() != Some(2) - || service_health_readback["serviceExecutionFailedCheckCount"].as_u64() - != Some(11) - || service_health_readback["serviceExecutionMissingCheckCount"].as_u64() - != Some(10) - || service_health_action_rows.len() != 4 - || service_health_private_state_exposed - || service_health_readback["privateStateExposed"].as_bool() != Some(false) - || !service_health_action_rows.iter().any(|row| { - row["family"].as_str() == Some("service-lifecycle") - && row["lifecycleOwner"].as_str() == Some(SERVICE_LIFECYCLE_OWNER) - && row["hostedBody"].as_str() == Some(SERVICE_LIFECYCLE_HOSTED_BODY) - && row["effectClass"].as_str() == Some("service-lifecycle-readback") - && row["mutatesState"].as_bool() == Some(false) - && row["requiresElevatedAuthority"].as_bool() == Some(false) - && row["serviceExecutionFailedCheckCount"].as_u64() == Some(5) - && row["privateStateExposed"].as_bool() == Some(false) - }) - || !service_health_action_rows.iter().any(|row| { - row["family"].as_str() == Some("service-execution-authority") - && row["lifecycleOwner"].as_str() == Some(SERVICE_LIFECYCLE_OWNER) - && row["hostedBody"].as_str() == Some(SERVICE_LIFECYCLE_HOSTED_BODY) - && row["effectClass"].as_str() == Some("elevated-service-control") - && row["mutatesState"].as_bool() == Some(true) - && row["requiresElevatedAuthority"].as_bool() == Some(true) - && row["operatorAftercareCommand"].as_str() - == Some(WRAPPER_CLUSTER_SERVICE_EXECUTION_AUDIT_COMMAND) - && row["serviceExecutionFailedCheckCount"].as_u64() == Some(5) - && row["privateStateExposed"].as_bool() == Some(false) - }) - || !service_health_preflight_rows.iter().any(|row| { - let expected_sha = operator_artifact_sha256( - &service_smoke_runbook_path.display().to_string(), - "present", - ); - row["serviceId"].as_str() == Some("epiphany-cluster-daemon-services") - && row["serviceRoute"].as_str() - == Some( - "epiphany-cluster-daemon-services::cluster-windows-service-execution-runbook", - ) - && row["artifactStatus"].as_str() == Some("present") - && row["expectedArtifactSha256"].as_str() == Some(expected_sha.as_str()) - && row["artifactPresent"].as_bool() == Some(true) - && row["artifactSha256Matches"].as_bool() == Some(true) - && row["aftercareCommand"].as_str() - == Some(WRAPPER_CLUSTER_SERVICE_EXECUTION_AUDIT_COMMAND) - && row["failedChecks"].as_u64() == Some(5) - && row["missingChecks"].as_u64() == Some(4) - && row["privateStateExposed"].as_bool() == Some(false) - }) - || !service_health_action_tui_rows.iter().any(|row| { - row.as_str().is_some_and(|row| { - row.contains("service-lifecycle") - && row.contains("owner=Idunn") - && row.contains("hostedBody=Epiphany") - && row.contains("failedChecks=5") - }) - }) - { - anyhow::bail!( - "local Verse query smoke did not expose sealed Idunn-owned service lifecycle readback plus service-health payload anatomy: {service_health_diagnostic}" - ); - } let readiness_follow_up_receipt = EpiphanyCultMeshDaemonServiceLifecycleReceiptEntry { schema_version: EPIPHANY_CULTMESH_DAEMON_SERVICE_LIFECYCLE_RECEIPT_SCHEMA_VERSION .to_string(), @@ -3257,8 +2711,7 @@ fn run_cli() -> Result<()> { "smoke://verse-query/cluster-windows-service-execution-readiness".to_string(), private_state_exposed: false, notes: vec![ - "Synthetic verse-query smoke receipt for lifecycle follow-up routing." - .to_string(), + "In-memory projection fixture for lifecycle follow-up routing.".to_string(), ], executable_sha256: String::new(), preflight_witness_id: String::new(), @@ -9571,166 +9024,6 @@ fn authority_tool_readback_from_capability( ) } -fn service_health_readback_from_idunn(args: &Args) -> Result<(serde_json::Value, bool)> { - let overview = load_swarm_overview_report(args)?; - let service_action_rows = overview - .swarm_action_rows - .iter() - .filter(|row| { - row.family == "service-lifecycle" || row.family == "service-execution-authority" - }) - .cloned() - .collect::>(); - let service_action_tui_rows = service_action_rows - .iter() - .map(swarm_action_tui_row) - .collect::>(); - let service_authority_rows = service_action_rows - .iter() - .filter(|row| row.family == "service-execution-authority") - .collect::>(); - let online_preflight_rows = service_authority_rows - .iter() - .map(|row| { - let actual_artifact_sha256 = - operator_artifact_sha256(&row.operator_artifact_ref, &row.operator_artifact_status); - let artifact_present = row.operator_artifact_status == "present"; - let artifact_sha256_matches = artifact_present - && row.operator_artifact_sha256 != "none" - && row.operator_artifact_sha256 == actual_artifact_sha256; - json!({ - "serviceId": row.service_id, - "serviceRoute": row.service_route, - "lifecycleOwner": row.lifecycle_owner, - "hostedBody": row.hosted_body, - "status": row.status, - "wrapperMode": row.wrapper_mode, - "wrapperCommand": row.wrapper_command, - "artifactRef": row.operator_artifact_ref, - "artifactStatus": row.operator_artifact_status, - "expectedArtifactSha256": row.operator_artifact_sha256, - "actualArtifactSha256": actual_artifact_sha256, - "artifactPresent": artifact_present, - "artifactSha256Matches": artifact_sha256_matches, - "elevatedCommand": row.operator_artifact_execution_command, - "aftercareCommand": row.operator_aftercare_command, - "failedChecks": row.service_execution_failed_check_count, - "missingChecks": row.service_execution_missing_check_count, - "privateStateExposed": row.private_state_exposed, - }) - }) - .collect::>(); - let online_preflight_child_runbook_count = service_authority_rows.len(); - let online_preflight_present_count = service_authority_rows - .iter() - .filter(|row| row.operator_artifact_status == "present") - .count(); - let online_preflight_hash_verified_count = service_authority_rows - .iter() - .filter(|row| { - row.operator_artifact_status == "present" - && row.operator_artifact_sha256 != "none" - && row.operator_artifact_sha256 - == operator_artifact_sha256( - &row.operator_artifact_ref, - &row.operator_artifact_status, - ) - }) - .count(); - let online_preflight_missing_artifact_count = service_authority_rows - .iter() - .filter(|row| row.operator_artifact_status != "present") - .count(); - let online_preflight_mismatch_count = service_authority_rows - .iter() - .filter(|row| { - row.operator_artifact_status == "present" - && (row.operator_artifact_sha256 == "none" - || row.operator_artifact_sha256 - != operator_artifact_sha256( - &row.operator_artifact_ref, - &row.operator_artifact_status, - )) - }) - .count(); - let private_state_exposed = overview - .service_lifecycle_attention_rows - .iter() - .any(|row| row.private_state_exposed) - || overview - .service_execution_failed_check_rows - .iter() - .any(|check| !check.private_state_sealed) - || service_action_rows - .iter() - .any(|row| row.private_state_exposed); - let online_preflight_status = if online_preflight_child_runbook_count == 0 { - "not-applicable" - } else if online_preflight_missing_artifact_count > 0 - || online_preflight_mismatch_count > 0 - || private_state_exposed - { - "blocked-regenerate-runbooks" - } else { - "ready-for-elevated-operator" - }; - Ok(( - json!({ - "status": overview.recovery_status, - "lifecycleOwner": SERVICE_LIFECYCLE_OWNER, - "hostedBody": SERVICE_LIFECYCLE_HOSTED_BODY, - "recommendedWrapperMode": overview.service_lifecycle_recommended_wrapper_mode, - "recommendedWrapperCommand": overview.service_lifecycle_recommended_wrapper_command, - "onlinePreflightStatus": online_preflight_status, - "onlinePreflightCommand": WRAPPER_SWARM_ONLINE_RUNBOOK_COMMAND, - "onlinePreflightChildRunbookCount": online_preflight_child_runbook_count, - "onlinePreflightPresentCount": online_preflight_present_count, - "onlinePreflightHashVerifiedCount": online_preflight_hash_verified_count, - "onlinePreflightMismatchCount": online_preflight_mismatch_count, - "onlinePreflightMissingArtifactCount": online_preflight_missing_artifact_count, - "onlinePreflightFailedCheckCount": overview.service_execution_failed_check_count, - "onlinePreflightMissingCheckCount": overview.service_execution_missing_check_count, - "onlinePreflightRows": online_preflight_rows, - "serviceLifecycleAttentionCount": overview.service_lifecycle_attention_rows.len(), - "serviceLifecycleAttentionRows": overview.service_lifecycle_attention_rows, - "serviceLifecycleAttentionTuiRows": overview.service_lifecycle_attention_tui_rows, - "serviceExecutionFailedCheckCount": overview.service_execution_failed_check_count, - "serviceExecutionMissingCheckCount": overview.service_execution_missing_check_count, - "serviceExecutionFailedCheckRows": overview.service_execution_failed_check_rows, - "serviceExecutionFailedCheckTuiRows": overview.service_execution_failed_check_tui_rows, - "serviceActionRows": service_action_rows, - "serviceActionTuiRows": service_action_tui_rows, - "privateStateExposed": private_state_exposed, - }), - private_state_exposed, - )) -} - -fn swarm_online_runbook_readback_from_idunn(args: &Args) -> Result<(serde_json::Value, bool)> { - let (service_health, private_state_exposed) = service_health_readback_from_idunn(args)?; - Ok(( - json!({ - "status": service_health["onlinePreflightStatus"], - "lifecycleOwner": SERVICE_LIFECYCLE_OWNER, - "hostedBody": SERVICE_LIFECYCLE_HOSTED_BODY, - "wrapperMode": "swarm-online-runbook", - "wrapperCommand": WRAPPER_SWARM_ONLINE_RUNBOOK_COMMAND, - "elevatedExecutionRequiresOperator": true, - "elevatedExecutionCommandSource": "swarm-online-runbook artifact output", - "childRunbookCount": service_health["onlinePreflightChildRunbookCount"], - "childArtifactPresentCount": service_health["onlinePreflightPresentCount"], - "childArtifactHashVerifiedCount": service_health["onlinePreflightHashVerifiedCount"], - "childArtifactMismatchCount": service_health["onlinePreflightMismatchCount"], - "childArtifactMissingCount": service_health["onlinePreflightMissingArtifactCount"], - "serviceExecutionFailedCheckCount": service_health["onlinePreflightFailedCheckCount"], - "serviceExecutionMissingCheckCount": service_health["onlinePreflightMissingCheckCount"], - "childPreflightRows": service_health["onlinePreflightRows"], - "privateStateExposed": private_state_exposed, - }), - private_state_exposed, - )) -} - fn default_daemon_tool_result_ref( capability: &EpiphanyCultMeshDaemonToolCapabilityEntry, receipt_id: &str, diff --git a/notes/conceptual-substitution-audit-2026-07-12.md b/notes/conceptual-substitution-audit-2026-07-12.md index bb0c1053..be89ef19 100644 --- a/notes/conceptual-substitution-audit-2026-07-12.md +++ b/notes/conceptual-substitution-audit-2026-07-12.md @@ -429,3 +429,14 @@ unproven note for the status document. Both inputs are deleted. Reaching the heartbeat write derives `ready`; command failure writes no heartbeat, while degradation/down must come from timeout, failed restart, or supervisor observation rather than a caller describing the desired dashboard color. + +## Query smoke authoring Idunn lifecycle truth + +The monolithic `epiphany-verse-query smoke` wrote synthetic Windows service +runbooks plus four daemon-service lifecycle receipts into its selected store, +then used those documents to prove service overview, health, preflight, and +action projections. Because the smoke accepts an explicit store, the query +binary could contaminate live Verse state with its own Idunn fiction. The whole +service-lifecycle fixture/readback segment and its now-dead helper functions +are deleted. Lifecycle fixtures belong to focused daemon-supervisor smokes in +quarantined stores; query smoke no longer authors service truth. diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index fc589083..56594619 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -109,6 +109,9 @@ The confirmed conceptual substitutions have been cut: - cluster-daemon heartbeat no longer accepts caller liveness or note fields. A successful owning-body heartbeat derives `ready`; degraded/down require observed supervisor or timeout evidence. +- verse-query's mega-smoke no longer writes synthetic Idunn service runbooks or + lifecycle receipts into its selected store and then verifies its own state. + Focused daemon-supervisor smokes own quarantined lifecycle fixtures. The presentation boundary is now plain: `swarm overview` is a generic compact read-only projection. Gjallar is a downstream TUI application on Nightwing and is not an Epiphany organ, provider, owner, runtime, or architectural dependency. Eve/CultUI graphs may be lowered or composited downstream without Epiphany caring which presentation client does it. diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index d6932cc3..6ff68302 100644 Binary files a/state/ledgers.msgpack and b/state/ledgers.msgpack differ diff --git a/state/map.yaml b/state/map.yaml index 37ba00e8..c2b88917 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -660,4 +660,4 @@ current_status: - Service lifecycle receipt history is now event-only: `load_epiphany_cultmesh_daemon_service_lifecycle_receipts` filters out the `epiphany-local/daemon-service-lifecycle-receipt/latest` mirror, while `load_latest_epiphany_cultmesh_daemon_service_lifecycle_receipt` remains the latest-state reader. Focused unit test `service_lifecycle_receipt_history_excludes_latest_mirror` proves two per-receipt writes return exactly two history records and latest points at the second. Fresh smoke `verse-query-lifecycle-history-filter-smoke` and live overview/triage `local-20260618-145632-497-efac6f0d` / `local-20260618-145632-321-867947af` prove compact swarm sights still expose service lifecycle attention plus the present elevated runbook artifact without daemon pokes or service mutation. Do not use a broad unscoped cargo test filter for this check on Windows; it fans out across bin harnesses and hit a broken pipe during this pass. - `epiphany-verse-query seed-compact` is the compact seed receipt for wrappers and read-only rites. The older `seed` command still prints the full local Verse context for explicit debugging, but compact wrapper modes now avoid full `seed`/final `query` readback after the combined overview proof exposed Windows debug stack overflow from full-context serialization pressure. last_completed_repo_swarm_cut: Huginn live-fire has crossed the first real repo Body from Persona pressure to branch-local Hands commit and Soul/Mind closure, and now has repeatable closure and redacted-public-proof mouths. On `E:\Projects\Huginn` branch `epiphany/huginn/first-awakening`, `tools/epiphany_local_run.ps1 -Mode repo-persona-intake` accepted item `huginn-inspection-readback-livefire`, Weksa/Persona intake remained sealed, and `epiphany-work derive-plan` lowered it to model-authored safe family `repo.status_section` for `README.md` only. `tools/epiphany_local_run.ps1 -Mode repo-swarm-run` advanced four bounded pulses: run-from-plan, adopt-from-plan, execute-from-plan, and close-from-execute. Huginn commit `e9b07c38fceabbdc89ea35c2156326c80c0393a2` updated only `README.md`; closure receipt `.epiphany\work\work-close-huginn-inspection-readback-livefire.json` records status `closed`, Soul verdict `passed`, Mind state commit `repo-work-close-huginn-inspection-readback-livefire-mind-commit`, safe family `repo.status_section`, path scope `README.md`, Bifrost publication gate, and `privateStateExposed=false`. Verification also ran Huginn's TypeScript compiler through concrete Node path: `C:\Program Files\nodejs\node.exe E:\Projects\Huginn\node_modules\typescript\bin\tsc -p tsconfig.json` passed. Native verifier `epiphany-repo-livefire-closure-smoke --workspace E:\Projects\Huginn --item huginn-inspection-readback-livefire --expected-path README.md --expected-family repo.status_section --expected-gate awaiting-publication --expected-blocker bifrost-publication-missing` checks closure receipt, Mind map entry, overview gate/blocker, authority seals, and `git show` changed paths, returning `status=ok`, `soulVerdict=passed`, `publicationGate=Bifrost`, and `privateStateExposed=false`. Wrapper `tools/epiphany_local_run.ps1 -Mode repo-livefire-closure -Workspace E:\Projects\Huginn -RepoWorkItem huginn-inspection-readback-livefire -SkipBuild` exposes the same read-only proof through the local operator mouth; artifact `local-20260621-190156-803-2f85ba15` printed commit, path, gate, blocker, Soul verdict, Mind commit receipt, and `privateStateExposed=False` without push, merge, publication, or target mutation. New wrapper `tools/epiphany_local_run.ps1 -Mode repo-work-public-proof -Workspace E:\Projects\Huginn -RepoWorkItem huginn-inspection-readback-livefire -SkipBuild` exports the redacted proof bundle and repo-local Verse index without publishing; artifact `local-20260621-190645-345-4555b1dc` wrote `.epiphany\public\proof-bundles\repo-work-public-proof-huginn-inspection-readback-livefire.json`, proof id `repo-work-public-proof-huginn-inspection-readback-livefire`, SHA-256 `857545b199f3e37eb06c2e757e5cfc201958e46667bb1f8403fd333a22620f63`, nine artifact rows, zero publication rows, and `privateStateExposed=False`. swarm overview readback `local-20260621-190701-140-b9519ec6` sees the `REPO-WORK-PUBLIC-PROOF` row and action row from Huginn's repo-local Verse with the same SHA-256 while Bifrost publication remains missing. Launcher compact modes are now named compact operator-context modes instead of read-only modes, and `bifrost-public-proof` summaries print item, target public Verse, room, proof SHA-256, review receipts, and credit receipts so publication receipts are auditable without claiming upstream sync. - next_action: Continue the conceptual-substitution modeling pass beyond receipt writers. Publication/closure/Hands authority is single-sourced; successful cluster-daemon heartbeat now derives ready and cannot accept caller liveness prose. Continue auditing daemon-supervisor and verse-query lifecycle writers, especially fixture-only lifecycle receipts and any status that is not derived from an observed process/service consequence; then inspect remaining projections/caches/adapters. + next_action: Continue the conceptual-substitution modeling pass beyond receipt writers. Publication/closure/Hands authority is single-sourced; cluster heartbeat is derived; verse-query smoke no longer authors synthetic Idunn service truth. Continue auditing daemon-supervisor lifecycle writers for statuses not derived from observed process/service consequences, then inspect remaining projections/caches/adapters.