mirror of
https://github.com/openai/codex.git
synced 2026-05-15 16:53:05 +00:00
fix: rename autoreview security event kind
Co-authored-by: Codex noreply@openai.com
This commit is contained in:
@@ -7,22 +7,22 @@ use sqlx::sqlite::SqliteRow;
|
||||
pub enum SecurityEventKind {
|
||||
/// Sandbox enforcement observed and blocked an attempted action.
|
||||
SandboxViolation,
|
||||
/// A reviewer assessed a proposed action.
|
||||
GuardianAssessment,
|
||||
/// Automated review made a decision about a proposed action.
|
||||
AutoReviewDecision,
|
||||
}
|
||||
|
||||
impl SecurityEventKind {
|
||||
pub const fn as_str(self) -> &'static str {
|
||||
match self {
|
||||
Self::SandboxViolation => "sandbox_violation",
|
||||
Self::GuardianAssessment => "guardian_assessment",
|
||||
Self::AutoReviewDecision => "auto_review_decision",
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_db_value(value: &str) -> Option<Self> {
|
||||
match value {
|
||||
"sandbox_violation" => Some(Self::SandboxViolation),
|
||||
"guardian_assessment" => Some(Self::GuardianAssessment),
|
||||
"auto_review_decision" => Some(Self::AutoReviewDecision),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ mod tests {
|
||||
runtime
|
||||
.insert_security_event(&SecurityEventCreateParams {
|
||||
created_at: 1_700_000_002,
|
||||
kind: SecurityEventKind::GuardianAssessment,
|
||||
kind: SecurityEventKind::AutoReviewDecision,
|
||||
thread_id: Some("thread-2".to_string()),
|
||||
turn_id: Some("turn-3".to_string()),
|
||||
call_id: Some("call-3".to_string()),
|
||||
@@ -210,7 +210,7 @@ mod tests {
|
||||
details_json: None,
|
||||
})
|
||||
.await
|
||||
.expect("insert guardian event");
|
||||
.expect("insert auto review event");
|
||||
|
||||
assert_eq!(
|
||||
runtime
|
||||
@@ -275,15 +275,15 @@ mod tests {
|
||||
runtime
|
||||
.list_security_events(&SecurityEventQuery {
|
||||
thread_id: None,
|
||||
kind: Some(SecurityEventKind::GuardianAssessment),
|
||||
kind: Some(SecurityEventKind::AutoReviewDecision),
|
||||
limit: Some(1),
|
||||
})
|
||||
.await
|
||||
.expect("list guardian events"),
|
||||
.expect("list auto review events"),
|
||||
vec![SecurityEvent {
|
||||
id: 3,
|
||||
created_at: 1_700_000_002,
|
||||
kind: SecurityEventKind::GuardianAssessment,
|
||||
kind: SecurityEventKind::AutoReviewDecision,
|
||||
thread_id: Some("thread-2".to_string()),
|
||||
turn_id: Some("turn-3".to_string()),
|
||||
call_id: Some("call-3".to_string()),
|
||||
|
||||
Reference in New Issue
Block a user