Part 1 diagnostic: read-only refusal categoriser (25-cap + 72% refusal)

READ-ONLY. Runs the REAL grade path over a REAL slate and categorises
every refusal; writes nothing. Reproduces gradeSlateService.dedupeProps
exactly (MODEL_BOOKS, first-row-wins) and calls analyzeViaEngine1 the same
way, so it measures what the pipeline does rather than a re-implementation.

Adds a FIFTH bucket the order did not anticipate, and it is likely to
change how the 72% is read: (e) POLICY-SUPPRESSION. The 2026-07-19
betting-logic audit deliberately refuses rare-event 0.5 markets (doubles/
triples/HR/SB) on the juiced under, plus any over-juiced price -- and it
sets the SAME insufficient_data flag as a genuine data gap. Counting those
as a data problem would send us hunting for data that is not missing, and
"fixing" them would re-introduce bets we removed on purpose.

Separates (b) FETCHABLE-GAP from (d) GENUINE-ABSENCE by asking the stats
layer directly whether the player has ANY game log, rather than assuming:
no log -> genuine absence, keep refusing; a log that exists while the grade
path found no projection -> a wiring gap with something to fix.

Also measures per-grade latency (mean/median/p90/max, serial and at
concurrency) so Part 2 can decide the cap on cost rather than on taste.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QJs13VsyiSKYQP6rj3NNmc
This commit is contained in:
Kev
2026-08-01 02:02:53 -04:00
parent 6c97f59546
commit d18a19f6aa
2 changed files with 245 additions and 0 deletions
+24
View File
@@ -601,4 +601,28 @@ router.get('/ranking-delta', async (req, res) => {
}
});
/**
* GET /api/internal/diagnose-refusals (25-cap + 72% refusal, Part 1)
*
* READ-ONLY diagnosis: runs the real grade path over a real slate, categorises
* every refusal, and measures per-grade cost so we know what raising the cap
* would actually cost. Writes nothing.
*
* ?sport=mlb&sample=60&concurrency=5
*/
router.get('/diagnose-refusals', async (req, res) => {
try {
const { diagnose } = require('../services/refusalDiagnostics');
const out = await diagnose({
sport: req.query.sport || 'mlb',
sample: parseInt(req.query.sample, 10) || undefined,
concurrency: parseInt(req.query.concurrency, 10) || undefined,
});
res.set('Cache-Control', 'no-store');
return res.json({ ok: true, ...out });
} catch (err) {
return res.status(500).json({ ok: false, error: err && err.message });
}
});
module.exports = router;