Thread book_role through the odds route grouping

The route regroups flat props into lines[] and was dropping the role tag,
so the widened feed reached the browser untagged. That is not cosmetic:
on a live prop, PrizePicks prices both sides at even money (+100/+100)
while BetMGM has +450/-750. Rendered side by side without a tag, the
pick'em row reads as a dramatically better price when it is a different
product entirely -- exactly the confusion the three-way split exists to
prevent. Consumers gate on book_role !== 'dfs' before treating a row as a
market price.

The ?book= filter now accepts any DISPLAY book, since shopping a real
book against an exchange is the point of the widening. Grading still only
ever consumes MODEL_BOOKS.

One superseded integration test updated to a stronger pair: an unknown
book still 400s, and a newly-visible one no longer does.

Gates: 4,028 tests / 322 suites green; next build exit 0.

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 00:55:04 -04:00
parent f0543b57a4
commit 68c5b65427
2 changed files with 26 additions and 3 deletions
+12 -1
View File
@@ -10,7 +10,11 @@ const router = express.Router();
router.use(createRateLimit({ windowMs: 60_000, max: 30 }));
const VALID_STAT_TYPES = new Set(Object.values(MARKET_MAP));
const VALID_BOOKS = ALLOWED_BOOKS;
// The `book` query filter accepts anything the surfaces may SHOW — the point of
// the widening is that a user can shop DraftKings against an exchange. Grading
// still only ever consumes MODEL_BOOKS (gradeSlateService.dedupeProps).
const { DISPLAY_BOOKS, roleOf } = require('../config/bookRoles');
const VALID_BOOKS = DISPLAY_BOOKS;
// NCAAB is in-season November through April
function isNcaabSeason() {
@@ -69,6 +73,13 @@ function groupProps(flatProps) {
}
grouped[key].lines.push({
book: prop.book,
// ORDER ZERO — carry the role through the grouping. This is NOT cosmetic:
// a DFS pick'em row prices both sides at even money (+100/+100) while a
// real book on the same prop might be +450/-750. Rendered untagged and
// side by side, the pick'em row reads as a far better price when it is a
// different product entirely. Consumers gate on `book_role !== 'dfs'`
// before treating a row as a market price.
book_role: prop.book_role || roleOf(prop.book),
line: prop.line,
over_odds: prop.over_odds,
under_odds: prop.under_odds,