#![allow(dead_code, unused_variables, unused_imports)]
use antigen::stdlib::vcs_info_loss::RollbackWithoutTriageCommit;
use antigen::{TriageDecision, orient, presents, triage_commit};
#[orient(
learning_path = "Review auth module against session-fixation failure-class before v1 tag",
until = "2026-11-01"
)]
pub const fn new_auth_handler(token: &str) -> Result<(), String> {
Ok(())
}
#[triage_commit(
triage_decision = TriageDecision::Red,
rollback_target = "a83f2c1",
triaged_by = "oncall-navigator",
rationale = "Session-fixation exploit confirmed via WAF logs (INCIDENT-8841); \
a83f2c1 is the last-clean-CI snapshot before the vulnerable auth path merged",
rollback_due_within_minutes = 30
)]
#[presents(
RollbackWithoutTriageCommit,
requires = signed_trailer(key = "Triage-Decision"),
)]
pub fn rollback_auth_to_last_clean(snapshot_sha: &str) -> Result<(), String> {
println!("[ROLLBACK] Auth module → {snapshot_sha}");
Ok(())
}
#[triage_commit(
triage_decision = TriageDecision::Black,
rollback_target = "7d4bc89",
triaged_by = "sre-lead",
rationale = "Payment processor reporting 100% transaction failure; pod OOMKilled loop; \
7d4bc89 is the pre-incident head per runbook step 3",
rollback_due_within_minutes = 5
)]
pub fn rollback_payment_processor(snapshot_sha: &str) -> Result<(), String> {
println!("[ROLLBACK] Payment processor → {snapshot_sha}");
Ok(())
}
#[triage_commit(
triage_decision = TriageDecision::Yellow,
rollback_target = "HEAD",
triaged_by = "oncall-navigator",
rationale = "p99 latency elevated 40% in EU-WEST region; no vital-metric breach yet; \
investigating correlation with deploy ac91def; decision pending",
rollback_due_within_minutes = 60
)]
pub fn investigate_latency_regression() {
println!("[YELLOW] Investigating — no rollback yet");
}
#[triage_commit(
triage_decision = TriageDecision::Green,
rollback_target = "HEAD",
triaged_by = "senior-navigator",
rationale = "Alert fired on elevated error-rate; investigation shows traffic spike \
from load-test in staging leaking to prod metrics; no actual regression; \
no rollback warranted; suppressing alert for 2h",
rollback_due_within_minutes = 120
)]
pub fn close_false_positive_alert() {
println!("[GREEN] Investigated — no regression found, alert suppressed");
}
#[triage_commit(
triage_decision = TriageDecision::White,
rollback_target = "HEAD",
triaged_by = "oncall-navigator",
rationale = "Cache layer was flagged during triage of INCIDENT-9011 but was determined \
unrelated to the active p0; explicitly scoped out to avoid distraction; \
cache investigation to continue post-incident in separate thread",
rollback_due_within_minutes = 240
)]
pub fn scope_out_cache_investigation() {
println!("[WHITE] Cache layer explicitly scoped out of INCIDENT-9011 triage");
}
fn main() {
println!("=== antigen triage_commit example ===");
println!();
println!("Speech-act distinction — #[orient] vs #[triage_commit]:");
println!(" orient: 'I don't have a defense yet. I will by <date>.' (DEFERRAL)");
println!(" triage_commit: 'I have diagnosed this. Acting NOW. Here is why.' (DECISION)");
println!();
println!("new_auth_handler: #[orient] — training gap, not a live incident");
println!(
"rollback_auth_to_last_clean: #[triage_commit] Red — active exploit, bounded rollback"
);
println!();
println!("The 5-color triage scale:");
println!(" Black — system-down; catastrophic; 5min window");
println!(" Red — vital-metric regression confirmed; tight rollback window");
println!(" Yellow — concerning signal; decision pending; investigation window");
println!(" Green — no regression found; explicit non-action documented");
println!(" White — out of scope; explicit non-action documented");
println!();
println!("All five are valid triage_commit outcomes. Green and White make");
println!("invisible non-action decisions visible in the git substrate.");
println!();
let _ = new_auth_handler("tok_abc");
let _ = rollback_auth_to_last_clean("a83f2c1");
let _ = rollback_payment_processor("7d4bc89");
investigate_latency_regression();
close_false_positive_alert();
scope_out_cache_investigation();
println!();
println!("Mandatory fields (all required — a triage without them cannot compile):");
println!(" triage_decision = TriageDecision::{{Black|Red|Yellow|Green|White}}");
println!(" rollback_target = \"<sha>\" — last-known-good snapshot");
println!(" triaged_by = \"<role>\" — informed-consent author identity");
println!(" rationale = \"...\" — chart-documentation (>= 20 chars)");
println!(" rollback_due_within_minutes = N — bounded time window (> 0)");
}