Collapse duplicate Atlas authoring authority

This commit is contained in:
Meta Vens 2026-08-24 00:29:40 +02:00
commit ce306e230a
4 changed files with 73 additions and 666 deletions

View file

@ -11,10 +11,6 @@ use super::impact_ingress::{
};
use super::projector::{atlas_projection_digest, evaluate_atlas_compatibility};
pub const ATLAS_SURFACE_OFFER_WRITE_INTENT_SCHEMA: &str =
"epiphany.model.atlas.surface_offer_write_intent.v0";
pub const ATLAS_DEPENDENCY_CLAIM_WRITE_INTENT_SCHEMA: &str =
"epiphany.model.atlas.dependency_claim_write_intent.v0";
pub const ATLAS_DEPENDENCY_VERIFICATION_WRITE_INTENT_SCHEMA: &str =
"epiphany.soul.atlas.dependency_verification_write_intent.v0";
pub const ATLAS_DEPENDENCY_IMPACT_WRITE_INTENT_SCHEMA: &str =
@ -42,95 +38,6 @@ pub struct AtlasStrongRead<T> {
pub document: T,
}
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case", tag = "transition")]
pub enum AtlasSurfaceOfferTransition {
Deprecate {
replacement: Option<AtlasStrongRead<AtlasSurfaceOffer>>,
},
Withdraw,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct AtlasSurfaceOfferTransitionInput {
pub context: AtlasPlannerContext,
pub expected_current_source: AtlasMindSourceVersion,
pub current: AtlasStrongRead<AtlasSurfaceOffer>,
pub transition: AtlasSurfaceOfferTransition,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct AtlasSurfaceOfferAdmissionInput {
pub context: AtlasPlannerContext,
pub offer: AtlasSurfaceOffer,
}
#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)]
#[cultcache(
type = "epiphany.model.atlas.surface_offer_write_intent.v0",
schema = "epiphany.model.atlas.surface_offer_write_intent.v0"
)]
pub struct AtlasSurfaceOfferWriteIntent {
#[cultcache(key = 0)]
pub schema_version: String,
#[cultcache(key = 1)]
pub intent_id: String,
#[cultcache(key = 2)]
pub local_repository: AtlasRepositoryIdentity,
#[cultcache(key = 3)]
pub body_basis: crate::RepositoryBodyObservationBasis,
#[cultcache(key = 4)]
pub expected_current_source: Option<AtlasMindSourceVersion>,
#[cultcache(key = 5)]
pub replacement_source: Option<AtlasMindSourceVersion>,
#[cultcache(key = 6)]
pub next_source: AtlasMindSourceVersion,
#[cultcache(key = 7)]
pub next: AtlasSurfaceOffer,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum AtlasDependencyClaimTransition {
Retire,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct AtlasDependencyClaimTransitionInput {
pub context: AtlasPlannerContext,
pub expected_current_source: AtlasMindSourceVersion,
pub current: AtlasStrongRead<AtlasDependencyClaim>,
pub transition: AtlasDependencyClaimTransition,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct AtlasDependencyClaimAdmissionInput {
pub context: AtlasPlannerContext,
pub claim: AtlasDependencyClaim,
}
#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)]
#[cultcache(
type = "epiphany.model.atlas.dependency_claim_write_intent.v0",
schema = "epiphany.model.atlas.dependency_claim_write_intent.v0"
)]
pub struct AtlasDependencyClaimWriteIntent {
#[cultcache(key = 0)]
pub schema_version: String,
#[cultcache(key = 1)]
pub intent_id: String,
#[cultcache(key = 2)]
pub local_repository: AtlasRepositoryIdentity,
#[cultcache(key = 3)]
pub body_basis: crate::RepositoryBodyObservationBasis,
#[cultcache(key = 4)]
pub expected_current_source: Option<AtlasMindSourceVersion>,
#[cultcache(key = 5)]
pub next_source: AtlasMindSourceVersion,
#[cultcache(key = 6)]
pub next: AtlasDependencyClaim,
}
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AtlasEvidenceArtifactVersion {
@ -228,193 +135,6 @@ pub struct AtlasDependencyImpactWriteIntent {
pub proposal: AtlasLocalImpactProposal,
}
pub fn plan_surface_offer_transition(
input: AtlasSurfaceOfferTransitionInput,
) -> Result<AtlasSurfaceOfferWriteIntent> {
validate_context(&input.context)?;
validate_exact_local_read(
&input.current,
ATLAS_SURFACE_OFFER_SCHEMA,
&input.current.document.surface_id.to_string(),
)?;
require_expected_source(
&input.expected_current_source,
&input.current.source,
"surface offer",
)?;
let current = &input.current.document;
if current.provider != input.context.local_repository {
bail!("Atlas surface lifecycle planner cannot write a foreign repository offer")
}
let (next_lifecycle, replacement_source) = match (&current.lifecycle, input.transition) {
(AtlasOfferLifecycle::Active, AtlasSurfaceOfferTransition::Deprecate { replacement }) => {
let replacement_source = replacement
.as_ref()
.map(|replacement| validate_replacement_offer(&input.context, current, replacement))
.transpose()?;
let replacement_surface_id = replacement
.as_ref()
.map(|replacement| replacement.document.surface_id);
(
AtlasOfferLifecycle::Deprecated {
replacement_surface_id,
},
replacement_source,
)
}
(
AtlasOfferLifecycle::Active | AtlasOfferLifecycle::Deprecated { .. },
AtlasSurfaceOfferTransition::Withdraw,
) => (AtlasOfferLifecycle::Withdrawn, None),
_ => bail!("Atlas surface offer lifecycle transition is illegal or already complete"),
};
let mut next = current.clone();
next.lifecycle = next_lifecycle;
next.validate()?;
let next_source = local_next_source(
&input.current.source,
ATLAS_SURFACE_OFFER_SCHEMA,
next.surface_id.to_string(),
&next,
)?;
let mut intent = AtlasSurfaceOfferWriteIntent {
schema_version: ATLAS_SURFACE_OFFER_WRITE_INTENT_SCHEMA.into(),
intent_id: String::new(),
local_repository: input.context.local_repository,
body_basis: input.context.current_body_basis,
expected_current_source: Some(input.current.source),
replacement_source,
next_source,
next,
};
intent.intent_id = surface_offer_intent_id(&intent)?;
intent.validate()?;
Ok(intent)
}
pub fn admit_surface_offer(
input: AtlasSurfaceOfferAdmissionInput,
) -> Result<AtlasSurfaceOfferWriteIntent> {
validate_context(&input.context)?;
input.offer.validate()?;
if input.offer.provider != input.context.local_repository
|| input.offer.lifecycle != AtlasOfferLifecycle::Active
{
bail!("Atlas offer admission requires an active locally owned offer")
}
let basis_source = AtlasMindSourceVersion {
store_id: LOCAL_MIND_STORE_ID.into(),
document_type: ATLAS_SURFACE_OFFER_SCHEMA.into(),
document_key: input.offer.surface_id.to_string(),
schema_id: Some(ATLAS_SURFACE_OFFER_SCHEMA.into()),
payload_sha256: sha256(&rmp_serde::to_vec(&input.offer)?),
};
let next_source = local_next_source(
&basis_source,
ATLAS_SURFACE_OFFER_SCHEMA,
input.offer.surface_id.to_string(),
&input.offer,
)?;
let mut intent = AtlasSurfaceOfferWriteIntent {
schema_version: ATLAS_SURFACE_OFFER_WRITE_INTENT_SCHEMA.into(),
intent_id: String::new(),
local_repository: input.context.local_repository,
body_basis: input.context.current_body_basis,
expected_current_source: None,
replacement_source: None,
next_source,
next: input.offer,
};
intent.intent_id = surface_offer_intent_id(&intent)?;
intent.validate()?;
Ok(intent)
}
pub fn plan_dependency_claim_transition(
input: AtlasDependencyClaimTransitionInput,
) -> Result<AtlasDependencyClaimWriteIntent> {
validate_context(&input.context)?;
validate_exact_local_read(
&input.current,
ATLAS_DEPENDENCY_CLAIM_SCHEMA,
&input.current.document.claim_id.to_string(),
)?;
require_expected_source(
&input.expected_current_source,
&input.current.source,
"dependency claim",
)?;
let current = &input.current.document;
if current.consumer != input.context.local_repository {
bail!("Atlas claim lifecycle planner cannot write a foreign repository claim")
}
let next_lifecycle = match (current.lifecycle, input.transition) {
(AtlasClaimLifecycle::Active, AtlasDependencyClaimTransition::Retire) => {
AtlasClaimLifecycle::Retired
}
_ => bail!("Atlas dependency claim lifecycle transition is illegal or already complete"),
};
let mut next = current.clone();
next.lifecycle = next_lifecycle;
next.validate()?;
let next_source = local_next_source(
&input.current.source,
ATLAS_DEPENDENCY_CLAIM_SCHEMA,
next.claim_id.to_string(),
&next,
)?;
let mut intent = AtlasDependencyClaimWriteIntent {
schema_version: ATLAS_DEPENDENCY_CLAIM_WRITE_INTENT_SCHEMA.into(),
intent_id: String::new(),
local_repository: input.context.local_repository,
body_basis: input.context.current_body_basis,
expected_current_source: Some(input.current.source),
next_source,
next,
};
intent.intent_id = dependency_claim_intent_id(&intent)?;
intent.validate()?;
Ok(intent)
}
pub fn admit_dependency_claim(
input: AtlasDependencyClaimAdmissionInput,
) -> Result<AtlasDependencyClaimWriteIntent> {
validate_context(&input.context)?;
input.claim.validate()?;
if input.claim.consumer != input.context.local_repository
|| input.claim.lifecycle != AtlasClaimLifecycle::Active
{
bail!("Atlas claim admission requires an active locally owned claim")
}
let basis_source = AtlasMindSourceVersion {
store_id: LOCAL_MIND_STORE_ID.into(),
document_type: ATLAS_DEPENDENCY_CLAIM_SCHEMA.into(),
document_key: input.claim.claim_id.to_string(),
schema_id: Some(ATLAS_DEPENDENCY_CLAIM_SCHEMA.into()),
payload_sha256: sha256(&rmp_serde::to_vec(&input.claim)?),
};
let next_source = local_next_source(
&basis_source,
ATLAS_DEPENDENCY_CLAIM_SCHEMA,
input.claim.claim_id.to_string(),
&input.claim,
)?;
let mut intent = AtlasDependencyClaimWriteIntent {
schema_version: ATLAS_DEPENDENCY_CLAIM_WRITE_INTENT_SCHEMA.into(),
intent_id: String::new(),
local_repository: input.context.local_repository,
body_basis: input.context.current_body_basis,
expected_current_source: None,
next_source,
next: input.claim,
};
intent.intent_id = dependency_claim_intent_id(&intent)?;
intent.validate()?;
Ok(intent)
}
pub fn admit_dependency_verification(
input: AtlasDependencyVerificationAdmissionInput,
) -> Result<AtlasDependencyVerificationWriteIntent> {
@ -657,104 +377,6 @@ impl AtlasEvidenceArtifactRead {
}
}
impl AtlasSurfaceOfferWriteIntent {
pub fn validate(&self) -> Result<()> {
require_schema(
&self.schema_version,
ATLAS_SURFACE_OFFER_WRITE_INTENT_SCHEMA,
)?;
validate_intent_context(&self.local_repository, &self.body_basis, &self.intent_id)?;
self.next.validate()?;
if self.next.provider != self.local_repository {
bail!("Atlas surface offer intent names a foreign write owner")
}
match (&self.expected_current_source, &self.next.lifecycle) {
(None, AtlasOfferLifecycle::Active) => {}
(
Some(expected),
AtlasOfferLifecycle::Deprecated { .. } | AtlasOfferLifecycle::Withdrawn,
) => {
validate_source_identity(
expected,
LOCAL_MIND_STORE_ID,
ATLAS_SURFACE_OFFER_SCHEMA,
&self.next.surface_id.to_string(),
)?;
}
_ => bail!("Atlas surface offer admission/transition ownership is ambiguous"),
}
validate_exact_source(
&self.next_source,
LOCAL_MIND_STORE_ID,
ATLAS_SURFACE_OFFER_SCHEMA,
&self.next.surface_id.to_string(),
&self.next,
)?;
match (&self.next.lifecycle, &self.replacement_source) {
(AtlasOfferLifecycle::Active, None) => {}
(
AtlasOfferLifecycle::Deprecated {
replacement_surface_id: Some(replacement_surface_id),
},
Some(replacement),
) => validate_source_identity(
replacement,
LOCAL_MIND_STORE_ID,
ATLAS_SURFACE_OFFER_SCHEMA,
&replacement_surface_id.to_string(),
)?,
(
AtlasOfferLifecycle::Deprecated {
replacement_surface_id: None,
}
| AtlasOfferLifecycle::Withdrawn,
None,
) => {}
_ => bail!("Atlas surface offer intent has an ambiguous replacement target"),
}
if self.intent_id != surface_offer_intent_id(self)? {
bail!("Atlas surface offer write intent id is not canonical")
}
Ok(())
}
}
impl AtlasDependencyClaimWriteIntent {
pub fn validate(&self) -> Result<()> {
require_schema(
&self.schema_version,
ATLAS_DEPENDENCY_CLAIM_WRITE_INTENT_SCHEMA,
)?;
validate_intent_context(&self.local_repository, &self.body_basis, &self.intent_id)?;
self.next.validate()?;
if self.next.consumer != self.local_repository {
bail!("Atlas dependency claim intent names a foreign write owner")
}
let key = self.next.claim_id.to_string();
match (&self.expected_current_source, self.next.lifecycle) {
(None, AtlasClaimLifecycle::Active) => {}
(Some(expected), AtlasClaimLifecycle::Retired) => validate_source_identity(
expected,
LOCAL_MIND_STORE_ID,
ATLAS_DEPENDENCY_CLAIM_SCHEMA,
&key,
)?,
_ => bail!("Atlas dependency claim admission/transition ownership is ambiguous"),
}
validate_exact_source(
&self.next_source,
LOCAL_MIND_STORE_ID,
ATLAS_DEPENDENCY_CLAIM_SCHEMA,
&key,
&self.next,
)?;
if self.intent_id != dependency_claim_intent_id(self)? {
bail!("Atlas dependency claim write intent id is not canonical")
}
Ok(())
}
}
impl AtlasDependencyVerificationWriteIntent {
pub fn validate(&self) -> Result<()> {
require_schema(
@ -994,26 +616,6 @@ fn local_next_source<T: Serialize>(
})
}
fn validate_replacement_offer(
context: &AtlasPlannerContext,
current: &AtlasSurfaceOffer,
replacement: &AtlasStrongRead<AtlasSurfaceOffer>,
) -> Result<AtlasMindSourceVersion> {
validate_exact_local_read(
replacement,
ATLAS_SURFACE_OFFER_SCHEMA,
&replacement.document.surface_id.to_string(),
)?;
if replacement.document.provider != context.local_repository
|| replacement.document.surface_id == current.surface_id
|| replacement.document.lifecycle != AtlasOfferLifecycle::Active
|| replacement.document.contract.contract_id() != current.contract.contract_id()
{
bail!("Atlas replacement surface is foreign, recursive, inactive, or contract-ambiguous")
}
Ok(replacement.source.clone())
}
fn validate_publication_read(read: &AtlasStrongRead<AtlasPublicationEnvelope>) -> Result<()> {
validate_exact_source(
&read.source,
@ -1087,29 +689,6 @@ fn validate_optional_current_impact(
Ok(())
}
fn surface_offer_intent_id(intent: &AtlasSurfaceOfferWriteIntent) -> Result<String> {
Ok(sha256(&rmp_serde::to_vec_named(&(
ATLAS_SURFACE_OFFER_WRITE_INTENT_SCHEMA,
&intent.local_repository,
&intent.body_basis,
&intent.expected_current_source,
&intent.replacement_source,
&intent.next_source,
&intent.next,
))?))
}
fn dependency_claim_intent_id(intent: &AtlasDependencyClaimWriteIntent) -> Result<String> {
Ok(sha256(&rmp_serde::to_vec_named(&(
ATLAS_DEPENDENCY_CLAIM_WRITE_INTENT_SCHEMA,
&intent.local_repository,
&intent.body_basis,
&intent.expected_current_source,
&intent.next_source,
&intent.next,
))?))
}
fn dependency_verification_intent_id(
intent: &AtlasDependencyVerificationWriteIntent,
) -> Result<String> {
@ -1318,103 +897,6 @@ mod tests {
)
}
#[test]
fn offer_transition_is_keyed_to_current_and_replacement_versions() -> Result<()> {
let temp = tempfile::tempdir()?;
let local = repository(&temp, "local")?;
let current = strong_read(
LOCAL_MIND_STORE_ID,
ATLAS_SURFACE_OFFER_SCHEMA,
Uuid::from_u128(1).to_string(),
offer(&local, Uuid::from_u128(1)),
)?;
let replacement = strong_read(
LOCAL_MIND_STORE_ID,
ATLAS_SURFACE_OFFER_SCHEMA,
Uuid::from_u128(2).to_string(),
offer(&local, Uuid::from_u128(2)),
)?;
let intent = plan_surface_offer_transition(AtlasSurfaceOfferTransitionInput {
context: context(&local),
expected_current_source: current.source.clone(),
current: current.clone(),
transition: AtlasSurfaceOfferTransition::Deprecate {
replacement: Some(replacement.clone()),
},
})?;
assert_eq!(intent.replacement_source, Some(replacement.source));
assert!(matches!(
intent.next.lifecycle,
AtlasOfferLifecycle::Deprecated {
replacement_surface_id: Some(id)
} if id == Uuid::from_u128(2)
));
assert_eq!(intent.expected_current_source, Some(current.source));
intent.validate()?;
Ok(())
}
#[test]
fn lifecycle_planners_refuse_stale_foreign_and_terminal_sources() -> Result<()> {
let temp = tempfile::tempdir()?;
let local = repository(&temp, "local")?;
let foreign = repository(&temp, "foreign")?;
let current_offer = strong_read(
LOCAL_MIND_STORE_ID,
ATLAS_SURFACE_OFFER_SCHEMA,
Uuid::from_u128(3).to_string(),
offer(&local, Uuid::from_u128(3)),
)?;
let mut stale = current_offer.source.clone();
stale.payload_sha256 = digest("stale");
assert!(
plan_surface_offer_transition(AtlasSurfaceOfferTransitionInput {
context: context(&local),
expected_current_source: stale,
current: current_offer,
transition: AtlasSurfaceOfferTransition::Withdraw,
})
.is_err()
);
let foreign_offer = strong_read(
LOCAL_MIND_STORE_ID,
ATLAS_SURFACE_OFFER_SCHEMA,
Uuid::from_u128(6).to_string(),
offer(&foreign, Uuid::from_u128(6)),
)?;
assert!(
plan_surface_offer_transition(AtlasSurfaceOfferTransitionInput {
context: context(&local),
expected_current_source: foreign_offer.source.clone(),
current: foreign_offer,
transition: AtlasSurfaceOfferTransition::Withdraw,
})
.is_err()
);
let claim_id = Uuid::from_u128(4);
let surface_id = Uuid::from_u128(5);
let mut retired = claim(&local, &foreign, claim_id, surface_id);
retired.lifecycle = AtlasClaimLifecycle::Retired;
let retired = strong_read(
LOCAL_MIND_STORE_ID,
ATLAS_DEPENDENCY_CLAIM_SCHEMA,
claim_id.to_string(),
retired,
)?;
assert!(
plan_dependency_claim_transition(AtlasDependencyClaimTransitionInput {
context: context(&local),
expected_current_source: retired.source.clone(),
current: retired,
transition: AtlasDependencyClaimTransition::Retire,
})
.is_err()
);
Ok(())
}
#[test]
fn soul_verification_binds_exact_signed_publications_and_artifact() -> Result<()> {
let temp = tempfile::tempdir()?;

View file

@ -627,69 +627,6 @@ pub fn pin_atlas_publisher_trust_anchor(
.compare_and_swap_trust_binding(expected_revision, binding)
}
pub fn commit_atlas_surface_offer_intent(
runtime_mind_store: &Path,
intent: &AtlasSurfaceOfferWriteIntent,
committed_at: &str,
) -> Result<crate::EpiphanyMindCommitOutcome> {
intent.validate()?;
require_current_atlas_body_basis(runtime_mind_store, &intent.body_basis)?;
let mut cache = crate::runtime_spine_cache(runtime_mind_store)?;
cache.pull_all_backing_stores()?;
let mut strong_reads = exact_or_absent_local_source(
&cache,
intent.expected_current_source.as_ref(),
ATLAS_SURFACE_OFFER_SCHEMA,
&intent.next.surface_id.to_string(),
)?
.into_iter()
.collect::<Vec<_>>();
if let Some(replacement) = intent.replacement_source.as_ref() {
strong_reads.push(exact_local_source(&cache, replacement)?);
}
let provenance = prepared_envelope(intent.intent_id.clone(), intent)?;
let write = prepared_envelope(intent.next.surface_id.to_string(), &intent.next)?;
crate::commit_typed_organ_mind_mutation(
runtime_mind_store,
"Modeling",
provenance,
"Modeling.atlas.surface_offer",
strong_reads,
vec![write],
committed_at,
)
}
pub fn commit_atlas_dependency_claim_intent(
runtime_mind_store: &Path,
intent: &AtlasDependencyClaimWriteIntent,
committed_at: &str,
) -> Result<crate::EpiphanyMindCommitOutcome> {
intent.validate()?;
require_current_atlas_body_basis(runtime_mind_store, &intent.body_basis)?;
let mut cache = crate::runtime_spine_cache(runtime_mind_store)?;
cache.pull_all_backing_stores()?;
let strong_reads = exact_or_absent_local_source(
&cache,
intent.expected_current_source.as_ref(),
ATLAS_DEPENDENCY_CLAIM_SCHEMA,
&intent.next.claim_id.to_string(),
)?
.into_iter()
.collect::<Vec<_>>();
let provenance = prepared_envelope(intent.intent_id.clone(), intent)?;
let write = prepared_envelope(intent.next.claim_id.to_string(), &intent.next)?;
crate::commit_typed_organ_mind_mutation(
runtime_mind_store,
"Modeling",
provenance,
"Modeling.atlas.dependency_claim",
strong_reads,
vec![write],
committed_at,
)
}
pub fn commit_atlas_dependency_verification_intent(
runtime_mind_store: &Path,
intent: &AtlasDependencyVerificationWriteIntent,
@ -1167,7 +1104,7 @@ mod tests {
use semver::{Version, VersionReq};
#[test]
fn local_offer_and_claim_intents_commit_through_mind_cas() -> Result<()> {
fn modeling_owned_offer_and_claim_support_verification_and_body_drift() -> Result<()> {
let temp = tempfile::tempdir()?;
let store = temp.path().join("runtime.cc");
crate::initialize_runtime_spine(
@ -1188,80 +1125,70 @@ mod tests {
}];
let local = AtlasRepositoryIdentity::new("swarm", "workspace")?;
let provider = AtlasRepositoryIdentity::new("swarm", "provider")?;
let offer = AtlasSurfaceOffer {
schema_version: ATLAS_SURFACE_OFFER_SCHEMA.into(),
provider: local.clone(),
surface_id: uuid::Uuid::from_u128(1),
contract: AtlasContractDescriptor::Semver {
contract_id: "contract:local".into(),
version: Version::parse("1.0.0")?,
let seed = crate::EpiphanyRepoModelSeed::new(
"atlas-modeling-seed",
"atlas-modeling-graph",
"swarm",
"workspace",
body.body_binding_sha256.clone(),
crate::EpiphanyRepoModelSeedDocuments {
domains: Vec::new(),
nodes: Vec::new(),
edges: Vec::new(),
frontier: Vec::new(),
},
lifecycle: AtlasOfferLifecycle::Active,
label: "Local contract surface".into(),
body_evidence: body_evidence.clone(),
};
let offer_intent = admit_surface_offer(AtlasSurfaceOfferAdmissionInput {
context: AtlasPlannerContext {
local_repository: local.clone(),
current_body_basis: body.clone(),
},
offer: offer.clone(),
})?;
assert!(matches!(
commit_atlas_surface_offer_intent(&store, &offer_intent, "2026-08-14T00:00:02Z")?,
crate::EpiphanyMindCommitOutcome::Committed(_)
));
let claim = AtlasDependencyClaim {
schema_version: ATLAS_DEPENDENCY_CLAIM_SCHEMA.into(),
consumer: local.clone(),
claim_id: uuid::Uuid::from_u128(2),
target: AtlasDependencyTarget::Exact {
provider: provider.clone(),
surface_id: uuid::Uuid::from_u128(3),
requirement: AtlasContractRequirement::Semver {
contract_id: "contract:provider".into(),
requirement: VersionReq::parse("^1")?,
)?;
crate::initialize_keyed_repo_model(&store, &seed, "2026-08-14T00:00:01Z")?;
let proposal = crate::EpiphanyRepoModelMutationProposal::new(
"atlas-modeling-proposal",
"atlas-modeling-request",
"atlas-modeling-result",
vec!["atlas-modeling-evidence".into()],
body.clone(),
vec![
crate::EpiphanyRepoModelMutationOperation::CreateSurfaceOffer {
label: "Local contract surface".into(),
contract: AtlasContractDescriptor::Semver {
contract_id: "contract:local".into(),
version: Version::parse("1.0.0")?,
},
source_refs: vec![manifest.entries[0].path.clone()],
},
},
entanglement_kind: AtlasEntanglementKind::Runtime,
failure_semantics: AtlasFailureSemantics::FailClosed,
impact_scope: AtlasImpactScope::WholeRepository,
lifecycle: AtlasClaimLifecycle::Active,
label: "Provider runtime dependency".into(),
body_evidence: body_evidence.clone(),
};
let claim_intent = admit_dependency_claim(AtlasDependencyClaimAdmissionInput {
context: AtlasPlannerContext {
local_repository: claim.consumer.clone(),
current_body_basis: body.clone(),
},
claim: claim.clone(),
})?;
assert!(matches!(
commit_atlas_dependency_claim_intent(&store, &claim_intent, "2026-08-14T00:00:03Z")?,
crate::EpiphanyMindCommitOutcome::Committed(_)
));
crate::EpiphanyRepoModelMutationOperation::CreateDependencyClaim {
label: "Provider runtime dependency".into(),
target: AtlasDependencyTarget::Exact {
provider: provider.clone(),
surface_id: uuid::Uuid::from_u128(3),
requirement: AtlasContractRequirement::Semver {
contract_id: "contract:provider".into(),
requirement: VersionReq::parse("^1")?,
},
},
entanglement_kind: AtlasEntanglementKind::Runtime,
failure_semantics: AtlasFailureSemantics::FailClosed,
impact_scope: AtlasImpactScope::WholeRepository,
source_refs: vec![manifest.entries[0].path.clone()],
},
],
)?;
let plan = crate::plan_repo_model_mutation(&store, &proposal)?;
let mut cache = crate::runtime_spine_cache(&store)?;
cache.pull_all_backing_stores()?;
assert_eq!(
cache.get::<AtlasSurfaceOffer>(&offer.surface_id.to_string())?,
Some(offer)
);
assert_eq!(
cache.get::<AtlasDependencyClaim>(&claim.claim_id.to_string())?,
Some(claim.clone())
);
assert_eq!(
cache
.get_all::<crate::EpiphanyMindCommitReceipt>()?
.into_iter()
.filter(|receipt| receipt.invariant_owner.starts_with("Modeling.atlas."))
.count(),
2
);
let provenance = cache.prepare_entry(&proposal.proposal_id, &proposal)?.0;
assert!(matches!(
crate::commit_typed_organ_mind_mutation(
&store,
"Modeling",
provenance,
"Modeling.repo_model_mutation",
plan.strong_reads,
plan.writes,
"2026-08-14T00:00:02Z",
)?,
crate::EpiphanyMindCommitOutcome::Committed(_)
));
let view = crate::assemble_repo_model_view(&store)?;
let claim = view.dependency_claims[0].clone();
let local_signer = enroll_service_identity_at::<AtlasRepositorySigningIdentity>(
&temp.path().join("local-atlas-identity.cc"),

View file

@ -302,7 +302,7 @@ pub use runtime_spine::model_pass_failure_for_request;
pub use runtime_spine::open_coordinator_run;
pub use runtime_spine::open_runtime_model_execution;
pub use runtime_spine::prepare_runtime_spine_heartbeat_job;
pub use runtime_spine::promote_autonomous_direction_options_for_modeling;
pub(crate) use runtime_spine::promote_autonomous_direction_options_for_modeling;
pub use runtime_spine::put_hands_action_intent;
pub use runtime_spine::put_hands_action_review;
pub use runtime_spine::put_hands_command_receipt;
@ -320,17 +320,17 @@ pub use runtime_spine::retain_completed_runtime_sessions;
pub use runtime_spine::retain_failed_runtime_worker_attempts;
pub use runtime_spine::retain_fulfilled_runtime_worker_attempts;
pub use runtime_spine::review_repo_frontier_planning_failure;
pub use runtime_spine::runtime_authenticated_public_source_lookups_for_worker;
pub(crate) use runtime_spine::runtime_authenticated_public_source_lookups_for_worker;
pub use runtime_spine::runtime_hands_command_receipt;
pub use runtime_spine::runtime_hands_commit_receipt;
pub use runtime_spine::runtime_hands_patch_receipt;
pub use runtime_spine::runtime_has_actionable_hands_frontier;
pub(crate) use runtime_spine::runtime_has_actionable_hands_frontier;
pub use runtime_spine::runtime_job_snapshot;
pub use runtime_spine::runtime_identity;
pub use runtime_spine::runtime_registered_document_types;
pub use runtime_spine::runtime_reorient_worker_result;
pub(crate) use runtime_spine::runtime_reorient_worker_result;
pub use runtime_spine::runtime_repo_frontier_planning_lifecycle;
pub use runtime_spine::runtime_repo_frontier_research_lifecycle;
pub(crate) use runtime_spine::runtime_repo_frontier_research_lifecycle;
pub use runtime_spine::runtime_requested_public_source_refs_for_worker;
pub use runtime_spine::runtime_role_worker_result;
pub use runtime_spine::runtime_spine_cache;
@ -340,7 +340,7 @@ pub use runtime_spine::runtime_worker_launch_request;
pub use runtime_spine::runtime_worker_process_claim;
pub use runtime_spine::runtime_worker_process_claims;
pub use runtime_spine::select_and_commit_repo_frontier_planning_request;
pub use runtime_spine::select_and_commit_repo_frontier_research_request;
pub(crate) use runtime_spine::select_and_commit_repo_frontier_research_request;
pub use runtime_spine::select_and_commit_repo_frontier_route;
pub use runtime_spine::terminalize_model_pass_failure_session;
pub(crate) use runtime_worker_attempt::{RuntimeTypedRequestRef, WorkerProcessStatus};

View file

@ -97,7 +97,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.v13";
pub const RUNTIME_SPINE_SCHEMA_VERSION: &str = "epiphany.runtime_spine.v14";
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";
@ -846,8 +846,6 @@ fn runtime_spine_schema_cache() -> Result<CultCache> {
cache.register_entry_type::<crate::UserObjectiveIntake>()?;
cache.register_entry_type::<EpiphanyRuntimeIdentity>()?;
cache.register_entry_type::<EpiphanyRuntimeSwarmBinding>()?;
cache.register_entry_type::<crate::AtlasSurfaceOfferWriteIntent>()?;
cache.register_entry_type::<crate::AtlasDependencyClaimWriteIntent>()?;
cache.register_entry_type::<crate::AtlasDependencyVerificationWriteIntent>()?;
cache.register_entry_type::<crate::AtlasDependencyImpactWriteIntent>()?;
cache.register_entry_type::<EpiphanyRuntimeSession>()?;
@ -3194,7 +3192,7 @@ pub(crate) fn frontier_verification_request_for_launch(
Ok(Some(request))
}
pub fn runtime_authenticated_public_source_lookups_for_worker(
pub(crate) fn runtime_authenticated_public_source_lookups_for_worker(
store_path: impl AsRef<Path>,
worker_job_id: &str,
) -> Result<Vec<EyesSourceLookupReceipt>> {
@ -5409,7 +5407,7 @@ pub fn bind_runtime_repository_domain(
Ok(binding)
}
pub fn promote_autonomous_direction_options_for_modeling(
pub(crate) fn promote_autonomous_direction_options_for_modeling(
runtime_store: impl AsRef<Path>,
repository: &str,
workspace: &str,
@ -6507,7 +6505,7 @@ fn frontier_item_is_actionable_for_organ(
/// admitted exactly once and contains an item the route committer can hand to
/// Hands. Status projection must use this instead of assuming that a clear
/// CRRC lane implies implementation authority.
pub fn runtime_has_actionable_hands_frontier(runtime_store: impl AsRef<Path>) -> Result<bool> {
pub(crate) fn runtime_has_actionable_hands_frontier(runtime_store: impl AsRef<Path>) -> Result<bool> {
runtime_has_actionable_frontier_for_organ(runtime_store, "Hands")
}
@ -6745,7 +6743,7 @@ fn current_repo_frontier_research_request(
.then_some(frontier))
}
pub fn select_and_commit_repo_frontier_research_request(
pub(crate) fn select_and_commit_repo_frontier_research_request(
runtime_store: impl AsRef<Path>,
at: &str,
) -> Result<RepoFrontierResearchRequest> {
@ -6906,7 +6904,7 @@ impl RepoFrontierResearchLifecycle {
/// review, and accepted-packet lifecycle. This is the launch-currency owner:
/// an uncovered frontier is not launchable while its current attempt is still
/// running or awaiting review.
pub fn runtime_repo_frontier_research_lifecycle(
pub(crate) fn runtime_repo_frontier_research_lifecycle(
runtime_store: impl AsRef<Path>,
) -> Result<RepoFrontierResearchLifecycle> {
let runtime_store = runtime_store.as_ref();
@ -7545,7 +7543,7 @@ fn require_worker_decision_context(
Ok(())
}
pub fn runtime_reorient_worker_result(
pub(crate) fn runtime_reorient_worker_result(
store_path: impl AsRef<Path>,
job_id: &str,
) -> Result<Option<EpiphanyRuntimeReorientWorkerResult>> {