Files
gitlore/src/cli/commands/who.rs
Taylor Eernisse 0034958faf fix(who): match old_path in detail/overlap queries, include closed MRs
Fix two asymmetries between the main expert scoring query
(build_expert_sql_v2) and the auxiliary queries (query_expert_details
and query_overlap):

1. Missing old_path matching: The main scoring query correctly
   searches both position_new_path AND position_old_path (via UNION ALL
   branches) for DiffNotes, and both new_path AND old_path for
   mr_file_changes. However, query_expert_details and query_overlap
   only checked position_new_path / fc.new_path. This caused --detail
   mode and overlap mode to silently drop activity on renamed files
   that the main scoring correctly captured — the score and detail
   table wouldn't match.

2. State filter mismatch: The main query uses
   m.state IN ('opened','merged','closed') with a closed_mr_multiplier
   to downweight closed MRs. The detail and overlap queries used
   m.state IN ('opened','merged'), completely excluding closed MRs.
   This meant detail couldn't fully explain an expert's score.

Fix: Add OR clauses for old_path in all signal branches of both
queries, and include 'closed' in the state filter. The INDEXED BY
hints are removed from the auxiliary queries (they use OR across path
columns), which is acceptable since these run once per command.

Also imports build_path_query, normalize_repo_path, and PathQuery
from the new core::path_resolver module, removing the previously
duplicated private functions (~261 lines deleted).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 12:37:21 -05:00

89 KiB