1. Collapse the comparison cluster into a deep Ranking module
Before
After
Problem
14 micro-files, each 10–29 lines — each shallow per-file, but each one just calls the next. Understanding "how does search ranking work?" requires bouncing through the entire call graph. Tests hit 14 leaf seams instead of the ranking behaviour.
Solution
One Ranking module in libraries/comparison/ with a two-method interface: rank(l, r, cutoff) and optionally sort(results, cutoff). The 14 current functions become private implementation.
Wins
- → Locality: ranking logic in one place
- → Interface shrinks: 14 exports → 1–2
- → Leverage: callers learn one seam
- → Tests target the behaviour, not leaf calls
- → Deletion test passes: delete individual fns, complexity concentrates here