MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / change_coverage

Method change_coverage

atomic-repository/src/repository/triage.rs:209–249  ·  view source on GitHub ↗

Determine intent coverage for a single change. The change's modified files come from its own `file_ops` (via [`change_modified_paths`](Self::change_modified_paths)), mapped to `file: ` node ids — so coverage no longer depends on KG `MODIFIES` enrichment. The intent side stays in the KG: a file is covered when it carries an incoming `TOUCHES` edge from a `task:` node (projected on `vault sync

(&self, hash: &Hash)

Source from the content-addressed store, hash-verified

207 /// - `Unknown` only when the change has no file ops at all (e.g. a load
208 /// failure) — unreachable for a normally recorded change.
209 fn change_coverage(&self, hash: &Hash) -> Result<(Vec<String>, Coverage), RepositoryError> {
210 // change → file comes from the change's own ops (authoritative), mapped
211 // to the shared `file:<path>` node id the intent side also uses.
212 let modifies: Vec<String> = self
213 .change_modified_paths(hash)?
214 .into_iter()
215 .map(|p| iri::mint_file(&self.project_id().expect("project identity"), &p))
216 .collect();
217
218 if modifies.is_empty() {
219 // No file ops (or the change could not be loaded): coverage is
220 // genuinely indeterminate — not the same as uncovered.
221 return Ok((modifies, Coverage::Unknown));
222 }
223
224 // A file is "covered" if some task TOUCHES it. Only this intent side is
225 // read from the KG — per modified file, via its 1-hop neighborhood
226 // (incoming edges included), looking for a `task: --TOUCHES--> file:`.
227 let mut covered = false;
228 for file_id in &modifies {
229 let neighborhood = self.vault_kg_neighbors(file_id, 1)?;
230 if neighborhood.edges.iter().any(|e| {
231 e.kind == P::Touches
232 && e.to_id == *file_id
233 && neighborhood
234 .nodes
235 .iter()
236 .any(|node| node.id == e.from_id && node.has_type(Class::Task))
237 }) {
238 covered = true;
239 break;
240 }
241 }
242
243 let coverage = if covered {
244 Coverage::Covered
245 } else {
246 Coverage::Uncovered
247 };
248 Ok((modifies, coverage))
249 }
250}
251
252#[cfg(test)]

Calls 8

change_modified_pathsMethod · 0.80
vault_kg_neighborsMethod · 0.80
has_typeMethod · 0.80
collectMethod · 0.45
into_iterMethod · 0.45
project_idMethod · 0.45
is_emptyMethod · 0.45
iterMethod · 0.45