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)
| 1277 | /// `a.txt`) is remediated by intent B. `b_done` controls whether the |
| 1278 | /// remediation is resolved. |
| 1279 | fn remediation_report(b_done: bool) -> (TriageReport, String) { |
| 1280 | let temp = TempDir::new().unwrap(); |
| 1281 | let mut repo = Repository::init(temp.path()).unwrap(); |
| 1282 | repo.init_vault().unwrap(); |
| 1283 | let base_view = repo.current_view().to_string(); |
| 1284 | |
| 1285 | // Base file on the shared view. |
| 1286 | let file = temp.path().join("a.txt"); |
| 1287 | std::fs::write(&file, "base\n").unwrap(); |
| 1288 | repo.add("a.txt", Default::default()).unwrap(); |
| 1289 | record_all(&repo, "base change"); |
| 1290 | |
| 1291 | // Intent A: a task that touches a.txt (so a candidate editing a.txt |
| 1292 | // reaches A through the KG join). |
| 1293 | let a = repo.vault_intent_create(intent_opts("Intent A")).unwrap(); |
| 1294 | let body_a = "\ |
| 1295 | :::why |
| 1296 | Because a.txt matters. |
| 1297 | ::: |
| 1298 | |
| 1299 | :::acceptance-criterion{#a-ac-1 status=unmet} |
| 1300 | a.txt is correct. |
| 1301 | ::: |
| 1302 | |
| 1303 | :::task{#a-1 status=unmet criteria=a-ac-1} |
| 1304 | Edit a.txt. |
| 1305 | ::file-ref{path=a.txt} |
| 1306 | :::"; |
| 1307 | install_intent_body(&repo, &a.intent_file, body_a, None); |
| 1308 | let a_node_id = format!("intent:{}", a.uid.to_uppercase()); |
| 1309 | |
| 1310 | // Intent B: remediates A (B --REMEDIATES--> A), status governed by b_done. |
| 1311 | let b = repo.vault_intent_create(intent_opts("Intent B")).unwrap(); |
| 1312 | let body_b = format!( |
| 1313 | "\ |
| 1314 | :::why |
| 1315 | Fix the flaw in A. |
| 1316 | ::: |
| 1317 | |
| 1318 | :::ref{{to=urn:atomic:intent:{} edge=remediates}} |
| 1319 | :::", |
| 1320 | a.uid |
| 1321 | ); |
| 1322 | install_intent_body( |
| 1323 | &repo, |
| 1324 | &b.intent_file, |
| 1325 | &body_b, |
| 1326 | Some(if b_done { "done" } else { "in-progress" }), |
| 1327 | ); |
| 1328 | |
| 1329 | // Candidate change on the feature view that edits a.txt (auto-enriches |
| 1330 | // the change → file:a.txt MODIFIES edge). `sync_vault(false)`: the |
| 1331 | // intents above live only in pristine (written via `vault_store`, not to |
| 1332 | // the on-disk `.vault/`), so record's working-copy vault reconciliation |
| 1333 | // would otherwise treat them as deleted and wipe their KG projection. |
| 1334 | repo.create_view_from("feature", &base_view).unwrap(); |
| 1335 | repo.switch_view("feature").unwrap(); |
| 1336 | std::fs::write(&file, "base\nfeature edit\n").unwrap(); |