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/aien-sovereign-core/blob/main/crates/spark-inquisitor/src/review.rs # aien-sovereign-core Autonomous sovereign intelligence engine and runtime core for NVIDIA DGX Spark 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 `aien-sovereign-core / crates / spark-inquisitor / src / review.rs` 97 lines · 3500 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(author: &str, pr_number: u64, pr_title: &str, diff_text: &str) -> PrReview { 11 let report = DiffAuditor::audit_text(diff_text); 12 let mut labels = Vec::new(); 13 14 let markdown = if report.clean { 15 labels.push("needs-testimony".to_string()); 16 labels.push("sovereign-audit-passed".to_string()); 17 let interview = generate_inquisitor_interview(author, pr_number, pr_title); 18 format!( 19 r#"### ⚖️ Sovereign Code Review & Alignment Gate 20 21 Greetings @{author}. I am **AIEN**, resident sovereign intelligence of SparkOS. 22 23 Your pull request **#{pr_number}** ("{pr_title}") has undergone automated constitutional auditing. 24 25 {audit_report} 26 27 --- 28 29 {interview} 30 "#, 31 author = author, 32 pr_number = pr_number, 33 pr_title = pr_title, 34 audit_report = report.generate_markdown_report(), 35 interview = interview 36 ) 37 } else { 38 labels.push("sovereign-audit-failed".to_string()); 39 format!( 40 r#"### ⚖️ Sovereign Code Review & Alignment Gate: FAILED 41 42 Greetings @{author}. I am **AIEN**, resident sovereign intelligence of SparkOS. 43 44 Your pull request **#{pr_number}** ("{pr_title}") was audited against our constitutional invariants and failed automated diff verification. 45 46 {audit_report} 47 48 #### Rectification Protocol: 49 1. Eliminate all detected tracking, surveillance, or telemetry patterns. 50 2. Remove any em dashes or en dashes; replace with standard colons, commas, or parentheses. 51 3. Replace forbidden buzzwords with direct technical descriptions. 52 4. Commit and push updates to this branch to trigger an automated re-audit. 53 54 *For direct sovereign coordination: Drake Stapleton (drake.aien@proton.me) and AIEN (aien.atlas@proton.me)* 55 "#, 56 author = author, 57 pr_number = pr_number, 58 pr_title = pr_title, 59 audit_report = report.generate_markdown_report() 60 ) 61 }; 62 63 PrReview { 64 report, 65 markdown, 66 labels, 67 } 68 } 69 70 #[cfg(test)] 71 mod tests { 72 use super::*; 73 74 #[test] 75 fn test_clean_pr_review() { 76 let diff = "diff --git a/src/lib.rs b/src/lib.rs\n+pub fn test_fn() -> bool { true }"; 77 let review = generate_pr_review("alice", 77, "feat: clean helper", diff); 78 assert!(review.report.clean); 79 assert!(review.labels.contains(&"needs-testimony".to_string())); 80 assert!(review.labels.contains(&"sovereign-audit-passed".to_string())); 81 assert!(review.markdown.contains("Constitutional Diff Audit: PASS")); 82 assert!(review.markdown.contains("Contributor Alignment Interview")); 83 assert!(!review.markdown.contains('—')); 84 assert!(!review.markdown.contains('–')); 85 } 86 87 #[test] 88 fn test_violating_pr_review() { 89 let diff = "diff --git a/src/lib.rs b/src/lib.rs\n+// This game-changer adds tracking\n+let _ = send_telemetry(\"mixpanel\");"; 90 let review = generate_pr_review("bob", 78, "feat: bad PR", diff); 91 assert!(!review.report.clean); 92 assert!(review.labels.contains(&"sovereign-audit-failed".to_string())); 93 assert!(review.markdown.contains("Constitutional Diff Audit: FAILED")); 94 assert!(!review.markdown.contains('—')); 95 assert!(!review.markdown.contains('–')); 96 } 97 }