mirror of
https://github.com/openai/codex.git
synced 2026-10-21 17:48:44 +00:00
## Why Compressed rollout searches recompiled the same query patterns for every file. ## What changed Lazily compile and reuse the JSON-escaped and content search patterns across each scan, including the fallback scan when `ripgrep` is unavailable. Keep compilation failures within the existing per-file error handling and open files before compiling patterns. ## Testing Add regression coverage verifying that an oversized query does not fail the compressed rollout scan and that a missing file still returns `NotFound` before query compilation. GitOrigin-RevId: 0d41cbca6e1f716fc234c268493d8dd94c34975e
28 lines
830 B
Rust
28 lines
830 B
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 path = root.path().join("rollout-0001.jsonl.zst");
|
|
std::fs::write(&path, zstd::stream::encode_all(&b""[..], 3)?)?;
|
|
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(())
|
|
}
|