mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Consolidate Guardian tests at shared policy and context boundaries (#46064)
## What changed - Move approval routing tests into `guardian-reviewer`, covering both reviewer choices across `UnlessTrusted`, `OnRequest`, `Granular`, and `Never` without host session setup. - Combine reviewer configuration checks into one test for isolation from parent customizations. - Cover filtering of ordinary developer messages while preserving manual approvals in `guardian-context`, removing the duplicate async scorer test. GitOrigin-RevId: b39ef21475e2f5d99d758f2d27615449b252dc65
This commit is contained in:
1 parent
e412b93d08
commit
08663cc91b
6 files changed
+85
-209
No files matched your search
@@ -183,3 +183,7 @@ impl<H: ReviewHost> ReviewRequest<'_, H> {
|
||||
ReviewDecision::Approved
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "routing_tests.rs"]
|
||||
mod tests;
|
||||
@@ -0,0 +1,30 @@
|
||||
//! Approval routing coverage at the policy boundary, without host session setup.
|
||||
|
||||
use super::routes_approval_policy_to_guardian;
|
||||
use codex_protocol::config_types::ApprovalsReviewer;
|
||||
use codex_protocol::protocol::AskForApproval;
|
||||
use codex_protocol::protocol::GranularApprovalConfig;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
#[test]
|
||||
fn approval_routing_depends_on_policy_and_reviewer() {
|
||||
for (policy, expected) in [
|
||||
(AskForApproval::UnlessTrusted, [false, false]),
|
||||
(AskForApproval::OnRequest, [false, true]),
|
||||
(
|
||||
AskForApproval::Granular(GranularApprovalConfig {
|
||||
sandbox_approval: true,
|
||||
rules: true,
|
||||
skill_approval: true,
|
||||
request_permissions: true,
|
||||
mcp_elicitations: true,
|
||||
}),
|
||||
[false, true],
|
||||
),
|
||||
(AskForApproval::Never, [false, false]),
|
||||
] {
|
||||
let actual = [ApprovalsReviewer::User, ApprovalsReviewer::AutoReview]
|
||||
.map(|reviewer| routes_approval_policy_to_guardian(policy, reviewer));
|
||||
assert_eq!(actual, expected, "approval policy: {policy:?}");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user