fix: support trailing globs in path search - #1881
Conversation
|
✅ Health of changed files: 5.8 (unchanged) 📋 At a glance Files & modules (2)
✅ Health gate: passed 🔎 More signals (2)🗺️ Change map flowchart LR
subgraph PR ["Changed in this PR (2 with dependents)"]
f_packages_server_src_repowise_server_mcp_server_tool_search_symbols_py[".../mcp_server/tool_search_symbols.py 🔥"]:::changed
f_tests_unit_server_mcp_test_search_py[".../mcp/test_search.py"]:::changed
end
f_packages_server_src_repowise_server_mcp_server__prose_symbols_py[".../mcp_server/_prose_symbols.py"]
f_packages_server_src_repowise_server_mcp_server_tool_search_symbols_py --> f_packages_server_src_repowise_server_mcp_server__prose_symbols_py
f_packages_server_src_repowise_server_mcp_server_tool_search_py[".../mcp_server/tool_search.py"]
f_packages_server_src_repowise_server_mcp_server_tool_search_symbols_py --> f_packages_server_src_repowise_server_mcp_server_tool_search_py
f_packages_server_src_repowise_server_mcp_server__answer_pipeline_py[".../mcp_server/_answer_pipeline.py"]
f_tests_unit_server_mcp_test_search_py --> f_packages_server_src_repowise_server_mcp_server__answer_pipeline_py
f_packages_server_src_repowise_server_mcp_server_tool_answer_answer_py[".../tool_answer/answer.py"]
f_tests_unit_server_mcp_test_search_py --> f_packages_server_src_repowise_server_mcp_server_tool_answer_answer_py
classDef changed fill:#dbeafe,stroke:#1d4ed8,color:#1e3a5f
classDef warn fill:#fef3c7,stroke:#b45309,color:#78350f
classDef guard fill:#dcfce7,stroke:#15803d,color:#14532d
Solid arrows: code that imports the changed files (4 direct dependents, from the last indexed snapshot). Dashed: history/tests. 🔥 Hotspots touched (2)
👀 Suggested reviewers @RaghavChamadiya 📊 See the full report for this PR |
|
Added boundary coverage for ordinary filenames, whitespace plus leading/trailing markers, marker-only queries, and mid-path glob markers. Focused path-search tests now pass 8/8; Ruff and git diff --check also pass. |
93cf105 to
711df1a
Compare
|
@mikemikimike, this is the trailing-glob fix I am taking for #1871, over the other PR on the same issue. Yours arrived first and links the issue, and the parametrized table covering Your CI red is not yours. Only Python 3.13 failed while 3.11 and 3.12 passed, which is already the shape of something unrelated. The failure is: That assertion counts
One thing I would like from the other PR when you rebase, and it is a comment rather than code. Nothing on main will say why |
|
Heads up before merging — the current head ( What happened. The docs commit Consequence. and the two glob tests this PR adds fail on the branch itself: Verified three ways against the exact head SHA via the raw blob (not a local checkout): AST walk shows Ready patch. Based on - # Path mode is substring matching, so only boundary markers are meaningful;\n # stripping mid-path globs would change the query into a different literal path.\n qnorm = query.strip().lower().replace("\\", "/").strip("*?")
+ # Path mode is substring matching, so boundary ``*?`` markers carry no
+ # information and are stripped. Mid-string globs (``src/*/main.py``) are
+ # left alone: a substring match cannot honour them, so stripping there
+ # would change the query.
+ qnorm = query.strip().lower().replace("\\", "/").strip("*?")On that branch: glob tests 7/7 pass, |
|
Verified the new head (c2d503b) locally: the qnorm assignment is restored, the 4-line comment landed as written, and the glob suite passes (7/7). Ready to merge from my side. Thanks for the quick turnaround. |
Summary
*and?in path-mode searches as boundary glob markers.Related Issues
Fixes #1871
Implementation
Normalize the path query by stripping only leading/trailing
*and?after path normalization. This preserves the existing substring matching behavior and deliberately avoids interpreting mid-path glob syntax as a broader glob language.Compatibility
Queries without trailing glob markers are unchanged. A query containing only glob markers continues to return no results.
Test Plan
PYTHONPATH=packages/server/src;packages/core/src python -m pytest tests/unit/server/mcp/test_search.py -k trailing_glob -q— 2 passedpython -m ruff check packages/server/src/repowise/server/mcp_server/tool_search_symbols.py tests/unit/server/mcp/test_search.py— passedgit diff --check— passedtest_search.pymodule was attempted but exceeded the local wait window and was stopped; the focused regression tests completed successfully.