mirror of
https://github.com/openai/codex.git
synced 2026-11-10 21:00:47 +00:00
## What changed Collect compressed rollout paths and scan them in up to four concurrent batches, reusing compiled search patterns within each batch. Preserve match snippets, plain rollout path keys, and per-file error handling. ## Testing Extend the regression test to verify matches across seven compressed rollouts while skipping a corrupt file, and retain coverage for oversized search patterns and missing files. GitOrigin-RevId: 522403654ab8577499f8f8043ccc017590c4833e
39 lines
1.3 KiB
Rust
39 lines
1.3 KiB
Rust
//! Regression coverage for rollout search error handling.
|
|
|
|
use super::*;
|
|
use pretty_assertions::assert_eq;
|
|
use tempfile::TempDir;
|
|
|
|
#[tokio::test]
|
|
async fn compressed_search_preserves_error_handling() -> io::Result<()> {
|
|
let root = TempDir::new()?;
|
|
let line = br#"{"timestamp":"2025-01-01T00:00:00Z","type":"event_msg","payload":{"type":"agent_message","message":"needle"}}"#;
|
|
let compressed = zstd::stream::encode_all(&line[..], 3)?;
|
|
let mut expected = RolloutSearchMatches::new();
|
|
for index in 0..7 {
|
|
let path = root.path().join(format!("rollout-{index:04}.jsonl"));
|
|
std::fs::write(path.with_extension("jsonl.zst"), &compressed)?;
|
|
expected.insert(path, Some("needle".to_string()));
|
|
}
|
|
std::fs::write(root.path().join("rollout-broken.jsonl.zst"), b"not zstd")?;
|
|
assert_eq!(
|
|
scan_compressed_rollout_matches(root.path(), "needle").await?,
|
|
expected
|
|
);
|
|
let query = "a".repeat(500_000);
|
|
|
|
assert!(case_insensitive_literal_regex(&query).is_err());
|
|
assert_eq!(
|
|
scan_compressed_rollout_matches(root.path(), &query).await?,
|
|
RolloutSearchMatches::new()
|
|
);
|
|
assert_eq!(
|
|
first_rollout_content_match_snippet(&root.path().join("missing.jsonl"), &query)
|
|
.await
|
|
.unwrap_err()
|
|
.kind(),
|
|
io::ErrorKind::NotFound
|
|
);
|
|
Ok(())
|
|
}
|