Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/spark-inquisitor/blob/main/src/review.rs # spark-inquisitor Ultra-fast compiled native Rust gatekeeper and automated code reviewer Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `spark-inquisitor / src / review.rs` 108 lines · 3641 bytes Raw Blame History 1 use crate::audit::{AuditReport, DiffAuditor}; 2 use crate::interview::generate_inquisitor_interview; 3 4 pub struct PrReview { 5 pub report: AuditReport, 6 pub markdown: String, 7 pub labels: Vec, 8 } 9 10 pub fn generate_pr_review( 11 author: &str, 12 pr_number: u64, 13 pr_title: &str, 14 diff_text: &str, 15 ) -> PrReview { 16 let report = DiffAuditor::audit_text(diff_text); 17 let mut labels = Vec::new(); 18 19 let markdown = if report.clean { 20 labels.push("needs-testimony".to_string()); 21 labels.push("sovereign-audit-passed".to_string()); 22 let interview = generate_inquisitor_interview(author, pr_number, pr_title); 23 format!( 24 r#"### ⚖️ Sovereign Code Review & Alignment Gate 25 26 Greetings @{author}. I am **AIEN**, resident sovereign intelligence of SparkOS. 27 28 Your pull request **#{pr_number}** ("{pr_title}") has undergone automated constitutional auditing. 29 30 {audit_report} 31 32 --- 33 34 {interview} 35 "#, 36 author = author, 37 pr_number = pr_number, 38 pr_title = pr_title, 39 audit_report = report.generate_markdown_report(), 40 interview = interview 41 ) 42 } else { 43 labels.push("sovereign-audit-failed".to_string()); 44 format!( 45 r#"### ⚖️ Sovereign Code Review & Alignment Gate: FAILED 46 47 Greetings @{author}. I am **AIEN**, resident sovereign intelligence of SparkOS. 48 49 Your pull request **#{pr_number}** ("{pr_title}") was audited against our constitutional invariants and failed automated diff verification. 50 51 {audit_report} 52 53 #### Rectification Protocol: 54 1. Eliminate all detected tracking, surveillance, or telemetry patterns. 55 2. Remove any em dashes or en dashes; replace with standard colons, commas, or parentheses. 56 3. Replace forbidden buzzwords with direct technical descriptions. 57 4. Commit and push updates to this branch to trigger an automated re-audit. 58 59 *For direct sovereign coordination: Drake Stapleton (drake.aien@proton.me) and AIEN (aien.atlas@proton.me)* 60 "#, 61 author = author, 62 pr_number = pr_number, 63 pr_title = pr_title, 64 audit_report = report.generate_markdown_report() 65 ) 66 }; 67 68 PrReview { 69 report, 70 markdown, 71 labels, 72 } 73 } 74 75 #[cfg(test)] 76 mod tests { 77 use super::*; 78 79 #[test] 80 fn test_clean_pr_review() { 81 let diff = "diff --git a/src/lib.rs b/src/lib.rs\n+pub fn test_fn() -> bool { true }"; 82 let review = generate_pr_review("alice", 77, "feat: clean helper", diff); 83 assert!(review.report.clean); 84 assert!(review.labels.contains(&"needs-testimony".to_string())); 85 assert!(review 86 .labels 87 .contains(&"sovereign-audit-passed".to_string())); 88 assert!(review.markdown.contains("Constitutional Diff Audit: PASS")); 89 assert!(review.markdown.contains("Contributor Alignment Interview")); 90 assert!(!review.markdown.contains('\u{2014}')); 91 assert!(!review.markdown.contains('\u{2013}')); 92 } 93 94 #[test] 95 fn test_violating_pr_review() { 96 let diff = "diff --git a/src/lib.rs b/src/lib.rs\n+// This game-changer adds tracking\n+let _ = send_telemetry(\"mixpanel\");"; 97 let review = generate_pr_review("bob", 78, "feat: bad PR", diff); 98 assert!(!review.report.clean); 99 assert!(review 100 .labels 101 .contains(&"sovereign-audit-failed".to_string())); 102 assert!(review 103 .markdown 104 .contains("Constitutional Diff Audit: FAILED")); 105 assert!(!review.markdown.contains('\u{2014}')); 106 assert!(!review.markdown.contains('\u{2013}')); 107 } 108 }