Skip to content

Remove prefilter-bypassing search modes (regex / --any / -L)#33

Merged
tony merged 3 commits into
masterfrom
drop-fullscan-search-modes
May 31, 2026
Merged

Remove prefilter-bypassing search modes (regex / --any / -L)#33
tony merged 3 commits into
masterfrom
drop-fullscan-search-modes

Conversation

@tony
Copy link
Copy Markdown
Owner

@tony tony commented May 31, 2026

Summary

Three search modes that bypassed the ripgrep prefilter (prefilter_sources_by_root)—triggering a full-corpus parse that materialized every record in memory (~1.3 GB RSS)—have been removed. Until these modes can be served within bounded memory, their public interface is suspended to ensure system stability:

  • CLI: search --regex and search --any
  • MCP: regex and any_term parameters for the search and validate_query tools (and their associated models)
  • grep -L / --files-without-match

agentgrep search is now strictly literal AND-matching. grep and find remain unaffected and regex-by-default, as they utilize ripgrep directly and avoid the memory bottleneck. The internal SearchQuery.regex and any_term fields are preserved for the query language, TUI, and future re-implementation.

This change addresses a performance cliff inherent in the current in-memory matcher. Re-introducing these modes with bounded memory is tracked in #32.

Test plan

  • Full gate green before each commit: ruff check, ruff format, ty check, pytest --reruns 0 (880 passed), just build-docs.
  • New regression cases assert the flags are rejected at parse time (search --regex / --any, grep -L exit 2 with "unrecognized arguments") and that the MCP search / validate_query tools no longer accept regex / any_term.
  • Smoke: agentgrep search foo --regex|--any and agentgrep grep -L foo exit 2; agentgrep search foo and agentgrep grep foo still work.

tony added 2 commits May 31, 2026 05:38
…toggles

why: search --regex, search --any, and grep -L defeat the ripgrep
prefilter and force a (near) full-corpus parse that materialises every
matching record in memory. Until the engine can serve them within
bounded memory, exposing the toggles advertises capability we do not
back at scale.

what:
- Remove the search --regex / --any flags and the grep -L /
  --files-without-match flag, plus their SearchArgs / GrepArgs fields,
  builders, and the grep files-without-match render path.
- Drop the regex / any_term parameters from the MCP search and
  validate_query tools and their request/echo models; stop advertising
  them in the server instructions.
- Keep SearchQuery.regex / any_term: grep and find stay regex-by-default
  (ripgrep handles that), the query language and TUI still use them, and
  they remain the seam for re-adding the modes later.
- Replace the obsolete flag tests with cases asserting the flags are now
  rejected; refresh the affected GrepArgs / SearchArgs test helpers.
why: The CLI search --regex / --any flags, the MCP search and
validate_query regex / any_term parameters, and grep -L are no longer
part of the surface, so the reference pages and the docs-only FastMCP
shim must stop advertising them.

what:
- grep page: drop the "files without matches" section, remove -L from
  the eager-output list, and narrow the -v note to -c only.
- FastMCP docs shim: mirror the trimmed search / validate_query
  signatures (literal AND terms, no regex / any_term).
- Drop the contradictory "match any term" tutorial example and the
  regex mention in the validate_query "use when" note.
@tony tony changed the title Withdraw prefilter-bypassing search modes (regex / --any / -L) Remove prefilter-bypassing search modes (regex / --any / -L) May 31, 2026
@tony tony changed the title Remove prefilter-bypassing search modes (regex / --any / -L) Withdraw prefilter-bypassing search modes (regex / --any / -L) May 31, 2026
@tony tony changed the title Withdraw prefilter-bypassing search modes (regex / --any / -L) Remove prefilter-bypassing search modes (regex / --any / -L) May 31, 2026
@tony tony force-pushed the drop-fullscan-search-modes branch from a299af2 to 747f447 Compare May 31, 2026 11:02
@tony tony merged commit b50635d into master May 31, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant