mirror of
https://github.com/openai/codex.git
synced 2026-11-20 22:40:37 +00:00
Split in-memory execution policy rules into a separate crate (#62615)
## Why Configuration, protocol, and prompt code use in-memory policies and previously pulled in the Starlark parser through `codex-execpolicy`. ## What changed Move policy construction, rule validation, and evaluation into `codex-execpolicy-rules` and use it directly from those crates. Keep Starlark policy loading and file updates in `codex-execpolicy`, which re-exports the shared rule types and wraps rule validation errors while preserving their source locations. GitOrigin-RevId: 5bc70d3cd387b43a3ad1fcc56af96ad169ac8b13
This commit is contained in:
@@ -7,7 +7,6 @@ use std::sync::Arc;
|
||||
use anyhow::Context;
|
||||
use anyhow::Result;
|
||||
use codex_execpolicy::Decision;
|
||||
use codex_execpolicy::Error;
|
||||
use codex_execpolicy::Evaluation;
|
||||
use codex_execpolicy::MatchOptions;
|
||||
use codex_execpolicy::NetworkRuleProtocol;
|
||||
@@ -17,6 +16,7 @@ use codex_execpolicy::PolicyParser;
|
||||
use codex_execpolicy::PrefixPattern;
|
||||
use codex_execpolicy::PrefixRule;
|
||||
use codex_execpolicy::RequirementsExecPolicy;
|
||||
use codex_execpolicy::RuleError;
|
||||
use codex_execpolicy::RuleMatch;
|
||||
use codex_execpolicy::RuleRef;
|
||||
use codex_execpolicy::blocking_append_allow_prefix_rule;
|
||||
@@ -288,7 +288,7 @@ fn add_prefix_rule_rejects_empty_prefix() -> Result<()> {
|
||||
let result = policy.add_prefix_rule(&[], Decision::Allow);
|
||||
|
||||
match result.unwrap_err() {
|
||||
Error::InvalidPattern(message) => assert_eq!(message, "prefix cannot be empty"),
|
||||
RuleError::InvalidPattern(message) => assert_eq!(message, "prefix cannot be empty"),
|
||||
other => panic!("expected InvalidPattern(..), got {other:?}"),
|
||||
}
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user