Bind operator status to matching lifecycle evidence
This commit is contained in:
parent
22b343202f
commit
7d691e2247
8 changed files with 132 additions and 5 deletions
|
|
@ -10,6 +10,7 @@ use epiphany_core::epiphany_cultmesh_coordinator_run_receipt_from_summary_json;
|
|||
use epiphany_core::epiphany_cultmesh_hands_action_gate_from_summary_json;
|
||||
use epiphany_core::epiphany_cultmesh_role_review_event_from_summary_json;
|
||||
use epiphany_core::load_epiphany_cultmesh_operator_run_intent;
|
||||
use epiphany_core::load_epiphany_cultmesh_operator_run_receipt;
|
||||
use epiphany_core::load_latest_epiphany_cultmesh_operator_run_intent;
|
||||
use epiphany_core::load_latest_epiphany_cultmesh_operator_run_receipt;
|
||||
use epiphany_core::write_epiphany_cultmesh_coordinator_run_receipt;
|
||||
|
|
@ -126,10 +127,17 @@ fn main() -> Result<()> {
|
|||
"latest" => {
|
||||
let intent =
|
||||
load_latest_epiphany_cultmesh_operator_run_intent(&args.store, &args.runtime_id)?;
|
||||
let receipt =
|
||||
load_latest_epiphany_cultmesh_operator_run_receipt(&args.store, &args.runtime_id)?;
|
||||
let receipt = if let Some(intent) = intent.as_ref() {
|
||||
load_epiphany_cultmesh_operator_run_receipt(
|
||||
&args.store,
|
||||
&args.runtime_id,
|
||||
&intent.run_id,
|
||||
)?
|
||||
} else {
|
||||
load_latest_epiphany_cultmesh_operator_run_receipt(&args.store, &args.runtime_id)?
|
||||
};
|
||||
print_json(json!({
|
||||
"status": if intent.is_some() || receipt.is_some() { "ready" } else { "missing" },
|
||||
"status": operator_run_status(intent.as_ref(), receipt.as_ref()),
|
||||
"store": args.store,
|
||||
"intent": intent,
|
||||
"receipt": receipt,
|
||||
|
|
@ -242,6 +250,90 @@ fn main() -> Result<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn operator_run_status(
|
||||
intent: Option<&EpiphanyCultMeshOperatorRunIntentEntry>,
|
||||
receipt: Option<&EpiphanyCultMeshOperatorRunReceiptEntry>,
|
||||
) -> &'static str {
|
||||
match (intent, receipt) {
|
||||
(None, None) => "missing",
|
||||
(Some(_), None) => "requested",
|
||||
(None, Some(_)) => "orphaned-receipt",
|
||||
(Some(intent), Some(receipt))
|
||||
if intent.run_id == receipt.run_id && receipt.status == "completed" =>
|
||||
{
|
||||
"completed"
|
||||
}
|
||||
(Some(_), Some(_)) => "attention",
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
fn intent(run_id: &str) -> EpiphanyCultMeshOperatorRunIntentEntry {
|
||||
EpiphanyCultMeshOperatorRunIntentEntry {
|
||||
schema_version: EPIPHANY_CULTMESH_OPERATOR_RUN_INTENT_SCHEMA_VERSION.to_string(),
|
||||
runtime_id: "epiphany-test".to_string(),
|
||||
verse_id: EPIPHANY_CULTMESH_INTERNAL_VERSE_ID.to_string(),
|
||||
run_id: run_id.to_string(),
|
||||
requested_at_utc: "2026-07-13T00:00:00Z".to_string(),
|
||||
mode: "status".to_string(),
|
||||
root: "root".to_string(),
|
||||
workspace: "workspace".to_string(),
|
||||
thread_id: String::new(),
|
||||
codex_home: String::new(),
|
||||
target_dir: String::new(),
|
||||
max_steps: 1,
|
||||
timeout_seconds: 1,
|
||||
auto_review: false,
|
||||
no_ephemeral: false,
|
||||
artifact_root: "artifacts".to_string(),
|
||||
dogfood_root: String::new(),
|
||||
}
|
||||
}
|
||||
|
||||
fn receipt(run_id: &str, status: &str) -> EpiphanyCultMeshOperatorRunReceiptEntry {
|
||||
EpiphanyCultMeshOperatorRunReceiptEntry {
|
||||
schema_version: EPIPHANY_CULTMESH_OPERATOR_RUN_RECEIPT_SCHEMA_VERSION.to_string(),
|
||||
runtime_id: "epiphany-test".to_string(),
|
||||
verse_id: EPIPHANY_CULTMESH_INTERNAL_VERSE_ID.to_string(),
|
||||
run_id: run_id.to_string(),
|
||||
completed_at_utc: "2026-07-13T00:00:01Z".to_string(),
|
||||
mode: "status".to_string(),
|
||||
status: status.to_string(),
|
||||
result_path: "result.json".to_string(),
|
||||
artifact_root: "artifacts".to_string(),
|
||||
dogfood_root: String::new(),
|
||||
operator_snapshot_store: String::new(),
|
||||
operator_snapshot_id: String::new(),
|
||||
artifact_refs: Vec::new(),
|
||||
notes: Vec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn intent_presence_is_requested_not_ready() {
|
||||
let intent = intent("run-new");
|
||||
assert_eq!(operator_run_status(Some(&intent), None), "requested");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn only_matching_completed_receipt_closes_latest_intent() {
|
||||
let intent = intent("run-new");
|
||||
let old_receipt = receipt("run-old", "completed");
|
||||
let matching_receipt = receipt("run-new", "completed");
|
||||
assert_eq!(
|
||||
operator_run_status(Some(&intent), Some(&old_receipt)),
|
||||
"attention"
|
||||
);
|
||||
assert_eq!(
|
||||
operator_run_status(Some(&intent), Some(&matching_receipt)),
|
||||
"completed"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
struct Args {
|
||||
command: String,
|
||||
store: PathBuf,
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ fn main() -> Result<()> {
|
|||
let latest =
|
||||
load_latest_epiphany_cultmesh_operator_snapshot(&args.store, &args.runtime_id)?;
|
||||
print_json(json!({
|
||||
"status": if latest.is_some() { "ready" } else { "missing" },
|
||||
"status": if latest.is_some() { "loaded" } else { "missing" },
|
||||
"store": args.store,
|
||||
"snapshot": latest,
|
||||
}))?;
|
||||
|
|
|
|||
|
|
@ -2933,6 +2933,15 @@ pub fn load_latest_epiphany_cultmesh_operator_run_receipt(
|
|||
node.get(EPIPHANY_CULTMESH_OPERATOR_RUN_RECEIPT_LATEST_KEY)
|
||||
}
|
||||
|
||||
pub fn load_epiphany_cultmesh_operator_run_receipt(
|
||||
store_path: impl AsRef<Path>,
|
||||
runtime_id: impl Into<String>,
|
||||
run_id: &str,
|
||||
) -> Result<Option<EpiphanyCultMeshOperatorRunReceiptEntry>> {
|
||||
let node = open_epiphany_cultmesh_node(store_path, runtime_id)?;
|
||||
node.get(epiphany_cultmesh_operator_run_receipt_key(run_id).as_str())
|
||||
}
|
||||
|
||||
pub fn epiphany_cultmesh_coordinator_run_receipt_from_summary_json(
|
||||
runtime_id: impl Into<String>,
|
||||
receipt_id: impl Into<String>,
|
||||
|
|
|
|||
|
|
@ -425,6 +425,7 @@ 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_operator_run_intent;
|
||||
pub use cultmesh_integration::load_epiphany_cultmesh_operator_run_receipt;
|
||||
pub use cultmesh_integration::load_epiphany_cultmesh_operator_snapshot;
|
||||
pub use cultmesh_integration::load_epiphany_cultmesh_repo_work_map_entries;
|
||||
pub use cultmesh_integration::load_epiphany_cultmesh_repo_work_overviews;
|
||||
|
|
|
|||
|
|
@ -1464,3 +1464,19 @@ is `unconfigured`; active participants whose pending turns are running are
|
|||
smoke asserts the distinction at the emitted projection layer. State loading
|
||||
owns readability. Participant physiology derives scheduler status. Presence
|
||||
alone owns no readiness verdict.
|
||||
|
||||
## Cache presence is not operator-run readiness
|
||||
|
||||
The operator-run `latest` projection emitted `ready` when either a latest intent
|
||||
or a latest receipt existed. This collapsed request, execution, and completion,
|
||||
and the two independent latest mirrors could pair a new intent with an older
|
||||
run's receipt. A historical completion could therefore lend authority to work
|
||||
that had only been requested.
|
||||
|
||||
Readback now loads the latest intent, then looks up that intent's receipt by
|
||||
`run_id`. It reports `requested` until the matching receipt exists, `completed`
|
||||
only for a matching completed receipt, `attention` for an inconsistent pair,
|
||||
`orphaned-receipt` when receipt state exists without an intent, and `missing`
|
||||
when neither exists. The operator snapshot readback likewise reports `loaded`,
|
||||
not `ready`, when a snapshot is merely present. Cache lookup owns retrieval;
|
||||
the joined lifecycle evidence owns lifecycle status.
|
||||
|
|
|
|||
|
|
@ -555,3 +555,12 @@ as `unconfigured`, `active`, or `attention` from participants and pending-turn
|
|||
state. The focused library suite, all-bin check, and native heartbeat smoke pass.
|
||||
Continue through cache/freshness projections; do not let existence, successful
|
||||
decode, or a latest mirror impersonate current consequence authority.
|
||||
|
||||
Operator cache readback is also purified. `epiphany-operator-run latest` joins
|
||||
the latest intent to its exact receipt by `run_id`; a new intent cannot borrow
|
||||
an older latest completion. Its statuses are lifecycle facts (`missing`,
|
||||
`requested`, `completed`, `attention`, `orphaned-receipt`), never generic
|
||||
`ready`. `epiphany-operator-snapshot latest` reports present state as `loaded`.
|
||||
Negative unit coverage proves intent presence is only requested and mismatched
|
||||
receipt identity cannot close it. Both native smokes, 259 library tests, focused
|
||||
binary tests, and the all-bin check pass.
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -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 observation-to-consequence audit. Heartbeat projection now separates readable store state (`missing`/`loaded`) from participant-derived scheduler physiology (`unconfigured`/`active`/`attention`); state presence no longer emits readiness. Next inspect cache and latest-mirror projections for consequential status derived from existence, decode success, freshness assumptions, or free-text summaries. Keep closure's zero-substring invariant.
|
||||
next_action: Continue the observation-to-consequence audit. Heartbeat store presence no longer claims scheduler readiness, operator snapshots report `loaded`, and operator-run latest joins the newest intent to its exact `run_id` receipt before deriving lifecycle status; independent latest mirrors cannot counterfeit completion. Next inspect remaining `ready` projections, especially git/repository and provider-capability surfaces, for topology or existence standing in for operational readiness. Keep closure's zero-substring invariant.
|
||||
|
|
|
|||
Reference in a new issue