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

Function remediation_report

atomic-cli/src/commands/triage/project.rs:1244–1315  ·  view source on GitHub ↗

Build a report where intent A (reached by a candidate change that edits `a.txt`) is remediated by intent B. `b_done` controls whether the remediation is resolved.

(b_done: bool)

Source from the content-addressed store, hash-verified

1242 /// `a.txt`) is remediated by intent B. `b_done` controls whether the
1243 /// remediation is resolved.
1244 fn remediation_report(b_done: bool) -> (TriageReport, String) {
1245 let temp = TempDir::new().unwrap();
1246 let mut repo = Repository::init(temp.path()).unwrap();
1247 repo.init_vault().unwrap();
1248 let base_view = repo.current_view().to_string();
1249
1250 // Base file on the shared view.
1251 let file = temp.path().join("a.txt");
1252 std::fs::write(&file, "base\n").unwrap();
1253 repo.add("a.txt", Default::default()).unwrap();
1254 record_all(&repo, "base change");
1255
1256 // Intent A: a task that touches a.txt (so a candidate editing a.txt
1257 // reaches A through the KG join).
1258 let a = repo.vault_intent_create(intent_opts("Intent A")).unwrap();
1259 let body_a = "\
1260:::why
1261Because a.txt matters.
1262:::
1263
1264:::acceptance-criterion{#a-ac-1 status=unmet}
1265a.txt is correct.
1266:::
1267
1268:::task{#a-1 status=unmet criteria=a-ac-1}
1269Edit a.txt.
1270::file-ref{path=a.txt}
1271:::";
1272 install_intent_body(&repo, &a.intent_file, body_a, None);
1273 let a_node_id = format!("intent:{}", a.uid.to_uppercase());
1274
1275 // Intent B: remediates A (B --REMEDIATES--> A), status governed by b_done.
1276 let b = repo.vault_intent_create(intent_opts("Intent B")).unwrap();
1277 let body_b = format!(
1278 "\
1279:::why
1280Fix the flaw in A.
1281:::
1282
1283:::ref{{to=urn:atomic:intent:{} edge=remediates}}
1284:::",
1285 a.uid
1286 );
1287 install_intent_body(
1288 &repo,
1289 &b.intent_file,
1290 &body_b,
1291 Some(if b_done { "done" } else { "in-progress" }),
1292 );
1293
1294 // Candidate change on the feature view that edits a.txt (auto-enriches
1295 // the change → file:a.txt MODIFIES edge). `sync_vault(false)`: the
1296 // intents above live only in pristine (written via `vault_store`, not to
1297 // the on-disk `.vault/`), so record's working-copy vault reconciliation
1298 // would otherwise treat them as deleted and wipe their KG projection.
1299 repo.create_view_from("feature", &base_view).unwrap();
1300 repo.switch_view("feature").unwrap();
1301 std::fs::write(&file, "base\nfeature edit\n").unwrap();

Calls 15

writeFunction · 0.85
intent_optsFunction · 0.85
install_intent_bodyFunction · 0.85
build_reportFunction · 0.85
current_viewMethod · 0.80
vault_intent_createMethod · 0.80
create_view_fromMethod · 0.80
switch_viewMethod · 0.80
sync_vaultMethod · 0.80
enrich_kgMethod · 0.80
apply_after_recordMethod · 0.80
save_to_storeMethod · 0.80