Session 29: Content generation templates — slate threads, POTD, recaps, matchup previews (1660 tests)

This commit is contained in:
Kev
2026-06-13 21:30:57 -04:00
parent c48aecd510
commit 927c4a5c65
11 changed files with 1063 additions and 1 deletions
+56
View File
@@ -4,6 +4,62 @@
2026-06-12
## Current Phase
SHIP BUILD v29.0 — Content generation templates: structured social/newsletter content from live data (Session 29)
## Session 29 (2026-06-13) — SHIPPED
The data engine that produces raw material for daily social content. Each
template consumes live VYNDR data and returns STRUCTURED OBJECTS (not text,
not images) that degrade gracefully by data level. A formatter renders
plain text; the image/design layer comes later.
Backend 1623 → **1660 tests** (+37), 133 suites, zero regressions. Web
build clean.
### PHASE 1-3 — Template engine + slate thread + POTD
- `contentTemplateService.js`:
- `collectSlateData(sport, deps?)` — gathers schedule + game lines +
grades + streaks + movers + best lines via Promise.allSettled,
INJECTABLE collectors (default wires the real services). Sets
`dataLevel`: full / lines / schedule / empty.
- `generateSlateThread` — hook + content posts + CTA. Full → top-5
graded picks; lines → game-line highlights (best ML, consensus
total/spread, book disagreement) + movers; schedule → game list.
- `generatePOTD` — best grade (full) or game-of-the-day (lines) or
`{ available: false }`.
- Field-alias normalizers so grades from any shape (player/player_name,
side/direction, edge/edge_pct) work.
### PHASE 4-5 — Recap + matchup preview
- `generateResultsRecap(sport, resolvedGrades)` — record, win rate, top
hits, biggest miss, by-tier (A/B/C), Brier score + avg CLV. Pure.
- `generateMatchupPreview(game, gameLines, streaks)` — teams, lines
summary (consensus spread/total, home-favorite), streaks matched to the
two teams, one-line narrative. Degrades to `lines: null`.
### PHASE 6 — Content API
- `GET /api/content/{slate,potd,recap,preview}/:sport` (preview takes
`/:gameId`). `?format=text` adds post-ready strings. Mounted in app.js;
Next proxy `api/content/[...path]/route.ts`.
### PHASE 7 — Formatter
- `contentFormatter.js` — slate thread → array of plain-text posts (one
per role), POTD + recap text blocks. Defensive: never emits "undefined".
### Files created
- `src/services/contentTemplateService.js`, `src/services/contentFormatter.js`
- `src/routes/content.js`
- `web/src/app/api/content/[...path]/route.ts`
- `tests/unit/contentTemplateService.test.js` (22),
`tests/unit/contentFormatter.test.js` (7),
`tests/integration/contentRoutes.test.js` (8)
### Files modified
- `src/app.js` (mount /api/content)
---
## Previous Phase
SHIP BUILD v28.0 — Parlay builder, line-movement tracking, book comparison (Session 28)
## Session 28 (2026-06-13) — SHIPPED