Build a report where work intent A (author `WORK_AUTHOR`, touching `a.txt`) is optionally covered by a review intent R. `review` is `(review_author, review_done)`. Target is the shared `dev` view.
(review: Option<(&str, bool)>)
| 1489 | /// `a.txt`) is optionally covered by a review intent R. `review` is |
| 1490 | /// `(review_author, review_done)`. Target is the shared `dev` view. |
| 1491 | fn review_gate_report(review: Option<(&str, bool)>) -> (TriageReport, String) { |
| 1492 | let temp = TempDir::new().unwrap(); |
| 1493 | let mut repo = Repository::init(temp.path()).unwrap(); |
| 1494 | repo.init_vault().unwrap(); |
| 1495 | let base_view = repo.current_view().to_string(); // "dev" (shared) |
| 1496 | |
| 1497 | let file = temp.path().join("a.txt"); |
| 1498 | std::fs::write(&file, "base\n").unwrap(); |
| 1499 | repo.add("a.txt", Default::default()).unwrap(); |
| 1500 | record_all(&repo, "base change"); |
| 1501 | |
| 1502 | // Work intent A: a task touching a.txt (so the candidate reaches it), |
| 1503 | // authored by WORK_AUTHOR. kind stays default `feature`. |
| 1504 | let a = repo.vault_intent_create(intent_opts("Work A")).unwrap(); |
| 1505 | let body_a = "\ |
| 1506 | :::why |
| 1507 | Own a.txt. |
| 1508 | ::: |
| 1509 | |
| 1510 | :::acceptance-criterion{#a-ac-1 status=unmet} |
| 1511 | Works. |
| 1512 | ::: |
| 1513 | |
| 1514 | :::task{#a-1 status=unmet criteria=a-ac-1} |
| 1515 | Edit a.txt. |
| 1516 | ::file-ref{path=a.txt} |
| 1517 | :::"; |
| 1518 | install_intent_body_fm( |
| 1519 | &repo, |
| 1520 | &a.intent_file, |
| 1521 | body_a, |
| 1522 | &[("attributedTo", WORK_AUTHOR), ("status", "in-progress")], |
| 1523 | ); |
| 1524 | let a_node_id = format!("intent:{}", a.uid.to_uppercase()); |
| 1525 | |
| 1526 | // Optional review intent R: kind=review, `reviews` A. |
| 1527 | if let Some((review_author, done)) = review { |
| 1528 | let r = repo.vault_intent_create(intent_opts("Review R")).unwrap(); |
| 1529 | let body_r = format!( |
| 1530 | "\ |
| 1531 | :::why |
| 1532 | Reviewed A independently. |
| 1533 | ::: |
| 1534 | |
| 1535 | :::ref{{to=urn:atomic:intent:{} edge=reviews}} |
| 1536 | :::", |
| 1537 | a.uid |
| 1538 | ); |
| 1539 | install_intent_body_fm( |
| 1540 | &repo, |
| 1541 | &r.intent_file, |
| 1542 | &body_r, |
| 1543 | &[ |
| 1544 | ("kind", "review"), |
| 1545 | ("attributedTo", review_author), |
| 1546 | ("status", if done { "done" } else { "in-progress" }), |
| 1547 | ], |
| 1548 | ); |