Skip to content

YAGNI cleanup and internal module renames#6

Merged
pko89403 merged 4 commits into
mainfrom
refactor/yagni-cleanup
Jul 5, 2026
Merged

YAGNI cleanup and internal module renames#6
pko89403 merged 4 commits into
mainfrom
refactor/yagni-cleanup

Conversation

@pko89403

@pko89403 pko89403 commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Summary

Two-commit cleanup of the core library, driven by a YAGNI review. Public API behavior is unchanged except for the removal of never-implemented surface; the confidence subsystem is kept intact (only file names touched) for the upcoming CBDR work.

1. Remove speculative code and move benchmarks out of the package (ec7fb77)

  • Delete unimplemented provider stubs (OpenAIProvider, AnthropicProvider, GeminiProvider + async forms) and the ranksmith._providers re-export shim. Azure remains the only bundled provider; other vendors plug in via a custom ModelProvider.
  • Drop single-value config knobs: per-strategy algorithm literals (each accepted exactly one value; the value is still emitted in result metadata), pair_order_parallelism (async pairwise now always compares both orders concurrently), score_metadata_key (fixed to "score"), and ModelRequest.response_format/temperature (hardcoded in the Azure provider).
  • Concurrency lives in async strategies only: removed ThreadPoolExecutor paths from sync TourRank/AcuRank; group_parallelism/batch_parallelism moved to the async classes.
  • Deduplicate validation: top_k/document-length checks unified in strategies/common, no more triple validation per request.
  • Ship less: _benchmark/_mteb_eval/_metrics (~930 lines of script-support code whose only callers are excluded from the wheel) moved to a non-packaged benchmarks/ directory; test-only helpers deleted.
  • Docs (README en/ko, advisor skill, wiki) and tests updated in lock-step.

2. Drop leading underscores from internal module filenames (f8b8413)

Renames 27 private modules (e.g. strategies/_listwise.pystrategies/listwise.py) across strategies/, providers/, and the three confidence packages, updating every import path. Package __init__ files keep controlling the public API, and git tracks all files as renames (99–100% similarity).

Net effect: −1,739 / +296 lines, wheel no longer contains stubs or benchmark modules.

Verification

  • pytest: 424 passed at each commit; the 7 failures are pre-existing lightgbm libomp.dylib environment issues on the dev machine, unrelated to this change
  • mypy src/: clean (45 files); ruff: clean
  • Wheel rebuilt and inspected: no stub/benchmark/underscore modules packaged
  • Live end-to-end smoke test against a local LM Studio model (qwen3.5-9b-mlx): all ten sync/async strategies rerank a 6-document query correctly, with identical orderings before and after each commit (temperature 0, deterministic comparison)

🤖 Generated with Claude Code

pko89403 and others added 4 commits July 5, 2026 10:36
YAGNI cleanup of the core library:
- Delete unimplemented OpenAI/Anthropic/Gemini provider stubs and the
  ranksmith._providers re-export shim
- Drop single-value config knobs: per-strategy `algorithm` literals,
  `pair_order_parallelism`, `score_metadata_key`, and
  ModelRequest.response_format/temperature (hardcoded in the Azure provider)
- Keep concurrency in async strategies only: remove ThreadPoolExecutor
  paths from sync TourRank/AcuRank; `group_parallelism` and
  `batch_parallelism` now live on the async classes
- Deduplicate validation helpers via strategies/_common (top_k, document
  length) and stop re-validating top_k in result builders
- Move _benchmark/_mteb_eval/_metrics (~930 lines) to a new non-packaged
  benchmarks/ directory so script-support code no longer ships in the
  wheel; delete test-only helpers from mteb_eval
- Update README/advisor skill/wiki docs and tests accordingly

Verified: pytest (424 passed; 7 pre-existing lightgbm/libomp env
failures), mypy clean, and live end-to-end smoke runs of all ten
sync/async strategies against a local LM Studio model.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Rename 27 private modules across strategies/, providers/, confidence/,
confidence_generation/, and confidence_training/ (e.g.
strategies/_listwise.py -> strategies/listwise.py) and update every
import path. Package __init__ files keep controlling the public API, so
no exported name changes.

Verified: pytest and mypy unchanged, plus live LM Studio smoke runs of
all ten sync/async strategies producing identical rankings before and
after the rename.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Six identical ensure_*_model_client guards -> one ensure_capability()
- Sync/async ModelClient prompt construction shared via message builders
- benchmarks: statistics.fmean, drop unused license_text parameter

No behavior change: prompts, error messages, and public API identical.
Verified with pytest/mypy plus an LM Studio end-to-end smoke run of all
ten strategies producing identical rankings.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@pko89403
pko89403 merged commit b614175 into main Jul 5, 2026
5 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.

1 participant