MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / review_gate_report

Function review_gate_report

atomic-cli/src/commands/triage/project.rs:1764–1840  ·  view source on GitHub ↗

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)>)

Source from the content-addressed store, hash-verified

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
1780Own a.txt.
1781:::
1782
1783:::acceptance-criterion{#a-ac-1 status=unmet}
1784Works.
1785:::
1786
1787:::task{#a-1 status=unmet criteria=a-ac-1}
1788Edit 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
1805Reviewed 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 );

Calls 15

writeFunction · 0.85
intent_optsFunction · 0.85
install_intent_body_fmFunction · 0.85
build_reportFunction · 0.85
current_viewMethod · 0.80
vault_intent_createMethod · 0.80
create_view_fromMethod · 0.80
switch_viewMethod · 0.80
sync_vaultMethod · 0.80
enrich_kgMethod · 0.80
apply_after_recordMethod · 0.80
save_to_storeMethod · 0.80