Session 32: Grades pipeline + NFL/NHL wiring + rate limiting + audit cleanup (1718 tests)

- gradeSlateService writes grades:{sport} cache (closes content pipeline →
  dataLevel full); fire-and-forget from oddsService.recordDownstream, gated
  by shouldGradeSlate (off in test, GRADE_SLATE_ON_FETCH override)
- NFL/NHL wired: oddsService SPORT_KEYS/SPORT_MARKETS (correct the-odds-api
  keys americanfootball_nfl/icehockey_nhl), proplineAdapter MARKETS, NHL
  MARKET_MAP keys to avoid silent-zero
- rate limiting mounted on 8 public cached routers (odds/parlay 30/min,
  rest 60/min)
- jsonlLogger writes to temp under test (no more dirtied tracked artifact);
  5MB pipeline test given 20s timeout

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Kev
2026-06-15 18:21:32 -04:00
parent 2ba3958c7a
commit f0c8b4f29b
20 changed files with 667 additions and 9 deletions
+5
View File
@@ -1,8 +1,13 @@
const express = require('express');
const { getOdds } = require('../services/oddsService');
const { MARKET_MAP, ALLOWED_BOOKS } = require('../utils/oddsNormalizer');
const { createRateLimit } = require('../middleware/rateLimit');
const router = express.Router();
// Session 32 — public throttle. /odds hits PropLine/odds-api upstream on a
// cache miss, so it gets the tighter 30/min bucket. Independent per-IP
// bucket scoped to this router (createRateLimit allocates its own Map).
router.use(createRateLimit({ windowMs: 60_000, max: 30 }));
const VALID_STAT_TYPES = new Set(Object.values(MARKET_MAP));
const VALID_BOOKS = ALLOWED_BOOKS;