aegis-runtime-mv
Native Rust agent runtime: Axum WebSocket/SSE/REST gateway, heartbeat scheduler, dependency-aware task workflow, SQLite storage. Attachment of AienOS. Pre-alpha.
Brought by drakestapleton
aegis-runtime-mv / tests / policy_guard_tests.rs
| 1 | use aegis::policy_guard::ProbePolicyGuard; |
| 2 | |
| 3 | #[tokio::test] |
| 4 | async fn test_probe_policy_guard_reference_execution() { |
| 5 | // Permissive threshold to verify pipeline execution |
| 6 | let guard = ProbePolicyGuard::new_reference(0.0); |
| 7 | let allowed = guard.check_action("read_file", "src/lib.rs").await.unwrap(); |
| 8 | assert!(allowed); |
| 9 | } |
| 10 | |
| 11 | #[tokio::test] |
| 12 | async fn test_probe_policy_guard_fails_closed_on_strict_threshold() { |
| 13 | // Impossibly high threshold forces fail-closed behavior |
| 14 | let guard = ProbePolicyGuard::new_reference(0.999999); |
| 15 | let result = guard.check_action("rm_rf", "/").await; |
| 16 | assert!(result.is_err()); |
| 17 | let err_msg = result.unwrap_err().to_string(); |
| 18 | assert!(err_msg.contains("blocked by sovereign probe policy")); |
| 19 | } |