Skip to content

fix(search): retain source candidates in test-heavy results - #1240

Open
azizur100389 wants to merge 1 commit into
tirth8205:stagingfrom
azizur100389:codex/search-source-candidates
Open

azizur100389 wants to merge 1 commit into
tirth8205:stagingfrom
azizur100389:codex/search-source-candidates

Conversation

@azizur100389

@azizur100389 azizur100389 commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Linked issue

Refs #419. This addresses the full-text ranking case where tests occupy the candidate window. The embedding model stays configurable.

What & why

The source preference runs after the FTS limit, so it cannot recover an implementation that never reached reranking. When demoted rows fill a window, use a bounded second FTS lookup to keep eligible matches in the ranking pool. Explicit test searches keep their normal ranking.

How it was tested

  • Reproduced on staging with twelve tests crowding out an exact source symbol. The regression checks that the implementation ranks first, test hits remain available, and explicit test searches still return tests.
  • python -m pytest tests/test_search_quality.py tests/test_search.py tests/test_yaml_locale_files.py tests/test_tools.py -q --tb=short — 288 passed.
  • Ruff and Bandit passed locally.

Final validation

  • 21 GitHub checks passed at 1323f10. The Python 3.10–3.13 matrix passed 8,285 tests per version at 88.88–88.91% coverage. The minimum-dependency matrix, browser, native Windows, and Linux/macOS/Windows MCP end-to-end jobs passed.
  • The manual upgrade job is skipped on PRs.

@github-actions

Copy link
Copy Markdown

code-review-graph review

Overall risk: 0.55 (MEDIUM) — 5 changed function(s)/class(es), 3 affected flow(s), 1 test gap(s) (0 with no tested caller found, 1 reached only through a caller)

Risk-scored changes

Risk Level Symbol Location Tested
0.55 medium code_review_graph/search.py::_fts_search code_review_graph/search.py:747 yes
0.55 medium code_review_graph/search.py::hybrid_search code_review_graph/search.py:1011 yes
0.35 low code_review_graph/search.py::_fts_search_past_demoted_rows code_review_graph/search.py:962 indirect
0.05 low tests/test_search_quality.py::TestSearchBehaviour tests/test_search_quality.py:264 (test)
0.05 low tests/test_search_quality.py::TestSearchBehaviour.test_test_heavy_fts_window_still_has_source_candidates tests/test_search_quality.py:364 (test)

Affected execution flows

  • benchmark_debug_workflow — criticality 0.74, 810 node(s) across 20 file(s)
  • main — criticality 0.72, 1616 node(s) across 59 file(s)
  • run_token_benchmark — criticality 0.69, 58 node(s) across 6 file(s)

Reached only through a caller

No test names these directly, but a tested caller reaches them along the call path shown. That is a path in the call graph, not a record of execution -- the caller's tests may never take this branch. Treat it as where to look, not as coverage: these count as gaps and are scored as untested.

  • code_review_graph/search.py::_fts_search_past_demoted_rows (code_review_graph/search.py:962) — via code_review_graph/search.py::hybrid_search, 1 hop(s)

Powered by code-review-graph — local-first analysis; no code leaves the CI runner.

This branch has not been deployed

No deployments
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