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)>)
| 1762 | /// `a.txt`) is optionally covered by a review intent R. `review` is |
| 1763 | /// `(review_author, review_done)`. Target is the shared `dev` view. |
| 1764 | fn review_gate_report(review: Option<(&str, bool)>) -> (TriageReport, String) { |
| 1765 | let temp = TempDir::new().unwrap(); |
| 1766 | let mut repo = Repository::init(temp.path()).unwrap(); |
| 1767 | repo.init_vault().unwrap(); |
| 1768 | let base_view = repo.current_view().to_string(); // "dev" (shared) |
| 1769 | |
| 1770 | let file = temp.path().join("a.txt"); |
| 1771 | std::fs::write(&file, "base\n").unwrap(); |
| 1772 | repo.add("a.txt", Default::default()).unwrap(); |
| 1773 | record_all(&repo, "base change"); |
| 1774 | |
| 1775 | // Work intent A: a task touching a.txt (so the candidate reaches it), |
| 1776 | // authored by WORK_AUTHOR. kind stays default `feature`. |
| 1777 | let a = repo.vault_intent_create(intent_opts("Work A")).unwrap(); |
| 1778 | let body_a = "\ |
| 1779 | :::why |
| 1780 | Own a.txt. |
| 1781 | ::: |
| 1782 | |
| 1783 | :::acceptance-criterion{#a-ac-1 status=unmet} |
| 1784 | Works. |
| 1785 | ::: |
| 1786 | |
| 1787 | :::task{#a-1 status=unmet criteria=a-ac-1} |
| 1788 | Edit a.txt. |
| 1789 | ::file-ref{path=a.txt} |
| 1790 | :::"; |
| 1791 | install_intent_body_fm( |
| 1792 | &repo, |
| 1793 | &a.intent_file, |
| 1794 | body_a, |
| 1795 | &[("attributedTo", WORK_AUTHOR), ("status", "in-progress")], |
| 1796 | ); |
| 1797 | let a_node_id = format!("intent:{}", a.uid.to_uppercase()); |
| 1798 | |
| 1799 | // Optional review intent R: kind=review, `reviews` A. |
| 1800 | if let Some((review_author, done)) = review { |
| 1801 | let r = repo.vault_intent_create(intent_opts("Review R")).unwrap(); |
| 1802 | let body_r = format!( |
| 1803 | "\ |
| 1804 | :::why |
| 1805 | Reviewed A independently. |
| 1806 | ::: |
| 1807 | |
| 1808 | :::ref{{to=urn:atomic:intent:{} edge=reviews}} |
| 1809 | :::", |
| 1810 | a.uid |
| 1811 | ); |
| 1812 | install_intent_body_fm( |
| 1813 | &repo, |
| 1814 | &r.intent_file, |
| 1815 | &body_r, |
| 1816 | &[ |
| 1817 | ("kind", "review"), |
| 1818 | ("attributedTo", review_author), |
| 1819 | ("status", if done { "done" } else { "in-progress" }), |
| 1820 | ], |
| 1821 | ); |