From cc00f361f73b1e12a5a21ab6359fe18c5181e026 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 12 Jul 2026 21:09:24 +0100 Subject: [PATCH] Separate daemon heartbeat from bootstrap --- .../src/bin/epiphany-cluster-daemon.rs | 69 ++++++++---------- ...onceptual-substitution-audit-2026-07-12.md | 14 ++++ notes/epiphany-current-algorithmic-map.md | 4 + notes/fresh-workspace-handoff.md | 3 + state/ledgers.msgpack | Bin 435122 -> 435536 bytes state/map.yaml | 2 +- 6 files changed, 54 insertions(+), 38 deletions(-) diff --git a/epiphany-core/src/bin/epiphany-cluster-daemon.rs b/epiphany-core/src/bin/epiphany-cluster-daemon.rs index 8e72f4b7..8540bd66 100644 --- a/epiphany-core/src/bin/epiphany-cluster-daemon.rs +++ b/epiphany-core/src/bin/epiphany-cluster-daemon.rs @@ -2,9 +2,8 @@ use anyhow::Context; use anyhow::Result; use chrono::Utc; use epiphany_core::load_epiphany_cultmesh_cluster_topology; +use epiphany_core::load_epiphany_cultmesh_daemon_liveness; use epiphany_core::publish_epiphany_cultmesh_provider_state; -use epiphany_core::query_epiphany_local_verse_context; -use epiphany_core::seed_epiphany_local_verse_context; use epiphany_core::write_epiphany_cultmesh_daemon_status; use epiphany_core::EpiphanyCultMeshDaemonStatusEntry; use epiphany_core::EPIPHANY_CULTMESH_DAEMON_STATUS_SCHEMA_VERSION; @@ -41,47 +40,43 @@ fn serve(args: Args) -> Result<()> { } fn write_heartbeat(args: &Args, iteration: u64) -> Result { - seed_epiphany_local_verse_context( - &args.store, - args.runtime_id.clone(), - Utc::now().to_rfc3339(), - )?; + let topology = load_epiphany_cultmesh_cluster_topology(&args.store, args.runtime_id.clone())?; + let cluster = topology + .into_iter() + .find(|cluster| cluster.daemon_id == args.daemon_id) + .with_context(|| { + format!( + "local Verse has no persisted topology for {}; run explicit bootstrap before starting cluster daemons", + args.daemon_id + ) + })?; publish_epiphany_cultmesh_provider_state( &args.store, args.runtime_id.clone(), &args.daemon_id, )?; - let context = query_epiphany_local_verse_context(&args.store, args.runtime_id.clone())?; - let current = context - .daemon_statuses - .iter() + let current = load_epiphany_cultmesh_daemon_liveness(&args.store, args.runtime_id.clone())? + .into_iter() + .map(|(_, status)| status) .find(|status| status.daemon_id == args.daemon_id) - .cloned() - .or_else(|| { - load_epiphany_cultmesh_cluster_topology(&args.store, args.runtime_id.clone()) - .ok()? - .into_iter() - .find(|cluster| cluster.daemon_id == args.daemon_id) - .map(|cluster| EpiphanyCultMeshDaemonStatusEntry { - schema_version: EPIPHANY_CULTMESH_DAEMON_STATUS_SCHEMA_VERSION.to_string(), - daemon_id: cluster.daemon_id, - cluster_id: cluster.cluster_id, - body_domain: cluster.body_domain, - daemon_surface_id: cluster.daemon_surface_id, - eve_surface_id: cluster.eve_surface_id, - status: "unknown".to_string(), - last_heartbeat_utc: "unknown".to_string(), - supported_actions: vec![ - "inspectStatus".to_string(), - "pokeDaemon".to_string(), - "watchHeartbeat".to_string(), - ], - operator_action: "pokeDaemon".to_string(), - private_state_exposed: false, - notes: vec!["Initial status constructed by the owning cluster daemon from persisted topology.".to_string()], - }) - }) - .with_context(|| format!("local Verse has no persisted topology for {}", args.daemon_id))?; + .unwrap_or_else(|| EpiphanyCultMeshDaemonStatusEntry { + schema_version: EPIPHANY_CULTMESH_DAEMON_STATUS_SCHEMA_VERSION.to_string(), + daemon_id: cluster.daemon_id, + cluster_id: cluster.cluster_id, + body_domain: cluster.body_domain, + daemon_surface_id: cluster.daemon_surface_id, + eve_surface_id: cluster.eve_surface_id, + status: "unknown".to_string(), + last_heartbeat_utc: "unknown".to_string(), + supported_actions: vec![ + "inspectStatus".to_string(), + "pokeDaemon".to_string(), + "watchHeartbeat".to_string(), + ], + operator_action: "pokeDaemon".to_string(), + private_state_exposed: false, + notes: vec!["Initial status constructed by the owning cluster daemon from persisted topology.".to_string()], + }); let mut next = current.clone(); next.status = args.daemon_status.clone(); next.last_heartbeat_utc = Utc::now().to_rfc3339(); diff --git a/notes/conceptual-substitution-audit-2026-07-12.md b/notes/conceptual-substitution-audit-2026-07-12.md index f87f705b..83b954e4 100644 --- a/notes/conceptual-substitution-audit-2026-07-12.md +++ b/notes/conceptual-substitution-audit-2026-07-12.md @@ -124,3 +124,17 @@ calls this primitive on the shared heartbeat/serve path before writing its own liveness. An unknown daemon is refused before any provider document is written. The quarantined aggregate smoke iterates the same one-daemon primitive rather than using a privileged fixture shortcut. + +## Heartbeat/bootstrap split + +After provider publication moved into `epiphany-cluster-daemon`, its heartbeat +path still called the generic local Verse bootstrap. A daemon could therefore +repaint Self-owned policy, topology, contracts, brake initialization, and +operator status merely by emitting liveness. + +Heartbeat and serve no longer bootstrap or query the full Verse context. They +require persisted topology, load only narrow liveness rows, publish only the +owning daemon's provider state, and write only its heartbeat. An unbootstrapped +daemon fails before creating the CultCache store and tells the operator to run +explicit bootstrap. The wrapper already performs that bootstrap at the +operator boundary. diff --git a/notes/epiphany-current-algorithmic-map.md b/notes/epiphany-current-algorithmic-map.md index e3965a8c..56c5f7d3 100644 --- a/notes/epiphany-current-algorithmic-map.md +++ b/notes/epiphany-current-algorithmic-map.md @@ -94,6 +94,10 @@ Each heartbeat/serve lane publishes only its daemon's Odin advertisement, Eve surface, and hosted tools through a daemon-ID-bounded primitive. There is no all-provider writer; an unknown daemon publishes nothing. +- Cluster daemons never bootstrap the local Verse and never load its full + context. They require persisted topology, read narrow liveness, then write + only their bounded provider state and heartbeat. Explicit operator bootstrap + owns policy/topology/contract initialization. - Store/runtime overrides fail before fixture seeding or receipt construction. - Negative proof: targeting `state/local-verse.ccmp` was rejected and its SHA-256 did not change. - Positive proof: the built-in quarantined smoke completes successfully and reports its quarantine coordinates. diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index 3df496ec..8d3ce0cb 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -21,6 +21,9 @@ The confirmed conceptual substitutions have been cut: - bulk provider-state writers are deleted. Each `epiphany-cluster-daemon` heartbeat publishes only its own advertisement, Eve surface, and hosted tools; unknown daemon identities are refused before writes. +- cluster daemons do not bootstrap or query the full Verse. Missing persisted + topology is a pre-write refusal; explicit operator bootstrap owns shared + policy, topology, contracts, brake initialization, and operator status. 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 882a65e09d01d5f94c066ac51dfa22d9b36897ba..f0bba0d36d8670ef4b089f10b880e376e33a8597 100644 GIT binary patch delta 327 zcmYL^F-yZx6opNz5d{awR)hN|oKTJ@zk4V|+JcOkvUm(e aF;f9TDQSw!u1<2d(OOqRjp}0I4}Ji!$aVSv delta 56 zcmca`N@~+_sST2hTxM2=mQlwT*cSC~R%R?@WaMa`%G5rUi4llFG&2yh05R+KsZ4CL F3jq`R5pVzi diff --git a/state/map.yaml b/state/map.yaml index 17c5732b..b5a9fa35 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -70,7 +70,7 @@ data_flow: - move historical proof to git, commits, smoke artifacts, or distilled evidence rather than plan prose active_subgoals: - - Use `notes/conceptual-substitution-audit-2026-07-12.md` plus `notes/receipt-writer-provenance-audit-2026-07-12.md` as the current authority-corrosion maps. Snapshot promotion, synthetic smoke escape, unbound operator completion, hidden service execution flags, generic-bootstrap publication of provider advertisements/Eve surfaces/hosted tools, the central topology-derived Odin publisher, and all-provider state writers are cut. Provider absence survives bootstrap; the query CLI cannot proclaim seven providers active over RUDP; each cluster daemon publishes only its own advertisement, surface, tools, and heartbeat. Next remove or test-gate dead public receipt constructors where provider binaries are absent and audit remaining projections, caches, schedulers, adapters, and non-receipt smokes for borrowed authority or path escape. + - Use `notes/conceptual-substitution-audit-2026-07-12.md` plus `notes/receipt-writer-provenance-audit-2026-07-12.md` as the current authority-corrosion maps. Snapshot promotion, synthetic smoke escape, unbound operator completion, hidden service execution flags, generic-bootstrap publication of provider advertisements/Eve surfaces/hosted tools, the central topology-derived Odin publisher, all-provider state writers, and daemon-side generic bootstrap are cut. Provider absence survives bootstrap; the query CLI cannot proclaim seven providers active over RUDP; each cluster daemon requires persisted topology and writes only its own advertisement, surface, tools, and heartbeat through narrow reads. Next remove or test-gate dead public receipt constructors where provider binaries are absent and audit remaining projections, caches, schedulers, adapters, and non-receipt smokes for borrowed authority or path escape. - `swarm-overview` is an Epiphany-local, renderer-neutral diagnostic projection over provider-owned typed state. It owns no lifecycle, discovery, composition, or mutation authority. Epiphany publishes clean provider-owned Eve surfaces; Odin may discover them; downstream lowerers and compositors remain outside Epiphany's concern. - Idunn owns daemon survival and service lifecycle physiology. Codex/operator sessions may inspect, generate runbooks, and route explicit operator authority, but keeping daemons alive belongs to Idunn-owned service lifecycle receipts, scheduler policy, audits, and aftercare. Do not let Self, diagnostic projections, or ad hoc wrapper summaries become a second daemon-keeper. Global tool readbacks for Self `service-health`, `service-policy-directory`, and `swarm-online-runbook` state `lifecycleOwner=Idunn` and `hostedBody=Epiphany` without service mutation or private-state exposure. - Use `notes/epiphany-cultmesh-dreaming-roadmap.md` as the design authority for distributed Epiphany dreaming. Public dreams are separately authored typed documents distributed through CultMesh/CultNet; private state remains local and cannot be shared by flipping a visibility flag. Foreign dreams are external thought weather until a reviewed local adoption receipt digests them into memory, planning, doctrine, or governance.