Review follow-ups: PR #531 — feat(import): TypeSafe Jev re-ranks ambiguous import rows (flag-gated, off by default) #778
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Non-blocking findings from the auto code review of PR #531 (feat(import): TypeSafe Jev re-ranks ambiguous import rows (flag-gated, off by default)) — captured for batch cleanup rather than blocking the PR.
Commit
104dd93· https://github.com/Gambit-Inc/gambit/pull/531SHOULD-FIX:
backend/app/services/import_match.py:722(and the promotion at:731-732) — For a row whose status is already"confirm"(e.g.cert+price,graded-price-confirm,widened-set,price-confirm), the low-confidence guard (conf < rank_floor and order[0].justtcg_id not in ladder_ids) only blocks picks that fall outside the ladder's own pool. A low-confidence Jev pick that happens to land inside the ladder pool is not blocked at all:match.candidates = order[:6]andmatch.chosen = order[0]execute unconditionally oncematch.status == "confirm"is already true, regardless ofconf. This lets an unmeasured, low-confidence Jev guess (e.g. conf=0.1) silently displace the price-ranked pre-selection — the thing the module's own docstring calls "the load-bearing rule" (price ranks; it never decides) — as the candidate shown first to the human reviewer. No test exercises this path (JevRanks/JevAutoIsGatedonly cover the manual→confirm promotion case and the outside-pool low-confidence case); astatus=="confirm"row at low confidence with an in-pool pick is untested.backend/app/services/import_match.py:789-799— the(game, title)widen cache is populated (an actualsearch_localDB call inside a SAVEPOINT) whenever a title is seen for the first time in the chunk, even for a cert-numbered row whose ownwideresult is unconditionally discarded two lines later (if rec.get("cert_number"): wide = []). If a batch happens to have several distinct titles whose first occurrence inrowsis a cert row, this burns real time against the sharedwiden_until/deadlinebudget for a result nobody uses, which can push thetime.monotonic() >= widen_untilcheck tobreakbefore later, genuinely eligible non-cert rows are even considered — a silent reduction in Jev coverage for that chunk with no signal surfaced.NITS:
backend/app/config.py:474-475—import_jev_timeout_seconds(default 5) is unchecked againstimport_jev_budget_seconds(default 15). If someone ever configurestimeout_seconds >= budget_seconds,widen_until = deadline - timeout_secondsin_jev_rerank(import_match.py:781) comes out ≤ "now", so the very first iteration'stime.monotonic() >= widen_untilis already true and the loop breaks before asking anything — Jev silently never fires for that run, with no warning that the config is self-defeating.Filed from a Claude Code session