fix(search): resolve relative file_filter patterns against indexed root#22
Merged
AperturePlus merged 1 commit intodevelopfrom Mar 13, 2026
Merged
Conversation
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
file_filterglob is matched against absolute file paths stored in the index, so relative directory-prefixed patterns likeapps/web/**/*.tsxnever matched and returned zero results.pathparameter), so patterns such asapps/web/**/*.tsxshould match/abs/path/to/repo/apps/web/....Description
resolve_file_filter_pattern(file_filter, indexed_root)inaci.core.path_utilsto 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.SearchServicereceives the normalizedfile_filterfrom MCP (aci/mcp/handlers.py), HTTP (aci/http_server.py), and CLI (aci/cli/__init__.py).tests/unit/test_runtime_path_resolution.pycovering wildcard-only patterns, relative-prefixed expansion, and absolute pattern preservation.Testing
uv run ruff check src testsand lint checks passed.uv run pytest tests/unit/test_runtime_path_resolution.py -q -v --tb=shortand the new tests passed (9 passed).uv run pytest tests/ -v --tb=short -q --durations=10shows existing unrelated failures on this branch and is not caused by this change.uv run mypy src --ignore-missing-imports --no-error-summarywhich surfaced repository-wide typing issues unrelated to this change (mypy in CI is informational/non-blocking).Codex Task