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)>)
| 1727 | /// `a.txt`) is optionally covered by a review intent R. `review` is |
| 1728 | /// `(review_author, review_done)`. Target is the shared `dev` view. |
| 1729 | fn review_gate_report(review: Option<(&str, bool)>) -> (TriageReport, String) { |
| 1730 | let temp = TempDir::new().unwrap(); |
| 1731 | let mut repo = Repository::init(temp.path()).unwrap(); |
| 1732 | repo.init_vault().unwrap(); |
| 1733 | let base_view = repo.current_view().to_string(); // "dev" (shared) |
| 1734 | |
| 1735 | let file = temp.path().join("a.txt"); |
| 1736 | std::fs::write(&file, "base\n").unwrap(); |
| 1737 | repo.add("a.txt", Default::default()).unwrap(); |
| 1738 | record_all(&repo, "base change"); |
| 1739 | |
| 1740 | // Work intent A: a task touching a.txt (so the candidate reaches it), |
| 1741 | // authored by WORK_AUTHOR. kind stays default `feature`. |
| 1742 | let a = repo.vault_intent_create(intent_opts("Work A")).unwrap(); |
| 1743 | let body_a = "\ |
| 1744 | :::why |
| 1745 | Own a.txt. |
| 1746 | ::: |
| 1747 | |
| 1748 | :::acceptance-criterion{#a-ac-1 status=unmet} |
| 1749 | Works. |
| 1750 | ::: |
| 1751 | |
| 1752 | :::task{#a-1 status=unmet criteria=a-ac-1} |
| 1753 | Edit a.txt. |
| 1754 | ::file-ref{path=a.txt} |
| 1755 | :::"; |
| 1756 | install_intent_body_fm( |
| 1757 | &repo, |
| 1758 | &a.intent_file, |
| 1759 | body_a, |
| 1760 | &[("attributedTo", WORK_AUTHOR), ("status", "in-progress")], |
| 1761 | ); |
| 1762 | let a_node_id = format!("intent:{}", a.uid.to_uppercase()); |
| 1763 | |
| 1764 | // Optional review intent R: kind=review, `reviews` A. |
| 1765 | if let Some((review_author, done)) = review { |
| 1766 | let r = repo.vault_intent_create(intent_opts("Review R")).unwrap(); |
| 1767 | let body_r = format!( |
| 1768 | "\ |
| 1769 | :::why |
| 1770 | Reviewed A independently. |
| 1771 | ::: |
| 1772 | |
| 1773 | :::ref{{to=urn:atomic:intent:{} edge=reviews}} |
| 1774 | :::", |
| 1775 | a.uid |
| 1776 | ); |
| 1777 | install_intent_body_fm( |
| 1778 | &repo, |
| 1779 | &r.intent_file, |
| 1780 | &body_r, |
| 1781 | &[ |
| 1782 | ("kind", "review"), |
| 1783 | ("attributedTo", review_author), |
| 1784 | ("status", if done { "done" } else { "in-progress" }), |
| 1785 | ], |
| 1786 | ); |