#[test]
fn phase2_always_active_seed_is_sparse_not_dense_bool_scan() {
let module = std::fs::read_to_string(concat!(env!("CARGO_MANIFEST_DIR"), "/src/engine/mod.rs"))
.expect("read engine mod");
assert!(
module.contains("phase2_always_active_indices: Vec<usize>"),
"always-active phase-2 seeds must be stored as sparse indices"
);
assert!(
!module.contains("phase2_always_active: Vec<bool>"),
"dense phase-2 bool tables force an O(phase-2-patterns) scan per chunk"
);
let phase2 = std::fs::read_to_string(concat!(
env!("CARGO_MANIFEST_DIR"),
"/src/engine/phase2_compiled.rs"
))
.expect("read phase2_compiled module");
assert!(
phase2.contains("for &index in &self.phase2_always_active_indices"),
"phase-2 hot path must seed from sparse always-active indices"
);
assert!(
phase2.contains("fn has_active_phase2_patterns_for_chunk"),
"phase-2 must expose a per-chunk active-set admission probe"
);
assert!(
!phase2.contains("!self.phase2_always_active_indices.is_empty()"),
"active-set probe must NOT coarsely short-circuit on a non-empty always-active index set: that admits every chunk and defeats no-hit admission"
);
assert!(
!phase2.contains("phase2_always_active.iter().enumerate()"),
"phase-2 hot path must not rescan a dense always-active table"
);
}