M2.3: find in files backend

crates/search: parallel ignore walk + grep-searcher with the project's
ignore rules (vendor searched as library, node_modules and .git skipped),
literal or regex, case, whole word, include/exclude globs, binary and
> 8 MiB skips, match cap, cancel token, buffer overlay.

Engine: search.find returns {searchId} at once and runs off the lock;
pump_vfs drains results into searchResults (one per file, at most 500
per pump) and searchDone; search.cancel. Testkit: generated search tree.
Tests: library unit and property tests, engine tests, TCP control test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
danny 2026-10-16 22:03:17 +02:00
parent a6b2fd1300
commit 172693c8dd
21 changed files with 2231 additions and 5 deletions

View file

@ -130,7 +130,8 @@ impl Engine {
/// Applies pending changes on disk (reloads clean buffers, reports
/// changed directories and conflicts), writes due recovery-journal
/// entries (see [`crate::journal`]) and returns every queued event.
/// entries (see [`crate::journal`]), moves finished search results into
/// events (see [`cmd::search`]) and returns every queued event.
/// Hosts call it regularly, e.g. every 100 ms from a background thread.
///
/// # Errors
@ -141,6 +142,7 @@ impl Engine {
guard::run(|| {
crate::workspace::pump(state);
crate::journal::tick(state, std::time::Instant::now());
cmd::search::pump(state);
Ok(())
})?;
Ok(state.take_events())
@ -373,6 +375,8 @@ mod tests {
"recovery.discard",
"recovery.list",
"recovery.restore",
"search.cancel",
"search.find",
"settings.get",
"settings.list",
"settings.reset",