← Back to Pull requests

feat(api): restore the explainer proxy NBA's site needs #9

Merged
Kevocado merged 5 files (1291 lines) on Sep 29, 2026 04:47 UTC
View on GitHub
Kevocado Kevocado commented on Sep 28, 2026 01:31 UTC
Author

What and why

NBA's /api/explain proxy was deleted on the strength of a refusal that was never checked. The reasoning: the shared explainer 404s for nba, so a proxy "had exactly one possible outcome: a 502 on every game detail". True — and it follows from a premise verified for F1 and assumed for NBA.

NBA serves now. The refusal was a product decision about F1 (a win probability is the explanation there), and NBA's /facts carries the same moneyline/spread/total the panel draws.

Without this proxy the ask is only half delivered: Caddy reverse-proxies this app and nothing else, so the browser has no route to the explainer.

Depends on the explainer's SERVED_SPORTS change (predictor-hub serve-nba branch). The two must land together or NBA's panel shows its retry state.

Not in this change

The frontend panel. ExplainerPanel.tsx is vendored in NBA but unwired, and the v2 components it needs are still on predictor-hub#13. Separate work, not a gap here.

Testing

tests/test_no_explain_proxy.py asserted an absence, so it could only confirm nothing had been added. Replaced with tests/test_explain_proxy.py (34 tests) asserting what a live proxy must have.

Three of those assertions were vacuous on first write and were caught by mutation, not by reading:

| Guard | Why the first test missed it |
|---|---|
| no upstream body echoed | fake raised HTTPError with no .response, so exc.response.text had nothing to leak |
| non-2xx → 502 | fake raised instead of returning, so the proxy's own status check never ran |
| quote() on sport | only reachable end-to-end for explainer_id; sport tested by calling the route directly |

Plus timeout=/allow_redirects reach requests.get (per-call args, so the module constants prove nothing), and OpenAPI rather than app.routes for the route table.

Mutation check

tools/mutcheck_explain_proxy.py — 9 guards, 9 bites, with a canary that must stay silent so a misreporting harness can't look like a passing suite.

uv run python tools/mutcheck_explain_proxy.py

Note for a follow-up

except ValueError is removed here as unreachable (JSONDecodeError subclasses RequestException; verified against requests 2.34.2). PL's proxy has the same dead branch — left alone to keep this one sport's change.

377 passed, 17 skipped.

Diff: 1291 lines (+1139 / -152) across 5 files Reviewer: copilot-pull-request-reviewer[bot] Review duration: 1635m
All Vouch review confidence checks passed
Residual risk 0.24 = Change Risk (0.49) × (1 − Review Confidence (0.50)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.49 · 1291 lines diff across 5 files
0.49
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
0.02
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
50%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.400
Shallow Review Depth shallow_review_depth
0.344
Real PR Conversation Timeline
2 items
copilot-pull-request-reviewer[bot] copilot-pull-request-reviewer[bot] commented on Sep 28, 2026 01:31 UTC
Reviewer

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Assignees
Kevocado Kevocado
Labels
risk: low confidence: 50.4% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 48.9% (MEDIUM) · Higher = larger blast radius
48.9%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 50.4% · Lower = rushed or shallow review
50.4%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 24.2% · Safe to merge
24.2%