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)
| 1013 | /// `a.txt`) is remediated by intent B. `b_done` controls whether the |
| 1014 | /// remediation is resolved. |
| 1015 | fn remediation_report(b_done: bool) -> (TriageReport, String) { |
| 1016 | let temp = TempDir::new().unwrap(); |
| 1017 | let mut repo = Repository::init(temp.path()).unwrap(); |
| 1018 | repo.init_vault().unwrap(); |
| 1019 | let base_view = repo.current_view().to_string(); |
| 1020 | |
| 1021 | // Base file on the shared view. |
| 1022 | let file = temp.path().join("a.txt"); |
| 1023 | std::fs::write(&file, "base\n").unwrap(); |
| 1024 | repo.add("a.txt", Default::default()).unwrap(); |
| 1025 | record_all(&repo, "base change"); |
| 1026 | |
| 1027 | // Intent A: a task that touches a.txt (so a candidate editing a.txt |
| 1028 | // reaches A through the KG join). |
| 1029 | let a = repo.vault_intent_create(intent_opts("Intent A")).unwrap(); |
| 1030 | let body_a = "\ |
| 1031 | :::why |
| 1032 | Because a.txt matters. |
| 1033 | ::: |
| 1034 | |
| 1035 | :::acceptance-criterion{#a-ac-1 status=unmet} |
| 1036 | a.txt is correct. |
| 1037 | ::: |
| 1038 | |
| 1039 | :::task{#a-1 status=unmet criteria=a-ac-1} |
| 1040 | Edit a.txt. |
| 1041 | ::file-ref{path=a.txt} |
| 1042 | :::"; |
| 1043 | install_intent_body(&repo, &a.intent_file, body_a, None); |
| 1044 | let a_node_id = format!("intent:{}", a.uid.to_uppercase()); |
| 1045 | |
| 1046 | // Intent B: remediates A (B --REMEDIATES--> A), status governed by b_done. |
| 1047 | let b = repo.vault_intent_create(intent_opts("Intent B")).unwrap(); |
| 1048 | let body_b = format!( |
| 1049 | "\ |
| 1050 | :::why |
| 1051 | Fix the flaw in A. |
| 1052 | ::: |
| 1053 | |
| 1054 | :::ref{{to=urn:atomic:intent:{} edge=remediates}} |
| 1055 | :::", |
| 1056 | a.uid |
| 1057 | ); |
| 1058 | install_intent_body( |
| 1059 | &repo, |
| 1060 | &b.intent_file, |
| 1061 | &body_b, |
| 1062 | Some(if b_done { "done" } else { "in-progress" }), |
| 1063 | ); |
| 1064 | |
| 1065 | // Candidate change on the feature view that edits a.txt (auto-enriches |
| 1066 | // the change → file:a.txt MODIFIES edge). `sync_vault(false)`: the |
| 1067 | // intents above live only in pristine (written via `vault_store`, not to |
| 1068 | // the on-disk `.vault/`), so record's working-copy vault reconciliation |
| 1069 | // would otherwise treat them as deleted and wipe their KG projection. |
| 1070 | repo.create_view_from("feature", &base_view).unwrap(); |
| 1071 | repo.switch_view("feature").unwrap(); |
| 1072 | std::fs::write(&file, "base\nfeature edit\n").unwrap(); |