Delete unreachable RepoModel summary authority
This commit is contained in:
parent
5218cf2cae
commit
8bb039afff
12 changed files with 26 additions and 301 deletions
|
|
@ -795,7 +795,6 @@ mod tests {
|
|||
domains: vec![domain],
|
||||
nodes: vec![node],
|
||||
edges: Vec::new(),
|
||||
summaries: Vec::new(),
|
||||
frontier: vec![frontier],
|
||||
},
|
||||
)?,
|
||||
|
|
|
|||
|
|
@ -82,7 +82,6 @@ fn main() -> Result<()> {
|
|||
..Default::default()
|
||||
}],
|
||||
edges: Vec::new(),
|
||||
summaries: Vec::new(),
|
||||
frontier: Vec::new(),
|
||||
},
|
||||
)?;
|
||||
|
|
|
|||
|
|
@ -3755,7 +3755,6 @@ mod tests {
|
|||
domains: vec![domain],
|
||||
nodes: vec![node],
|
||||
edges: Vec::new(),
|
||||
summaries: Vec::new(),
|
||||
frontier: Vec::new(),
|
||||
},
|
||||
)?,
|
||||
|
|
|
|||
|
|
@ -113,7 +113,6 @@ pub use epiphany_state_model::EpiphanyMemoryDomain;
|
|||
pub use epiphany_state_model::EpiphanyMemoryEdge;
|
||||
pub use epiphany_state_model::EpiphanyMemoryLifecycle;
|
||||
pub use epiphany_state_model::EpiphanyMemoryNode;
|
||||
pub use epiphany_state_model::EpiphanyMemorySummary;
|
||||
pub use eyes_gateway::EYES_EVIDENCE_PACKET_SCHEMA_VERSION;
|
||||
pub use eyes_gateway::EYES_EVIDENCE_PACKET_TYPE;
|
||||
pub use eyes_gateway::EYES_SOURCE_LOOKUP_RECEIPT_SCHEMA_VERSION;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ pub use epiphany_state_model::EpiphanyMemoryGraphSnapshot;
|
|||
pub use epiphany_state_model::EpiphanyMemoryLifecycle;
|
||||
pub use epiphany_state_model::EpiphanyMemoryNode;
|
||||
pub use epiphany_state_model::EpiphanyMemoryNodeKind;
|
||||
pub use epiphany_state_model::EpiphanyMemorySummary;
|
||||
pub use epiphany_state_model::RepoFrontierAdoptedPlan;
|
||||
pub use epiphany_state_model::RepoFrontierItem;
|
||||
pub use epiphany_state_model::RepoFrontierStatus;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ use super::EpiphanyMemoryEdge;
|
|||
use super::EpiphanyMemoryGraphSnapshot;
|
||||
use super::EpiphanyMemoryLifecycle;
|
||||
use super::EpiphanyMemoryNode;
|
||||
use super::EpiphanyMemorySummary;
|
||||
use super::RepoFrontierStatus;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
|
||||
|
|
@ -73,7 +72,7 @@ pub fn validate_memory_graph_snapshot(
|
|||
validate_node(node, index, &domain_ids, &mut errors);
|
||||
}
|
||||
|
||||
let edge_ids = collect_unique(
|
||||
collect_unique(
|
||||
snapshot.edges.iter().map(|edge| edge.id.as_str()),
|
||||
"edges",
|
||||
&mut errors,
|
||||
|
|
@ -82,22 +81,6 @@ pub fn validate_memory_graph_snapshot(
|
|||
validate_edge(edge, index, &node_ids, &mut errors);
|
||||
}
|
||||
|
||||
collect_unique(
|
||||
snapshot.summaries.iter().map(|summary| summary.id.as_str()),
|
||||
"summaries",
|
||||
&mut errors,
|
||||
);
|
||||
for (index, summary) in snapshot.summaries.iter().enumerate() {
|
||||
validate_summary(
|
||||
summary,
|
||||
index,
|
||||
&domain_ids,
|
||||
&node_ids,
|
||||
&edge_ids,
|
||||
&mut errors,
|
||||
);
|
||||
}
|
||||
|
||||
let frontier_ids = collect_unique(
|
||||
snapshot.frontier.iter().map(|item| item.id.as_str()),
|
||||
"frontier",
|
||||
|
|
@ -378,75 +361,6 @@ fn validate_edge(
|
|||
);
|
||||
}
|
||||
|
||||
fn validate_summary(
|
||||
summary: &EpiphanyMemorySummary,
|
||||
index: usize,
|
||||
domain_ids: &HashSet<String>,
|
||||
node_ids: &HashSet<String>,
|
||||
edge_ids: &HashSet<String>,
|
||||
errors: &mut Vec<EpiphanyMemoryGraphValidationError>,
|
||||
) {
|
||||
let path = format!("summaries[{index}]");
|
||||
required(
|
||||
&summary.id,
|
||||
format!("{path}.id"),
|
||||
"summary id is required",
|
||||
errors,
|
||||
);
|
||||
if !domain_ids.contains(&summary.domain_id) {
|
||||
errors.push(EpiphanyMemoryGraphValidationError::new(
|
||||
format!("{path}.domain_id"),
|
||||
"summary references missing domain",
|
||||
));
|
||||
}
|
||||
if summary.covers_node_ids.is_empty() && summary.covers_edge_ids.is_empty() {
|
||||
errors.push(EpiphanyMemoryGraphValidationError::new(
|
||||
format!("{path}.covers_node_ids"),
|
||||
"summary must cover at least one node or edge",
|
||||
));
|
||||
}
|
||||
for node_id in &summary.covers_node_ids {
|
||||
if !node_ids.contains(node_id) {
|
||||
errors.push(EpiphanyMemoryGraphValidationError::new(
|
||||
format!("{path}.covers_node_ids"),
|
||||
format!("summary covers missing node {node_id}"),
|
||||
));
|
||||
}
|
||||
}
|
||||
for edge_id in &summary.covers_edge_ids {
|
||||
if !edge_ids.contains(edge_id) {
|
||||
errors.push(EpiphanyMemoryGraphValidationError::new(
|
||||
format!("{path}.covers_edge_ids"),
|
||||
format!("summary covers missing edge {edge_id}"),
|
||||
));
|
||||
}
|
||||
}
|
||||
required(
|
||||
&summary.target,
|
||||
format!("{path}.target"),
|
||||
"summary target is required",
|
||||
errors,
|
||||
);
|
||||
required(
|
||||
&summary.claim,
|
||||
format!("{path}.claim"),
|
||||
"summary claim is required",
|
||||
errors,
|
||||
);
|
||||
required(
|
||||
&summary.action_implication,
|
||||
format!("{path}.action_implication"),
|
||||
"summary action implication is required",
|
||||
errors,
|
||||
);
|
||||
if summary.question.trim().is_empty() && summary.tension.trim().is_empty() {
|
||||
errors.push(EpiphanyMemoryGraphValidationError::new(
|
||||
format!("{path}.question"),
|
||||
"summary must preserve a question or tension",
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
fn collect_unique<'a>(
|
||||
ids: impl IntoIterator<Item = &'a str>,
|
||||
path: &str,
|
||||
|
|
|
|||
|
|
@ -75,7 +75,6 @@ pub struct EpiphanyRepoModelPromptProjection {
|
|||
pub domains: Vec<epiphany_state_model::EpiphanyMemoryDomain>,
|
||||
pub nodes: Vec<epiphany_state_model::EpiphanyMemoryNode>,
|
||||
pub edges: Vec<epiphany_state_model::EpiphanyMemoryEdge>,
|
||||
pub summaries: Vec<epiphany_state_model::EpiphanyMemorySummary>,
|
||||
pub frontier: Vec<epiphany_state_model::RepoFrontierItem>,
|
||||
pub claim_obligations: Vec<crate::EpiphanyRepoModelClaimObligationsDocument>,
|
||||
pub surface_offers: Vec<crate::AtlasSurfaceOffer>,
|
||||
|
|
@ -92,7 +91,6 @@ impl From<crate::EpiphanyRepoModelView> for EpiphanyRepoModelPromptProjection {
|
|||
domains: value.domains,
|
||||
nodes: value.nodes,
|
||||
edges: value.edges,
|
||||
summaries: value.summaries,
|
||||
frontier: value.frontier,
|
||||
claim_obligations: value.claim_obligations,
|
||||
surface_offers: value.surface_offers,
|
||||
|
|
|
|||
|
|
@ -879,7 +879,6 @@ mod tests {
|
|||
domains: Vec::new(),
|
||||
nodes: Vec::new(),
|
||||
edges: Vec::new(),
|
||||
summaries: Vec::new(),
|
||||
frontier: Vec::new(),
|
||||
},
|
||||
)?,
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ use anyhow::{Result, anyhow};
|
|||
use cultcache_rs::{CultCache, CultCacheEnvelope, DatabaseEntry};
|
||||
use epiphany_state_model::{
|
||||
EpiphanyMemoryDomain, EpiphanyMemoryEdge, EpiphanyMemoryGraphSnapshot,
|
||||
EpiphanyMemoryNode, EpiphanyMemorySummary, RepoFrontierItem,
|
||||
EpiphanyMemoryNode, RepoFrontierItem,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sha2::{Digest, Sha256};
|
||||
|
|
@ -79,12 +79,6 @@ repo_document!(
|
|||
"EpiphanyRepoModelEdgeDocument",
|
||||
EpiphanyMemoryEdge
|
||||
);
|
||||
repo_document!(
|
||||
EpiphanyRepoModelSummaryDocument,
|
||||
"epiphany.mind.repo_model.summary.v1",
|
||||
"EpiphanyRepoModelSummaryDocument",
|
||||
EpiphanyMemorySummary
|
||||
);
|
||||
repo_document!(
|
||||
EpiphanyRepoModelFrontierDocument,
|
||||
"epiphany.mind.repo_model.frontier.v1",
|
||||
|
|
@ -113,7 +107,6 @@ pub struct EpiphanyRepoModelView {
|
|||
pub domains: Vec<EpiphanyMemoryDomain>,
|
||||
pub nodes: Vec<EpiphanyMemoryNode>,
|
||||
pub edges: Vec<EpiphanyMemoryEdge>,
|
||||
pub summaries: Vec<EpiphanyMemorySummary>,
|
||||
pub frontier: Vec<RepoFrontierItem>,
|
||||
pub claim_obligations: Vec<EpiphanyRepoModelClaimObligationsDocument>,
|
||||
pub surface_offers: Vec<crate::AtlasSurfaceOffer>,
|
||||
|
|
@ -142,7 +135,6 @@ impl EpiphanyRepoModelView {
|
|||
domains: self.domains.clone(),
|
||||
nodes: self.nodes.clone(),
|
||||
edges: self.edges.clone(),
|
||||
summaries: self.summaries.clone(),
|
||||
frontier: self.frontier.clone(),
|
||||
}
|
||||
}
|
||||
|
|
@ -241,7 +233,6 @@ pub struct EpiphanyRepoModelSeedDocuments {
|
|||
pub domains: Vec<EpiphanyMemoryDomain>,
|
||||
pub nodes: Vec<EpiphanyMemoryNode>,
|
||||
pub edges: Vec<EpiphanyMemoryEdge>,
|
||||
pub summaries: Vec<EpiphanyMemorySummary>,
|
||||
pub frontier: Vec<RepoFrontierItem>,
|
||||
}
|
||||
|
||||
|
|
@ -285,9 +276,6 @@ impl EpiphanyRepoModelSeed {
|
|||
documents
|
||||
.edges
|
||||
.sort_by(|left, right| left.id.cmp(&right.id));
|
||||
documents
|
||||
.summaries
|
||||
.sort_by(|left, right| left.id.cmp(&right.id));
|
||||
documents
|
||||
.frontier
|
||||
.sort_by(|left, right| left.id.cmp(&right.id));
|
||||
|
|
@ -336,7 +324,6 @@ impl EpiphanyRepoModelSeed {
|
|||
documents.domains,
|
||||
documents.nodes,
|
||||
documents.edges,
|
||||
documents.summaries,
|
||||
documents.frontier,
|
||||
obligations,
|
||||
)
|
||||
|
|
@ -346,9 +333,6 @@ impl EpiphanyRepoModelSeed {
|
|||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(tag = "operation", rename_all = "snake_case")]
|
||||
pub enum EpiphanyRepoModelMutationOperation {
|
||||
PutDomain {
|
||||
domain: EpiphanyMemoryDomain,
|
||||
},
|
||||
PutNode {
|
||||
node: EpiphanyMemoryNode,
|
||||
},
|
||||
|
|
@ -361,9 +345,6 @@ pub enum EpiphanyRepoModelMutationOperation {
|
|||
RetireEdge {
|
||||
edge_id: String,
|
||||
},
|
||||
PutSummary {
|
||||
summary: EpiphanyMemorySummary,
|
||||
},
|
||||
PutFrontier {
|
||||
item: RepoFrontierItem,
|
||||
},
|
||||
|
|
@ -474,7 +455,6 @@ pub(crate) fn register_repo_model_document_types(cache: &mut CultCache) -> Resul
|
|||
cache.register_entry_type::<EpiphanyRepoModelDomainDocument>()?;
|
||||
cache.register_entry_type::<EpiphanyRepoModelNodeDocument>()?;
|
||||
cache.register_entry_type::<EpiphanyRepoModelEdgeDocument>()?;
|
||||
cache.register_entry_type::<EpiphanyRepoModelSummaryDocument>()?;
|
||||
cache.register_entry_type::<EpiphanyRepoModelFrontierDocument>()?;
|
||||
cache.register_entry_type::<EpiphanyRepoModelClaimObligationsDocument>()?;
|
||||
cache.register_entry_type::<EpiphanyRepoModelMutationProposal>()?;
|
||||
|
|
@ -570,13 +550,6 @@ pub fn initialize_keyed_repo_model(
|
|||
.0,
|
||||
);
|
||||
}
|
||||
for value in &documents.summaries {
|
||||
writes.push(
|
||||
cache
|
||||
.prepare_entry(&value.id, &EpiphanyRepoModelSummaryDocument::new(value)?)?
|
||||
.0,
|
||||
);
|
||||
}
|
||||
for value in &documents.frontier {
|
||||
writes.push(
|
||||
cache
|
||||
|
|
@ -618,7 +591,6 @@ fn repo_model_view_matches_seed(
|
|||
&& view.domains == documents.domains
|
||||
&& view.nodes == documents.nodes
|
||||
&& view.edges == documents.edges
|
||||
&& view.summaries == documents.summaries
|
||||
&& view.frontier == documents.frontier
|
||||
&& view.claim_obligations
|
||||
== claim_obligations_for_frontier(&documents.nodes, &documents.frontier))
|
||||
|
|
@ -653,10 +625,6 @@ pub(crate) fn repo_model_write_key(envelope: &CultCacheEnvelope) -> Result<Optio
|
|||
rmp_serde::from_slice::<EpiphanyRepoModelEdgeDocument>(&envelope.payload)?
|
||||
.value()?
|
||||
.id
|
||||
} else if envelope.r#type == EpiphanyRepoModelSummaryDocument::TYPE {
|
||||
rmp_serde::from_slice::<EpiphanyRepoModelSummaryDocument>(&envelope.payload)?
|
||||
.value()?
|
||||
.id
|
||||
} else if envelope.r#type == EpiphanyRepoModelFrontierDocument::TYPE {
|
||||
rmp_serde::from_slice::<EpiphanyRepoModelFrontierDocument>(&envelope.payload)?
|
||||
.value()?
|
||||
|
|
@ -740,7 +708,7 @@ pub fn plan_repo_model_mutation(
|
|||
let identity_envelope = cache
|
||||
.get_envelope::<EpiphanyRepoModelIdentityDocument>(REPO_MODEL_IDENTITY_KEY)?
|
||||
.ok_or_else(|| anyhow!("RepoModel mutation lost its identity envelope"))?;
|
||||
let mut domains = view
|
||||
let domains = view
|
||||
.domains
|
||||
.iter()
|
||||
.cloned()
|
||||
|
|
@ -758,12 +726,6 @@ pub fn plan_repo_model_mutation(
|
|||
.cloned()
|
||||
.map(|value| (value.id.clone(), value))
|
||||
.collect::<BTreeMap<_, _>>();
|
||||
let mut summaries = view
|
||||
.summaries
|
||||
.iter()
|
||||
.cloned()
|
||||
.map(|value| (value.id.clone(), value))
|
||||
.collect::<BTreeMap<_, _>>();
|
||||
let mut frontier = view
|
||||
.frontier
|
||||
.iter()
|
||||
|
|
@ -784,13 +746,6 @@ pub fn plan_repo_model_mutation(
|
|||
_ => None,
|
||||
})
|
||||
.collect::<BTreeSet<_>>();
|
||||
let staged_domain_ids = operations
|
||||
.iter()
|
||||
.filter_map(|operation| match operation {
|
||||
EpiphanyRepoModelMutationOperation::PutDomain { domain } => Some(domain.id.clone()),
|
||||
_ => None,
|
||||
})
|
||||
.collect::<BTreeSet<_>>();
|
||||
let staged_frontier_ids = operations
|
||||
.iter()
|
||||
.filter_map(|operation| match operation {
|
||||
|
|
@ -798,14 +753,6 @@ pub fn plan_repo_model_mutation(
|
|||
_ => None,
|
||||
})
|
||||
.collect::<BTreeSet<_>>();
|
||||
let staged_edge_ids = operations
|
||||
.iter()
|
||||
.filter_map(|operation| match operation {
|
||||
EpiphanyRepoModelMutationOperation::PutEdge { edge } => Some(edge.id.clone()),
|
||||
EpiphanyRepoModelMutationOperation::RetireEdge { edge_id } => Some(edge_id.clone()),
|
||||
_ => None,
|
||||
})
|
||||
.collect::<BTreeSet<_>>();
|
||||
let operation_identities = operations
|
||||
.iter()
|
||||
.enumerate()
|
||||
|
|
@ -834,30 +781,13 @@ pub fn plan_repo_model_mutation(
|
|||
let mut writes = BTreeMap::new();
|
||||
for (operation_index, operation) in operations.iter().enumerate() {
|
||||
match operation {
|
||||
EpiphanyRepoModelMutationOperation::PutDomain { domain } => {
|
||||
require_semantic_id(&domain.id, "RepoModel domain")?;
|
||||
if let Some(existing) =
|
||||
cache.get_envelope::<EpiphanyRepoModelDomainDocument>(&domain.id)?
|
||||
{
|
||||
insert_strong_envelope(&mut strong, existing)?;
|
||||
}
|
||||
domains.insert(domain.id.clone(), domain.clone());
|
||||
insert_envelope(
|
||||
&mut writes,
|
||||
cache
|
||||
.prepare_entry(&domain.id, &EpiphanyRepoModelDomainDocument::new(domain)?)?
|
||||
.0,
|
||||
)?;
|
||||
}
|
||||
EpiphanyRepoModelMutationOperation::PutNode { node } => {
|
||||
require_semantic_id(&node.id, "RepoModel node")?;
|
||||
if !staged_domain_ids.contains(&node.domain_id) {
|
||||
require_dependency_envelope::<EpiphanyRepoModelDomainDocument>(
|
||||
&cache,
|
||||
&node.domain_id,
|
||||
&mut strong,
|
||||
)?;
|
||||
}
|
||||
require_dependency_envelope::<EpiphanyRepoModelDomainDocument>(
|
||||
&cache,
|
||||
&node.domain_id,
|
||||
&mut strong,
|
||||
)?;
|
||||
if let Some(existing) =
|
||||
cache.get_envelope::<EpiphanyRepoModelNodeDocument>(&node.id)?
|
||||
{
|
||||
|
|
@ -965,49 +895,6 @@ pub fn plan_repo_model_mutation(
|
|||
.0,
|
||||
)?;
|
||||
}
|
||||
EpiphanyRepoModelMutationOperation::PutSummary { summary } => {
|
||||
require_semantic_id(&summary.id, "RepoModel summary")?;
|
||||
if !staged_domain_ids.contains(&summary.domain_id) {
|
||||
require_dependency_envelope::<EpiphanyRepoModelDomainDocument>(
|
||||
&cache,
|
||||
&summary.domain_id,
|
||||
&mut strong,
|
||||
)?;
|
||||
}
|
||||
for node_id in &summary.covers_node_ids {
|
||||
if !staged_node_ids.contains(node_id) {
|
||||
require_dependency_envelope::<EpiphanyRepoModelNodeDocument>(
|
||||
&cache,
|
||||
node_id,
|
||||
&mut strong,
|
||||
)?;
|
||||
}
|
||||
}
|
||||
for edge_id in &summary.covers_edge_ids {
|
||||
if !staged_edge_ids.contains(edge_id) {
|
||||
require_dependency_envelope::<EpiphanyRepoModelEdgeDocument>(
|
||||
&cache,
|
||||
edge_id,
|
||||
&mut strong,
|
||||
)?;
|
||||
}
|
||||
}
|
||||
if let Some(existing) =
|
||||
cache.get_envelope::<EpiphanyRepoModelSummaryDocument>(&summary.id)?
|
||||
{
|
||||
insert_strong_envelope(&mut strong, existing)?;
|
||||
}
|
||||
summaries.insert(summary.id.clone(), summary.clone());
|
||||
insert_envelope(
|
||||
&mut writes,
|
||||
cache
|
||||
.prepare_entry(
|
||||
&summary.id,
|
||||
&EpiphanyRepoModelSummaryDocument::new(summary)?,
|
||||
)?
|
||||
.0,
|
||||
)?;
|
||||
}
|
||||
EpiphanyRepoModelMutationOperation::PutFrontier { item } => {
|
||||
require_semantic_id(&item.id, "RepoModel frontier")?;
|
||||
let prior = frontier.get(&item.id).cloned();
|
||||
|
|
@ -1227,7 +1114,6 @@ pub fn plan_repo_model_mutation(
|
|||
domains.values().cloned().collect(),
|
||||
nodes.values().cloned().collect(),
|
||||
edges.values().cloned().collect(),
|
||||
summaries.values().cloned().collect(),
|
||||
frontier.values().cloned().collect(),
|
||||
obligations.values().cloned().collect(),
|
||||
)?;
|
||||
|
|
@ -1245,14 +1131,10 @@ fn repo_model_operation_identity(
|
|||
operation: &EpiphanyRepoModelMutationOperation,
|
||||
) -> Result<(String, String)> {
|
||||
let (kind, id) = match operation {
|
||||
EpiphanyRepoModelMutationOperation::PutDomain { domain } => ("domain", domain.id.clone()),
|
||||
EpiphanyRepoModelMutationOperation::PutNode { node } => ("node", node.id.clone()),
|
||||
EpiphanyRepoModelMutationOperation::RetireNode { node_id } => ("node", node_id.clone()),
|
||||
EpiphanyRepoModelMutationOperation::PutEdge { edge } => ("edge", edge.id.clone()),
|
||||
EpiphanyRepoModelMutationOperation::RetireEdge { edge_id } => ("edge", edge_id.clone()),
|
||||
EpiphanyRepoModelMutationOperation::PutSummary { summary } => {
|
||||
("summary", summary.id.clone())
|
||||
}
|
||||
EpiphanyRepoModelMutationOperation::PutFrontier { item } => ("frontier", item.id.clone()),
|
||||
EpiphanyRepoModelMutationOperation::CreateSurfaceOffer { .. } => (
|
||||
"surface_offer",
|
||||
|
|
@ -1494,8 +1376,6 @@ pub(crate) fn assemble_repo_model_view_from_cache(
|
|||
let mut domains = values::<EpiphanyRepoModelDomainDocument, _>(&cache, |entry| entry.value())?;
|
||||
let mut nodes = values::<EpiphanyRepoModelNodeDocument, _>(&cache, |entry| entry.value())?;
|
||||
let mut edges = values::<EpiphanyRepoModelEdgeDocument, _>(&cache, |entry| entry.value())?;
|
||||
let mut summaries =
|
||||
values::<EpiphanyRepoModelSummaryDocument, _>(&cache, |entry| entry.value())?;
|
||||
let mut frontier =
|
||||
values::<EpiphanyRepoModelFrontierDocument, _>(&cache, |entry| entry.value())?;
|
||||
let mut claim_obligations = cache.get_all::<EpiphanyRepoModelClaimObligationsDocument>()?;
|
||||
|
|
@ -1506,7 +1386,6 @@ pub(crate) fn assemble_repo_model_view_from_cache(
|
|||
domains.sort_by(|left, right| left.id.cmp(&right.id));
|
||||
nodes.sort_by(|left, right| left.id.cmp(&right.id));
|
||||
edges.sort_by(|left, right| left.id.cmp(&right.id));
|
||||
summaries.sort_by(|left, right| left.id.cmp(&right.id));
|
||||
frontier.sort_by(|left, right| left.id.cmp(&right.id));
|
||||
claim_obligations.sort_by(|left, right| left.node_id.cmp(&right.node_id));
|
||||
surface_offers.sort_by_key(|offer| offer.surface_id);
|
||||
|
|
@ -1541,7 +1420,6 @@ pub(crate) fn assemble_repo_model_view_from_cache(
|
|||
domains.clone(),
|
||||
nodes.clone(),
|
||||
edges.clone(),
|
||||
summaries.clone(),
|
||||
frontier.clone(),
|
||||
claim_obligations.clone(),
|
||||
)?;
|
||||
|
|
@ -1597,7 +1475,6 @@ pub(crate) fn assemble_repo_model_view_from_cache(
|
|||
domains,
|
||||
nodes,
|
||||
edges,
|
||||
summaries,
|
||||
frontier,
|
||||
claim_obligations,
|
||||
surface_offers,
|
||||
|
|
@ -1619,7 +1496,6 @@ fn validate_repo_model_parts(
|
|||
domains: Vec<EpiphanyMemoryDomain>,
|
||||
nodes: Vec<EpiphanyMemoryNode>,
|
||||
edges: Vec<EpiphanyMemoryEdge>,
|
||||
summaries: Vec<EpiphanyMemorySummary>,
|
||||
frontier: Vec<RepoFrontierItem>,
|
||||
claim_obligations: Vec<EpiphanyRepoModelClaimObligationsDocument>,
|
||||
) -> Result<()> {
|
||||
|
|
@ -1628,7 +1504,6 @@ fn validate_repo_model_parts(
|
|||
domains,
|
||||
nodes,
|
||||
edges,
|
||||
summaries,
|
||||
frontier,
|
||||
..Default::default()
|
||||
};
|
||||
|
|
@ -1797,7 +1672,6 @@ mod tests {
|
|||
domains: vec![domain],
|
||||
nodes: vec![node],
|
||||
edges: Vec::new(),
|
||||
summaries: Vec::new(),
|
||||
frontier: vec![frontier],
|
||||
},
|
||||
)?;
|
||||
|
|
@ -1812,7 +1686,6 @@ mod tests {
|
|||
domains: Vec::new(),
|
||||
nodes: Vec::new(),
|
||||
edges: Vec::new(),
|
||||
summaries: Vec::new(),
|
||||
frontier: Vec::new(),
|
||||
},
|
||||
)?;
|
||||
|
|
@ -1882,7 +1755,6 @@ mod tests {
|
|||
domains: Vec::new(),
|
||||
nodes: Vec::new(),
|
||||
edges: Vec::new(),
|
||||
summaries: Vec::new(),
|
||||
frontier: Vec::new(),
|
||||
},
|
||||
)?;
|
||||
|
|
@ -2028,24 +1900,30 @@ mod tests {
|
|||
},
|
||||
)?;
|
||||
let body = bind_test_body(&store, "swarm-1", "workspace-1")?;
|
||||
let mut cache = runtime_spine_cache(&store)?;
|
||||
cache.put(
|
||||
REPO_MODEL_IDENTITY_KEY,
|
||||
&EpiphanyRepoModelIdentityDocument {
|
||||
schema_epoch: REPO_MODEL_SCHEMA_EPOCH.into(),
|
||||
graph_id: "graph-atomic".into(),
|
||||
runtime_id: "repo-model-atomic-slice".into(),
|
||||
swarm_id: "swarm-1".into(),
|
||||
workspace_id: "workspace-1".into(),
|
||||
body_binding_sha256: body.body_binding_sha256.clone(),
|
||||
},
|
||||
)?;
|
||||
let domain = EpiphanyMemoryDomain {
|
||||
id: "domain-new".into(),
|
||||
title: "New domain".into(),
|
||||
lifecycle: EpiphanyMemoryLifecycle::Accepted,
|
||||
..Default::default()
|
||||
};
|
||||
initialize_keyed_repo_model(
|
||||
&store,
|
||||
&EpiphanyRepoModelSeed::new(
|
||||
"seed-atomic",
|
||||
"graph-atomic",
|
||||
"swarm-1",
|
||||
"workspace-1",
|
||||
body.body_binding_sha256.clone(),
|
||||
EpiphanyRepoModelSeedDocuments {
|
||||
domains: vec![domain.clone()],
|
||||
nodes: Vec::new(),
|
||||
edges: Vec::new(),
|
||||
frontier: Vec::new(),
|
||||
},
|
||||
)?,
|
||||
"2026-08-14T00:00:00Z",
|
||||
)?;
|
||||
let cache = runtime_spine_cache(&store)?;
|
||||
let node = |id: &str, claim: &str| EpiphanyMemoryNode {
|
||||
id: id.into(),
|
||||
domain_id: domain.id.clone(),
|
||||
|
|
@ -2069,32 +1947,15 @@ mod tests {
|
|||
lifecycle: EpiphanyMemoryLifecycle::Accepted,
|
||||
..Default::default()
|
||||
};
|
||||
let summary = EpiphanyMemorySummary {
|
||||
id: "summary-flow".into(),
|
||||
domain_id: domain.id.clone(),
|
||||
covers_node_ids: vec![left.id.clone(), right.id.clone()],
|
||||
covers_edge_ids: vec![edge.id.clone()],
|
||||
target: "flow".into(),
|
||||
claim: "The flow is document-addressed".into(),
|
||||
question: "Can its members commit atomically?".into(),
|
||||
action_implication: "Commit the exact keyed slice".into(),
|
||||
..Default::default()
|
||||
};
|
||||
let proposal = make_proposal(
|
||||
"proposal-atomic-slice",
|
||||
&body,
|
||||
vec![
|
||||
EpiphanyRepoModelMutationOperation::PutSummary {
|
||||
summary: summary.clone(),
|
||||
},
|
||||
EpiphanyRepoModelMutationOperation::PutEdge { edge: edge.clone() },
|
||||
EpiphanyRepoModelMutationOperation::PutNode {
|
||||
node: right.clone(),
|
||||
},
|
||||
EpiphanyRepoModelMutationOperation::PutNode { node: left.clone() },
|
||||
EpiphanyRepoModelMutationOperation::PutDomain {
|
||||
domain: domain.clone(),
|
||||
},
|
||||
],
|
||||
)?;
|
||||
let plan = plan_repo_model_mutation(&store, &proposal)?;
|
||||
|
|
@ -2114,7 +1975,6 @@ mod tests {
|
|||
assert_eq!(view.domains, [domain]);
|
||||
assert_eq!(view.nodes, [left, right]);
|
||||
assert_eq!(view.edges, [edge.clone()]);
|
||||
assert_eq!(view.summaries, [summary]);
|
||||
|
||||
let retire = make_proposal(
|
||||
"proposal-retire-edge",
|
||||
|
|
@ -2186,7 +2046,6 @@ mod tests {
|
|||
domains: vec![domain.clone()],
|
||||
nodes: Vec::new(),
|
||||
edges: Vec::new(),
|
||||
summaries: Vec::new(),
|
||||
frontier: Vec::new(),
|
||||
},
|
||||
)?,
|
||||
|
|
|
|||
|
|
@ -11900,15 +11900,6 @@ fn epiphany_mutation_contracts() -> Vec<CultNetDocumentMutationContract> {
|
|||
vec![crate::EpiphanyMindCommitReceipt::TYPE],
|
||||
vec!["Keyed RepoModel edges are written only by the local Mind commit path."],
|
||||
),
|
||||
mutation_contract(
|
||||
crate::EpiphanyRepoModelSummaryDocument::TYPE,
|
||||
crate::EpiphanyRepoModelSummaryDocument::SCHEMA_NAME,
|
||||
vec![CultNetDocumentOperation::Snapshot],
|
||||
CultNetMutationAuthority::ReadOnly,
|
||||
vec![],
|
||||
vec![crate::EpiphanyMindCommitReceipt::TYPE],
|
||||
vec!["Keyed RepoModel summaries are written only by the local Mind commit path."],
|
||||
),
|
||||
mutation_contract(
|
||||
crate::EpiphanyRepoModelFrontierDocument::TYPE,
|
||||
crate::EpiphanyRepoModelFrontierDocument::SCHEMA_NAME,
|
||||
|
|
|
|||
|
|
@ -3213,7 +3213,6 @@ mod tests {
|
|||
domains: Vec::new(),
|
||||
nodes: Vec::new(),
|
||||
edges: Vec::new(),
|
||||
summaries: Vec::new(),
|
||||
frontier: Vec::new(),
|
||||
claim_obligations: Vec::new(),
|
||||
surface_offers: Vec::new(),
|
||||
|
|
|
|||
|
|
@ -658,9 +658,6 @@ pub struct EpiphanyMemoryGraphSnapshot {
|
|||
#[ts(type = "Array<EpiphanyMemoryEdge>")]
|
||||
pub edges: Vec<EpiphanyMemoryEdge>,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
#[ts(type = "Array<EpiphanyMemorySummary>")]
|
||||
pub summaries: Vec<EpiphanyMemorySummary>,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
#[ts(type = "Array<RepoFrontierItem>")]
|
||||
pub frontier: Vec<RepoFrontierItem>,
|
||||
}
|
||||
|
|
@ -928,33 +925,6 @@ pub struct EpiphanyMemoryAnchor {
|
|||
pub note: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)]
|
||||
pub struct EpiphanyMemorySummary {
|
||||
pub id: String,
|
||||
pub domain_id: String,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
#[ts(type = "Array<string>")]
|
||||
pub covers_node_ids: Vec<String>,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
#[ts(type = "Array<string>")]
|
||||
pub covers_edge_ids: Vec<String>,
|
||||
pub target: String,
|
||||
pub claim: String,
|
||||
pub question: String,
|
||||
pub tension: String,
|
||||
pub action_implication: String,
|
||||
#[serde(default, skip_serializing_if = "is_zero_u32")]
|
||||
pub anchor_count: u32,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
#[ts(type = "Array<string>")]
|
||||
pub source_hashes: Vec<String>,
|
||||
#[serde(default, skip_serializing_if = "is_zero_u32")]
|
||||
pub confidence: u32,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
#[ts(type = "Array<string>")]
|
||||
pub known_omissions: Vec<String>,
|
||||
}
|
||||
|
||||
|
||||
|
||||
fn is_zero_u32(value: &u32) -> bool {
|
||||
|
|
|
|||
Reference in a new issue