Skip to content

refactor(ranker): split ranking helpers into focused modules - #145

Merged
Andyyyy64 merged 2 commits into
Andyyyy64:mainfrom
RaghavRD:refactor/ranker-split
Aug 14, 2026
Merged

refactor(ranker): split ranking helpers into focused modules#145
Andyyyy64 merged 2 commits into
Andyyyy64:mainfrom
RaghavRD:refactor/ranker-split

Conversation

@RaghavRD

@RaghavRD RaghavRD commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Move ranking orchestration, filters, quality scoring, source trust constants, and candidate variant selection into focused modules.

Keep whichllm.engine.ranker as a compatibility shim so existing public and test imports continue to work.

Refs #41

What

  • Move rank_models orchestration into whichllm.engine.ranking
  • Move model/profile/evidence filters into ranking_filters
  • Move quality scoring and family selection logic into ranking_score
  • Move source trust constants into ranking_sources
  • Move candidate GGUF/synthetic variant logic into ranking_variants
  • Preserve old imports through whichllm.engine.ranker

Why

This continues the #41 core-module refactor by splitting the large ranker module into focused pieces without changing the public import surface.

This is the penultimate major #41 refactor slice. After this, the remaining large core module is src/whichllm/cli.py.

Testing

  • Focused ranker/regression tests pass (74 passed)
  • CLI monkeypatch compatibility tests pass (6 passed)
  • Ruff check passes
  • Ruff format check passes
  • Full suite except environment-sensitive run smoke test passes (465 passed, 1 deselected)

Notes

Full pytest in my sandbox hit test_run_exits_gracefully because model fetching returned a DNS/network error message from the environment. The ranker-specific and compatibility coverage passes.

Move ranking orchestration, filters, quality scoring, source trust constants, and candidate variant selection into focused modules.

Keep whichllm.engine.ranker as a compatibility shim so existing public and test imports continue to work.

Refs Andyyyy64#41

@Andyyyy64 Andyyyy64 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

really sorry this took me so long to review, and thanks for your patience here.

I retested this on the current main, including the changes that landed while the PR was waiting. the split preserves the ranking logic, the compatibility shim keeps the existing imports working, and the new module boundaries look much easier to work with.

local verification on current main:

  • Python 3.11: 484 passed
  • Python 3.12: 484 passed
  • Python 3.13: 484 passed
  • Ruff lint and format checks passed

looks good to me — thanks for taking on this refactor.

@Andyyyy64
Andyyyy64 merged commit ea32ed2 into Andyyyy64:main Aug 14, 2026
4 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.

2 participants