Collapse repository domain binding

This commit is contained in:
Meta Vens 2026-08-24 08:50:03 +02:00
commit 6f5d660082
4 changed files with 16 additions and 66 deletions

View file

@ -10,19 +10,17 @@ use epiphany_core::{
derive_resident_cognition_readiness, enqueue_resident_self_pressure_idempotent,
import_bifrost_persona_feedback_deliveries, ingest_resident_self_current_work_pressure,
issue_resident_self_grant, live_resident_self_typed_request_ids,
load_epiphany_cultmesh_swarm_brake,
load_resident_self_state, materialize_resident_self_domain_obligations,
observe_process_instance, prepare_resident_self_launch,
publish_resident_provider_readiness, reap_exited_child_process,
load_epiphany_cultmesh_swarm_brake, load_resident_self_state,
materialize_resident_self_domain_obligations, observe_process_instance,
prepare_resident_self_launch, publish_resident_provider_readiness, reap_exited_child_process,
recover_dead_runtime_worker_attempts, resident_cognitive_runtime_id,
resident_prepared_launch_thread_id, resident_self_child_claim,
resident_self_local_provider_status, retain_completed_runtime_sessions,
retain_failed_runtime_worker_attempts,
retain_fulfilled_runtime_worker_attempts, retain_resident_self_lifecycles,
runtime_worker_process_claims, settle_resident_self_exited_coordinator,
settle_resident_self_receipt_free_dead_coordinator, terminate_process_instance,
validate_persona_feedback_store_separation, validate_resident_self_coordinator_receipt_binding,
validate_resident_self_store_separation,
retain_failed_runtime_worker_attempts, retain_fulfilled_runtime_worker_attempts,
retain_resident_self_lifecycles, runtime_worker_process_claims,
settle_resident_self_exited_coordinator, settle_resident_self_receipt_free_dead_coordinator,
terminate_process_instance, validate_persona_feedback_store_separation,
validate_resident_self_coordinator_receipt_binding, validate_resident_self_store_separation,
};
use serde_json::json;
use std::collections::BTreeMap;
@ -264,7 +262,6 @@ fn cycle(
bind_runtime_repository_domain(
&args.policy.runtime_store,
&args.feedback_target_repository,
&Utc::now().to_rfc3339(),
)?;
materialize_resident_self_domain_obligations(
&args.policy.runtime_store,
@ -806,5 +803,4 @@ mod brake_tests {
)?);
Ok(())
}
}

View file

@ -3950,11 +3950,7 @@ mod tests {
let (body_binding, _) =
crate::load_repository_body_status(std::path::Path::new(&route.body_store_path))?
.expect("runtime Body store remains authenticated");
crate::bind_runtime_repository_domain(
&store,
"GameCult/Epiphany",
"2026-08-17T00:00:05.100Z",
)?;
crate::bind_runtime_repository_domain(&store, "GameCult/Epiphany")?;
let direction_request = crate::commit_admitted_model_direction_consideration_request(
&store,
"2026-08-17T00:00:05.200Z",

View file

@ -62,9 +62,6 @@ pub const REPO_FRONTIER_RESEARCH_REQUEST_CONTRACT: &str =
pub const REPO_FRONTIER_WORK_PROPOSAL_CONTRACT: &str =
"epiphany.repo_frontier_work_proposal.inert.v3";
pub const RUNTIME_REPOSITORY_DOMAIN_BINDING_KEY: &str = "runtime-repository-domain-binding";
pub const RUNTIME_REPOSITORY_DOMAIN_BINDING_SCHEMA_VERSION: &str =
"epiphany.runtime.repository_domain_binding.v0";
pub const RUNTIME_REPOSITORY_DOMAIN_BINDING_CONTRACT: &str = "deployment configuration binds one organizational repository name to one exact authenticated repository Body; Self may consume but not relabel it";
pub const REPO_FRONTIER_PROPOSAL_MODELING_REQUEST_SCHEMA_VERSION: &str =
"epiphany.coordinator.repo_frontier_proposal_modeling_request.v1";
pub const REPO_FRONTIER_PROPOSAL_MODELING_REQUEST_CONTRACT: &str =
@ -115,23 +112,9 @@ pub fn repo_frontier_proposal_payload_sha256(
)]
pub struct RuntimeRepositoryDomainBinding {
#[cultcache(key = 0)]
pub schema_version: String,
#[cultcache(key = 1)]
pub binding_id: String,
#[cultcache(key = 2)]
pub repository_full_name: String,
#[cultcache(key = 3)]
pub runtime_id: String,
#[cultcache(key = 4)]
pub swarm_id: String,
#[cultcache(key = 5)]
pub workspace_id: String,
#[cultcache(key = 6)]
#[cultcache(key = 1)]
pub body_binding_sha256: String,
#[cultcache(key = 7)]
pub bound_at: String,
#[cultcache(key = 8)]
pub contract: String,
}
#[derive(Debug, Clone, PartialEq, Eq, DatabaseEntry)]

View file

@ -21,11 +21,10 @@ use crate::repo_model_gateway::{
REPO_FRONTIER_RESEARCH_REQUEST_CONTRACT, REPO_FRONTIER_RESEARCH_REQUEST_SCHEMA_VERSION,
REPO_FRONTIER_ROUTE_CONTRACT, REPO_FRONTIER_ROUTE_SCHEMA_VERSION,
REPO_FRONTIER_WORK_PROPOSAL_CONTRACT, REPO_FRONTIER_WORK_PROPOSAL_SCHEMA_VERSION,
RUNTIME_REPOSITORY_DOMAIN_BINDING_CONTRACT, RUNTIME_REPOSITORY_DOMAIN_BINDING_KEY,
RUNTIME_REPOSITORY_DOMAIN_BINDING_SCHEMA_VERSION, RepoFrontierHandsAuthority,
RepoFrontierModelingRequest, RepoFrontierNextOrgan, RepoFrontierPlanCandidate,
RepoFrontierPlanDecision, RepoFrontierPlanDecisionReceipt, RepoFrontierPlanMindDecision,
RepoFrontierPlanMindRequest, RepoFrontierPlanningFailureReview, RepoFrontierPlanningLifecycle,
RUNTIME_REPOSITORY_DOMAIN_BINDING_KEY, RepoFrontierHandsAuthority, RepoFrontierModelingRequest,
RepoFrontierNextOrgan, RepoFrontierPlanCandidate, RepoFrontierPlanDecision,
RepoFrontierPlanDecisionReceipt, RepoFrontierPlanMindDecision, RepoFrontierPlanMindRequest,
RepoFrontierPlanningFailureReview, RepoFrontierPlanningLifecycle,
RepoFrontierPlanningLifecycleStage, RepoFrontierPlanningRequest,
RepoFrontierProposalModelingRequest, RepoFrontierResearchRequest, RepoFrontierRoute,
RepoFrontierVerdictDisposition, RepoFrontierWorkProposal, RuntimeRepositoryDomainBinding,
@ -70,7 +69,7 @@ pub const COORDINATOR_RUN_RECEIPT_TYPE: &str = "epiphany.coordinator_run_receipt
pub const RUNTIME_IDENTITY_KEY: &str = "self";
pub const RUNTIME_SWARM_BINDING_KEY: &str = "runtime-swarm-binding";
pub const RUNTIME_SWARM_BINDING_SCHEMA_VERSION: &str = "epiphany.runtime.swarm_binding.v1";
pub const RUNTIME_SPINE_SCHEMA_VERSION: &str = "epiphany.runtime_spine.v30";
pub const RUNTIME_SPINE_SCHEMA_VERSION: &str = "epiphany.runtime_spine.v31";
pub const EPIPHANY_RUNTIME_ROOT_SESSION_ID: &str = "epiphany-main";
pub const RUNTIME_MODEL_EXECUTION_BINDING_SCHEMA_VERSION: &str =
"epiphany.runtime.model_execution_binding.v0";
@ -4996,13 +4995,7 @@ fn validate_autonomous_proposal_origin_request(
|| modeling_request.proposal_payload_sha256 != proposal.payload_sha256
|| modeling_request.runtime_id != request.runtime_id
|| modeling_request.thread_id != request.thread_id
|| domain.schema_version != RUNTIME_REPOSITORY_DOMAIN_BINDING_SCHEMA_VERSION
|| domain.contract != RUNTIME_REPOSITORY_DOMAIN_BINDING_CONTRACT
|| domain.binding_id != RUNTIME_REPOSITORY_DOMAIN_BINDING_KEY
|| domain.repository_full_name != modeling_request.repository
|| domain.runtime_id != route.runtime_id
|| domain.swarm_id != route.swarm_id
|| domain.workspace_id != route.workspace_id
|| domain.body_binding_sha256 != route.body_binding_sha256
|| proposal.title != option.title
|| proposal.body != option.summary
@ -5066,7 +5059,6 @@ pub(crate) fn validate_repo_frontier_proposal_modeling_request(
pub fn bind_runtime_repository_domain(
runtime_store: impl AsRef<Path>,
repository_full_name: &str,
bound_at: &str,
) -> Result<RuntimeRepositoryDomainBinding> {
if !repository_full_name.starts_with("GameCult/")
|| repository_full_name["GameCult/".len()..].trim().is_empty()
@ -5076,8 +5068,6 @@ pub fn bind_runtime_repository_domain(
"runtime repository domain requires a canonical GameCult name"
));
}
chrono::DateTime::parse_from_rfc3339(bound_at)
.map_err(|_| anyhow!("runtime repository domain timestamp must be RFC3339"))?;
let runtime_store = runtime_store.as_ref();
let mut cache = runtime_spine_cache(runtime_store)?;
cache.pull_all_backing_stores()?;
@ -5096,22 +5086,13 @@ pub fn bind_runtime_repository_domain(
return Err(anyhow!("runtime repository domain Body authority mismatch"));
}
let binding = RuntimeRepositoryDomainBinding {
schema_version: RUNTIME_REPOSITORY_DOMAIN_BINDING_SCHEMA_VERSION.into(),
binding_id: RUNTIME_REPOSITORY_DOMAIN_BINDING_KEY.into(),
repository_full_name: repository_full_name.into(),
runtime_id: route.runtime_id.clone(),
swarm_id: route.swarm_id.clone(),
workspace_id: route.workspace_id.clone(),
body_binding_sha256: route.body_binding_sha256.clone(),
bound_at: bound_at.into(),
contract: RUNTIME_REPOSITORY_DOMAIN_BINDING_CONTRACT.into(),
};
if let Some(existing) =
cache.get::<RuntimeRepositoryDomainBinding>(RUNTIME_REPOSITORY_DOMAIN_BINDING_KEY)?
{
let mut replay = binding;
replay.bound_at = existing.bound_at.clone();
return if replay == existing {
return if binding == existing {
Ok(existing)
} else {
Err(anyhow!("runtime repository domain is immutable"))
@ -5193,13 +5174,7 @@ pub(crate) fn promote_autonomous_direction_options_for_modeling(
!= route.body_binding_sha256
|| Path::new(workspace).canonicalize()?
!= Path::new(&body_binding.git_top_level).canonicalize()?
|| domain.schema_version != RUNTIME_REPOSITORY_DOMAIN_BINDING_SCHEMA_VERSION
|| domain.contract != RUNTIME_REPOSITORY_DOMAIN_BINDING_CONTRACT
|| domain.binding_id != RUNTIME_REPOSITORY_DOMAIN_BINDING_KEY
|| domain.repository_full_name != repository
|| domain.runtime_id != route.runtime_id
|| domain.swarm_id != route.swarm_id
|| domain.workspace_id != route.workspace_id
|| domain.body_binding_sha256 != route.body_binding_sha256
{
return Err(anyhow!(