(graph: &Graph, nodes: &mut [atomic_core::KgNode])
| 143 | } |
| 144 | |
| 145 | fn annotate(graph: &Graph, nodes: &mut [atomic_core::KgNode]) { |
| 146 | for node in nodes { |
| 147 | let role = if node.id == graph.root { |
| 148 | "root intent" |
| 149 | } else if graph.declared_changes.contains(&node.id) |
| 150 | && !graph.captured_changes.contains(&node.id) |
| 151 | { |
| 152 | "declared implementation; original turn provenance not established" |
| 153 | } else if graph.implementing_changes.contains(&node.id) { |
| 154 | "implementing change" |
| 155 | } else if graph.recording_changes.contains(&node.id) { |
| 156 | "records intent artifact; implementation attribution not asserted" |
| 157 | } else if graph.intent_artifact.as_ref() == Some(&node.id) { |
| 158 | "selected intent's recorded artifact (matched by stored vault_path)" |
| 159 | } else if graph.dependency_changes.contains(&node.id) { |
| 160 | "dependency-only change" |
| 161 | } else { |
| 162 | "context" |
| 163 | }; |
| 164 | let state = node.metadata.as_ref().map(|m| { |
| 165 | format!( |
| 166 | "object={}, projection={}", |
| 167 | m.get("object_availability") |
| 168 | .and_then(|v| v.as_str()) |
| 169 | .unwrap_or("unknown"), |
| 170 | m.get("projection_completeness") |
| 171 | .and_then(|v| v.as_str()) |
| 172 | .unwrap_or("reference-only") |
| 173 | ) |
| 174 | }); |
| 175 | let evidence = if node.has_type(atomic_core::kg::ontology::Class::Change) { |
| 176 | state.unwrap_or_else(|| "object=unknown, projection=reference-only".into()) |
| 177 | } else { |
| 178 | String::new() |
| 179 | }; |
| 180 | node.summary = Some(format!( |
| 181 | "[{role}] {evidence} {}", |
| 182 | node.summary.as_deref().unwrap_or("") |
| 183 | )); |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | pub(crate) fn render_text(graph: &Graph) -> String { |
| 188 | render_tree(graph, false) |
no test coverage detected