mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
## What changed Remove standalone tests across Guardian review sessions, configuration, assessment schemas, transcripts, and trusted skill paths. Strengthen the existing request layout snapshot test to check exact transcript separators, the action header, and parent session ID placement before snapshot whitespace normalization. Concatenate user input text without inserting newlines so the assertions validate the actual request formatting. GitOrigin-RevId: 06d262a1a85b1a8401796958f300c894146d2e1b
49 lines
1.5 KiB
Rust
49 lines
1.5 KiB
Rust
use super::MAX_TRUSTED_SKILL_TOKENS;
|
|
use super::TRUSTED_SKILLS_PREFIX;
|
|
use super::TrustedSkills;
|
|
use codex_context_fragments::ContextualUserFragment;
|
|
use codex_protocol::protocol::TruncationPolicy;
|
|
use pretty_assertions::assert_eq;
|
|
|
|
fn rendered_paths(paths: Vec<String>) -> Vec<String> {
|
|
let rendered = TrustedSkills { paths }.render();
|
|
assert!(rendered.len() <= TruncationPolicy::Tokens(MAX_TRUSTED_SKILL_TOKENS).byte_budget());
|
|
serde_json::from_str(
|
|
rendered
|
|
.strip_prefix(TRUSTED_SKILLS_PREFIX)
|
|
.expect("trusted skill context should contain JSON evidence"),
|
|
)
|
|
.expect("trusted skill evidence should remain valid JSON")
|
|
}
|
|
|
|
#[test]
|
|
fn bounds_escaped_skill_paths_without_corrupting_json_or_utf8() {
|
|
let paths = (0..16)
|
|
.map(|index| {
|
|
format!(
|
|
"/home/user/.codex/skills/{index:03}/{}SKILL.md",
|
|
"\u{0001}é".repeat(80)
|
|
)
|
|
})
|
|
.collect::<Vec<_>>();
|
|
let retained = rendered_paths(paths.clone());
|
|
|
|
assert!(!retained.is_empty());
|
|
assert!(retained.len() < paths.len());
|
|
assert!(retained.iter().all(|path| paths.contains(path)));
|
|
}
|
|
|
|
#[test]
|
|
fn preserves_multiple_invoked_skill_paths() {
|
|
assert_eq!(
|
|
rendered_paths(vec![
|
|
"/home/user/.codex/skills/first/SKILL.md".to_owned(),
|
|
"/home/user/.codex/skills/second/SKILL.md".to_owned(),
|
|
]),
|
|
vec![
|
|
"/home/user/.codex/skills/first/SKILL.md",
|
|
"/home/user/.codex/skills/second/SKILL.md",
|
|
],
|
|
);
|
|
}
|