Skip to content

fix(search): resolve relative file_filter patterns against indexed root#22

Merged
AperturePlus merged 1 commit intodevelopfrom
codex/fix-file_filter-for-relative-paths
Mar 13, 2026
Merged

fix(search): resolve relative file_filter patterns against indexed root#22
AperturePlus merged 1 commit intodevelopfrom
codex/fix-file_filter-for-relative-paths

Conversation

@AperturePlus
Copy link
Owner

Motivation

  • The file_filter glob is matched against absolute file paths stored in the index, so relative directory-prefixed patterns like apps/web/**/*.tsx never matched and returned zero results.
  • Users expect relative-prefix filters to be resolved against the indexed repository root (the path parameter), so patterns such as apps/web/**/*.tsx should match /abs/path/to/repo/apps/web/....

Description

  • Added resolve_file_filter_pattern(file_filter, indexed_root) in aci.core.path_utils to normalize relative directory-prefixed glob patterns into absolute patterns rooted at the indexed repository; wildcard-only patterns (e.g. *.py, **/*.py) and already-absolute patterns are preserved.
  • Applied normalization at search entrypoints so the SearchService receives the normalized file_filter from MCP (aci/mcp/handlers.py), HTTP (aci/http_server.py), and CLI (aci/cli/__init__.py).
  • Added unit tests in tests/unit/test_runtime_path_resolution.py covering wildcard-only patterns, relative-prefixed expansion, and absolute pattern preservation.
  • Change is scoped to input normalization at ingress points and does not modify index schema or vector-store internals.

Testing

  • Ran uv run ruff check src tests and lint checks passed.
  • Ran uv run pytest tests/unit/test_runtime_path_resolution.py -q -v --tb=short and the new tests passed (9 passed).
  • Running the entire test suite uv run pytest tests/ -v --tb=short -q --durations=10 shows existing unrelated failures on this branch and is not caused by this change.
  • Ran uv run mypy src --ignore-missing-imports --no-error-summary which surfaced repository-wide typing issues unrelated to this change (mypy in CI is informational/non-blocking).

Codex Task

Why:
Relative directory-prefixed glob filters (e.g. apps/web/**/*.tsx) were matched directly against absolute stored file paths, causing silent zero-result searches.

What:
- Added resolve_file_filter_pattern utility to normalize relative prefixed filters to absolute patterns under the indexed root.
- Applied normalization in MCP, HTTP, and CLI search entrypoints before calling SearchService.
- Added unit tests covering wildcard-only, relative-prefixed, and absolute filter patterns.

Test:
- uv run ruff check src tests (pass)
- uv run pytest tests/unit/test_runtime_path_resolution.py -q -v --tb=short (pass)
- uv run pytest tests/ -v --tb=short -q --durations=10 (fails in existing unrelated tests)
- uv run mypy src --ignore-missing-imports --no-error-summary (fails with existing repository typing errors)
@AperturePlus AperturePlus merged commit 1ea83d8 into develop Mar 13, 2026
1 check passed
@AperturePlus AperturePlus deleted the codex/fix-file_filter-for-relative-paths branch March 17, 2026 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant