use ev::canonical::compute_id;
use ev::tick::{Check, Ground, Liveness, Tick};
fn book(parent: &str, observe: &str, decision: &str, grounds: Vec<Ground>) -> Tick {
Tick {
id: String::new(),
parent_id: parent.into(),
observe: observe.into(),
decision: decision.into(),
grounds,
status: "live".into(),
held_since: "".into(),
blame: "Wang Yu".into(),
authority: None,
jurisdiction: None,
source_ref: None,
provenance: None,
}
}
#[test]
fn compute_id_should_return_the_frozen_golden_id_when_given_the_genesis_tick() {
let t = book(
"",
"evaluating retrieval backend",
"freeze the retrieval schema for v2",
vec![
Ground {
claim: "team still wants a frozen schema".into(),
supports: "chosen".into(),
check: Some(Check::Person {
reference: "Q3 infra review".into(),
}),
},
Ground {
claim: "pgvector would lock our schema".into(),
supports: "rejected:pgvector".into(),
check: None,
},
],
);
let id = compute_id(&t);
assert_eq!(id, "e2b337f53a1f");
}
#[test]
fn compute_id_should_stay_frozen_when_source_ref_is_set() {
let mut t = book(
"",
"evaluating retrieval backend",
"freeze the retrieval schema for v2",
vec![
Ground {
claim: "team still wants a frozen schema".into(),
supports: "chosen".into(),
check: Some(Check::Person {
reference: "Q3 infra review".into(),
}),
},
Ground {
claim: "pgvector would lock our schema".into(),
supports: "rejected:pgvector".into(),
check: None,
},
],
);
t.source_ref = Some(serde_json::Value::String("R2289".into()));
let id = compute_id(&t);
assert_eq!(id, "e2b337f53a1f");
}
#[test]
fn compute_id_should_freeze_the_harvested_binding_id_when_counter_test_is_absent() {
let t = book(
"7b21f0a4c8de",
"multi-pod restore-safety counter — chat-room R2289→R2290",
"restore-safety counter DB-backed; reject Redis",
vec![
Ground {
claim: "Argus introduces no Redis; multi-pod coord via existing DB".into(),
supports: "chosen".into(),
check: Some(Check::Test {
reference: "pytest tests/test_redis_absent.py".into(),
verified_at_sha: "d308afac1b2c3d4e5f60718293a4b5c6d7e8f901".into(),
counter_test: None,
liveness: Liveness {
platforms: vec!["linux-ci".into()],
triggered_by: vec!["pyproject.toml".into()],
surfaces: vec!["pyproject-deps".into()],
},
}),
},
Ground {
claim: "team still wants 0-Redis posture".into(),
supports: "chosen".into(),
check: Some(Check::Person {
reference: "Q3 infra review".into(),
}),
},
Ground {
claim: "Redis would add a new infra dependency".into(),
supports: "rejected:Redis".into(),
check: None,
},
],
);
let id = compute_id(&t);
assert_eq!(id, "0cf784b51331");
}
#[test]
fn compute_id_should_return_the_frozen_golden_id_when_given_the_case1_tick_with_non_ascii() {
let t = book(
"7b21f0a4c8de",
"multi-pod restore-safety counter — chat-room R2289→R2290",
"restore-safety counter DB-backed; reject Redis",
vec![
Ground {
claim: "Argus introduces no Redis; multi-pod coord via existing DB".into(),
supports: "chosen".into(),
check: Some(Check::Test {
reference: "pytest tests/test_redis_absent.py".into(),
verified_at_sha: "d308afac1b2c3d4e5f60718293a4b5c6d7e8f901".into(),
counter_test: Some(
"pytest tests/test_redis_absent.py::test_redis_injection_flips_red".into(),
),
liveness: Liveness {
platforms: vec!["linux-ci".into()],
triggered_by: vec!["pyproject.toml".into()],
surfaces: vec!["pyproject-deps".into()],
},
}),
},
Ground {
claim: "team still wants 0-Redis posture".into(),
supports: "chosen".into(),
check: Some(Check::Person {
reference: "Q3 infra review".into(),
}),
},
Ground {
claim: "Redis would add a new infra dependency".into(),
supports: "rejected:Redis".into(),
check: None,
},
],
);
let id = compute_id(&t);
assert_eq!(id, "638c47b0c9dd");
}
#[test]
fn compute_id_should_freeze_the_rejected_road_tripwire_id_when_a_rejected_ground_carries_a_check() {
let mut t = book(
"7b21f0a4c8de",
"multi-pod restore-safety counter — chat-room R2289→R2290",
"restore-safety counter DB-backed; reject Redis",
vec![
Ground {
claim: "Argus introduces no Redis; multi-pod coord via existing DB".into(),
supports: "chosen".into(),
check: Some(Check::Test {
reference: "pytest tests/test_redis_absent.py".into(),
verified_at_sha: "d308afac1b2c3d4e5f60718293a4b5c6d7e8f901".into(),
counter_test: Some(
"pytest tests/test_redis_absent.py::test_redis_injection_flips_red".into(),
),
liveness: Liveness {
platforms: vec!["linux-ci".into()],
triggered_by: vec!["pyproject.toml".into()],
surfaces: vec!["pyproject-deps".into()],
},
}),
},
Ground {
claim: "team still wants 0-Redis posture".into(),
supports: "chosen".into(),
check: Some(Check::Person {
reference: "Q3 infra review".into(),
}),
},
Ground {
claim: "Redis would add a new infra dependency".into(),
supports: "rejected:Redis".into(),
check: Some(Check::Test {
reference: "! grep -q redis pyproject.toml".into(),
verified_at_sha: "d308afac1b2c3d4e5f60718293a4b5c6d7e8f901".into(),
counter_test: Some("grep -q redis pyproject.toml".into()),
liveness: Liveness {
platforms: vec!["linux-ci".into()],
triggered_by: vec!["pyproject.toml".into()],
surfaces: vec!["pyproject-deps".into()],
},
}),
},
],
);
t.authority = Some("user-ruled".into());
let id = compute_id(&t);
assert_eq!(id, "9c5feb4582ac");
}