Replace false SCM authority with durable task ownership

This commit is contained in:
Meta Vens 2026-07-15 11:47:54 +01:00
commit 98dd338994
8 changed files with 922 additions and 2842 deletions

File diff suppressed because it is too large Load diff

View file

@ -586,6 +586,7 @@ mod tests {
use epiphany_core::runtime_hands_commit_receipt;
use epiphany_core::runtime_hands_patch_receipt;
use epiphany_core::runtime_latest_hands_receipt_chain_after;
use sha2::Digest;
#[test]
fn records_patch_command_and_commit_receipts_against_approved_gate() -> Result<()> {
@ -789,6 +790,18 @@ mod tests {
created_at: "2026-06-02T00:00:00Z".to_string(),
},
)?;
let grant = epiphany_core::substrate_gate_coordinator_implementation_grant(
"substrate-grant-test".to_string(),
"hands-job-test".to_string(),
requested_paths.clone(),
"2026-06-02T00:00:00Z".to_string(),
);
epiphany_core::put_substrate_gate_repo_access_grant_receipt(store, &grant)?;
let requested_action = if operations == ["patch"] {
"patch"
} else {
"continueImplementation"
};
let intent = HandsActionIntent {
schema_version: HANDS_ACTION_INTENT_SCHEMA_VERSION.to_string(),
intent_id: "hands-intent-test".to_string(),
@ -796,7 +809,7 @@ mod tests {
binding_id: "implementation-worker".to_string(),
role: "epiphany-hands".to_string(),
authority_scope: "epiphany.role.implementation".to_string(),
requested_action: "continueImplementation".to_string(),
requested_action: requested_action.to_string(),
requested_paths,
substrate_gate_grant_receipt_id: "substrate-grant-test".to_string(),
requested_at: "2026-06-02T00:00:01Z".to_string(),
@ -815,6 +828,100 @@ mod tests {
"2026-06-02T00:00:02Z".to_string(),
);
put_hands_action_review(store, &review)?;
seed_frontier_authority(store, &intent, &review)?;
Ok(())
}
fn seed_frontier_authority(
store: &PathBuf,
intent: &HandsActionIntent,
review: &HandsActionReview,
) -> Result<()> {
let item = epiphany_core::RepoFrontierItem {
id: "hands-frontier-test".to_string(),
migration_body: "Exercise the bounded Hands receipt chain.".to_string(),
question: "Does the consequence preserve its authority chain?".to_string(),
gap: "An unrouted consequence is invalid.".to_string(),
target_claim_ids: vec!["hands-claim-test".to_string()],
source_scope: intent.requested_paths.clone(),
recommended_next_organ: "Hands".to_string(),
evidence_refs: vec!["hands-fixture".to_string()],
status: epiphany_core::RepoFrontierStatus::Active,
..Default::default()
};
let item_hash = format!(
"{:x}",
sha2::Sha256::digest(rmp_serde::to_vec_named(&item)?)
);
let mut model = epiphany_core::EpiphanyMemoryGraphSnapshot {
schema_version: Some(epiphany_core::MEMORY_GRAPH_SCHEMA_VERSION.to_string()),
graph_id: "hands-action-test-model".to_string(),
model_revision: 1,
domains: vec![epiphany_core::EpiphanyMemoryDomain {
id: "repo".to_string(),
profile: epiphany_core::EpiphanyMemoryProfile::RepoArchitecture,
title: "Repository".to_string(),
lifecycle: epiphany_core::EpiphanyMemoryLifecycle::Accepted,
..Default::default()
}],
nodes: vec![epiphany_core::EpiphanyMemoryNode {
id: "hands-claim-test".to_string(),
domain_id: "repo".to_string(),
profile: epiphany_core::EpiphanyMemoryProfile::RepoArchitecture,
kind: epiphany_core::EpiphanyMemoryNodeKind::RuntimeContract,
title: "Hands authority".to_string(),
claim: "Hands consequences require an exact frontier authority.".to_string(),
question: "Is the authority chain exact?".to_string(),
action_implication: "Bind every receipt to the routed scope.".to_string(),
source_hashes: vec!["anchor:missing".to_string()],
lifecycle: epiphany_core::EpiphanyMemoryLifecycle::Accepted,
..Default::default()
}],
frontier: vec![item.clone()],
..Default::default()
};
model.model_hash = epiphany_core::memory_graph_model_hash(&model)?;
let entry = epiphany_core::EpiphanyMemoryGraphEntry::from_snapshot(&model)?;
let route = epiphany_core::RepoFrontierRoute {
schema_version: epiphany_core::REPO_FRONTIER_ROUTE_SCHEMA_VERSION.to_string(),
route_id: "hands-route-test".to_string(),
next_organ: epiphany_core::RepoFrontierNextOrgan::Hands,
model_revision: model.model_revision,
model_hash: model.model_hash.clone(),
admission_receipt_id: "hands-admission-test".to_string(),
frontier_item_id: item.id.clone(),
frontier_item_hash: item_hash.clone(),
migration_body: item.migration_body.clone(),
question: item.question.clone(),
gap: item.gap.clone(),
target_claim_ids: item.target_claim_ids.clone(),
source_scope: item.source_scope.clone(),
adopted_plan: None,
selected_at: "2026-06-02T00:00:02Z".to_string(),
contract: epiphany_core::REPO_FRONTIER_ROUTE_CONTRACT.to_string(),
};
let mut cache = epiphany_core::runtime_spine_cache(store)?;
cache.put(epiphany_core::MEMORY_GRAPH_KEY, &entry)?;
cache.put(&route.route_id, &route)?;
epiphany_core::put_repo_frontier_hands_authority(
store,
&epiphany_core::RepoFrontierHandsAuthority {
schema_version: epiphany_core::REPO_FRONTIER_HANDS_AUTHORITY_SCHEMA_VERSION
.to_string(),
authority_id: "hands-authority-test".to_string(),
route_id: route.route_id,
model_revision: route.model_revision,
model_hash: route.model_hash,
frontier_item_id: route.frontier_item_id,
frontier_item_hash: item_hash,
hands_intent_id: intent.intent_id.clone(),
hands_review_id: review.review_id.clone(),
substrate_grant_receipt_id: intent.substrate_gate_grant_receipt_id.clone(),
requested_paths: intent.requested_paths.clone(),
granted_at: "2026-06-02T00:00:03Z".to_string(),
contract: epiphany_core::REPO_FRONTIER_HANDS_AUTHORITY_CONTRACT.to_string(),
},
)?;
Ok(())
}

View file

@ -1901,6 +1901,7 @@ mod tests {
created_at: "2026-06-02T00:00:00Z".to_string(),
},
)?;
seed_hands_frontier(&store)?;
let status = json!({
"scene": {
"scene": {
@ -1945,4 +1946,74 @@ mod tests {
);
Ok(())
}
fn seed_hands_frontier(store: &Path) -> Result<()> {
let item = epiphany_core::RepoFrontierItem {
id: "coordinator-hands-frontier-test".to_string(),
migration_body: "Exercise the coordinator-owned Hands gate.".to_string(),
question: "Does Self route the admitted implementation frontier?".to_string(),
gap: "Hands cannot act without a routed Modeling frontier.".to_string(),
target_claim_ids: vec!["coordinator-hands-claim-test".to_string()],
source_scope: vec!["epiphany-core/src".to_string()],
recommended_next_organ: "Hands".to_string(),
evidence_refs: vec!["fixture:mvp-coordinator".to_string()],
status: epiphany_core::RepoFrontierStatus::Active,
..Default::default()
};
let mut model = epiphany_core::EpiphanyMemoryGraphSnapshot {
schema_version: Some(epiphany_core::MEMORY_GRAPH_SCHEMA_VERSION.to_string()),
graph_id: "mvp-coordinator-test-model".to_string(),
model_revision: 1,
domains: vec![epiphany_core::EpiphanyMemoryDomain {
id: "repo".to_string(),
profile: epiphany_core::EpiphanyMemoryProfile::RepoArchitecture,
title: "Repository".to_string(),
lifecycle: epiphany_core::EpiphanyMemoryLifecycle::Accepted,
..Default::default()
}],
nodes: vec![epiphany_core::EpiphanyMemoryNode {
id: "coordinator-hands-claim-test".to_string(),
domain_id: "repo".to_string(),
profile: epiphany_core::EpiphanyMemoryProfile::RepoArchitecture,
kind: epiphany_core::EpiphanyMemoryNodeKind::RuntimeContract,
title: "Coordinator Hands gate".to_string(),
claim: "Implementation begins from an admitted routed frontier.".to_string(),
question: "Is the route current?".to_string(),
action_implication: "Route the exact admitted source scope.".to_string(),
source_hashes: vec!["anchor:missing".to_string()],
lifecycle: epiphany_core::EpiphanyMemoryLifecycle::Accepted,
..Default::default()
}],
frontier: vec![item],
..Default::default()
};
model.model_hash = epiphany_core::memory_graph_model_hash(&model)?;
let entry = epiphany_core::EpiphanyMemoryGraphEntry::from_snapshot(&model)?;
let admission = epiphany_core::RepoModelAdmissionReceipt {
schema_version: epiphany_core::REPO_MODEL_ADMISSION_RECEIPT_SCHEMA_VERSION.to_string(),
receipt_id: "coordinator-hands-admission-test".to_string(),
review_id: "coordinator-hands-model-review-test".to_string(),
result_id: "coordinator-hands-model-result-test".to_string(),
patch_id: "coordinator-hands-model-patch-test".to_string(),
patch_sha256: "fixture".to_string(),
previous_revision: 0,
previous_hash: String::new(),
admitted_revision: model.model_revision,
admitted_hash: model.model_hash.clone(),
admitted_at: "2026-06-02T00:00:00Z".to_string(),
contract: epiphany_core::REPO_MODEL_ADMISSION_CONTRACT.to_string(),
purpose: epiphany_core::RepoModelPatchPurpose::Evolution,
frontier_route_id: String::new(),
verification_request_id: String::new(),
soul_verdict_receipt_id: String::new(),
frontier_modeling_request_id: String::new(),
proposal_modeling_request_id: String::new(),
claim_repair_request_id: String::new(),
frontier_plan_decision_id: String::new(),
};
let mut cache = epiphany_core::runtime_spine_cache(store)?;
cache.put(epiphany_core::MEMORY_GRAPH_KEY, &entry)?;
cache.put(&admission.receipt_id, &admission)?;
Ok(())
}
}

View file

@ -131,33 +131,29 @@ const DIRECT_IDUNN_DEPLOYMENT_AFTERCARE_AUDIT_COMMAND: &str = "epiphany-work dep
const WRAPPER_SERVICE_TICK_COMMAND: &str = "tools/epiphany_local_run.ps1 -Mode service-tick";
const WRAPPER_SERVICE_POLICY_DIRECTORY_COMMAND: &str =
"tools/epiphany_local_run.ps1 -Mode service-policy-directory";
const WRAPPER_SERVICE_EXECUTION_AUDIT_COMMAND: &str =
"tools/epiphany_local_run.ps1 -Mode service-execution-audit";
const WRAPPER_SERVICE_EXECUTION_RUNBOOK_COMMAND: &str =
"tools/epiphany_local_run.ps1 -Mode service-execution-runbook";
const WRAPPER_SERVICE_EXECUTION_READINESS_COMMAND: &str =
"tools/epiphany_local_run.ps1 -Mode service-execution-readiness";
const WRAPPER_MANAGED_SERVICE_TASK_PLAN_COMMAND: &str =
"tools/epiphany_local_run.ps1 -Mode managed-service-task-plan";
const WRAPPER_SERVICE_INSTALL_EXECUTE_COMMAND: &str =
"tools/epiphany_local_run.ps1 -Mode service-install-execute";
const WRAPPER_SERVICE_STATUS_COMMAND: &str = "tools/epiphany_local_run.ps1 -Mode service-status";
const WRAPPER_SERVICE_RECONCILE_COMMAND: &str =
"tools/epiphany_local_run.ps1 -Mode service-reconcile";
"tools/epiphany_local_run.ps1 -Mode managed-service-task-install";
const WRAPPER_SERVICE_STATUS_COMMAND: &str =
"tools/epiphany_local_run.ps1 -Mode managed-service-task-status";
const WRAPPER_SERVICE_START_EXECUTE_COMMAND: &str =
"tools/epiphany_local_run.ps1 -Mode service-start-execute";
"tools/epiphany_local_run.ps1 -Mode managed-service-task-start";
const WRAPPER_SERVICE_STOP_EXECUTE_COMMAND: &str =
"tools/epiphany_local_run.ps1 -Mode service-stop-execute";
const WRAPPER_CLUSTER_SERVICE_EXECUTION_AUDIT_COMMAND: &str =
"tools/epiphany_local_run.ps1 -Mode cluster-service-execution-audit";
const WRAPPER_CLUSTER_SERVICE_EXECUTION_RUNBOOK_COMMAND: &str =
"tools/epiphany_local_run.ps1 -Mode cluster-service-execution-runbook";
const WRAPPER_CLUSTER_SERVICE_EXECUTION_READINESS_COMMAND: &str =
"tools/epiphany_local_run.ps1 -Mode cluster-service-execution-readiness";
const WRAPPER_CLUSTER_SERVICE_INSTALL_EXECUTE_COMMAND: &str =
"tools/epiphany_local_run.ps1 -Mode cluster-service-install-execute";
const WRAPPER_CLUSTER_SERVICE_START_EXECUTE_COMMAND: &str =
"tools/epiphany_local_run.ps1 -Mode cluster-service-start-execute";
const WRAPPER_CLUSTER_SERVICE_STOP_EXECUTE_COMMAND: &str =
"tools/epiphany_local_run.ps1 -Mode cluster-service-stop-execute";
"tools/epiphany_local_run.ps1 -Mode managed-service-task-stop";
// Historical lifecycle receipts still use these typed families. Their follow-up
// routes are deliberately demoted: cluster SCM has no replacement owner, while
// single-service SCM receipts lead to the Idunn scheduled-task plan.
const WRAPPER_SERVICE_EXECUTION_AUDIT_COMMAND: &str = WRAPPER_MANAGED_SERVICE_TASK_PLAN_COMMAND;
const WRAPPER_SERVICE_EXECUTION_RUNBOOK_COMMAND: &str = WRAPPER_MANAGED_SERVICE_TASK_PLAN_COMMAND;
const WRAPPER_SERVICE_EXECUTION_READINESS_COMMAND: &str = WRAPPER_MANAGED_SERVICE_TASK_PLAN_COMMAND;
const WRAPPER_SERVICE_RECONCILE_COMMAND: &str = WRAPPER_SERVICE_STATUS_COMMAND;
const WRAPPER_CLUSTER_SERVICE_EXECUTION_AUDIT_COMMAND: &str = WRAPPER_OVERVIEW_COMMAND;
const WRAPPER_CLUSTER_SERVICE_EXECUTION_RUNBOOK_COMMAND: &str = WRAPPER_OVERVIEW_COMMAND;
const WRAPPER_CLUSTER_SERVICE_EXECUTION_READINESS_COMMAND: &str = WRAPPER_OVERVIEW_COMMAND;
const WRAPPER_CLUSTER_SERVICE_INSTALL_EXECUTE_COMMAND: &str = WRAPPER_OVERVIEW_COMMAND;
const WRAPPER_CLUSTER_SERVICE_START_EXECUTE_COMMAND: &str = WRAPPER_OVERVIEW_COMMAND;
const WRAPPER_CLUSTER_SERVICE_STOP_EXECUTE_COMMAND: &str = WRAPPER_OVERVIEW_COMMAND;
const DIRECT_BIFROST_PUBLICATION_COMMAND: &str =
"epiphany-verse-query bifrost-publication --target-repository <repo> --changed-path <path>";
const SERVICE_LIFECYCLE_OWNER: &str = "Idunn";
@ -7494,24 +7490,19 @@ fn service_execution_audit_check_tui_row(check: &EpiphanyServiceExecutionAuditCh
fn service_execution_check_follow_up_command(action: &str) -> &'static str {
match action {
"cluster-windows-service-execution-runbook" => {
WRAPPER_CLUSTER_SERVICE_EXECUTION_RUNBOOK_COMMAND
"cluster-windows-service-execution-runbook"
| "cluster-windows-service-execution-readiness"
| "cluster-windows-service-install"
| "cluster-windows-service-start"
| "cluster-windows-service-execution-audit"
| "cluster-windows-service-stop" => "none",
"windows-service-execution-runbook" | "windows-service-execution-readiness" => {
WRAPPER_MANAGED_SERVICE_TASK_PLAN_COMMAND
}
"cluster-windows-service-execution-readiness" => {
WRAPPER_CLUSTER_SERVICE_EXECUTION_READINESS_COMMAND
}
"cluster-windows-service-install" => WRAPPER_CLUSTER_SERVICE_INSTALL_EXECUTE_COMMAND,
"cluster-windows-service-start" => WRAPPER_CLUSTER_SERVICE_START_EXECUTE_COMMAND,
"cluster-windows-service-execution-audit" => {
WRAPPER_CLUSTER_SERVICE_EXECUTION_AUDIT_COMMAND
}
"cluster-windows-service-stop" => WRAPPER_CLUSTER_SERVICE_STOP_EXECUTE_COMMAND,
"windows-service-execution-runbook" => WRAPPER_SERVICE_EXECUTION_RUNBOOK_COMMAND,
"windows-service-execution-readiness" => WRAPPER_SERVICE_EXECUTION_READINESS_COMMAND,
"windows-service-install" => WRAPPER_SERVICE_INSTALL_EXECUTE_COMMAND,
"windows-service-start" => WRAPPER_SERVICE_START_EXECUTE_COMMAND,
"windows-service-status" => WRAPPER_SERVICE_STATUS_COMMAND,
"windows-service-reconcile" => WRAPPER_SERVICE_RECONCILE_COMMAND,
"windows-service-reconcile" => WRAPPER_SERVICE_STATUS_COMMAND,
"windows-service-stop" => WRAPPER_SERVICE_STOP_EXECUTE_COMMAND,
_ => "none",
}