sprint-67(media-cycle): weekly digest + storyline threads engine - #6
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 71c0eed7d0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| nextState.storylineThreads = advanceStorylineThreads(nextState, playedWeek); | ||
| nextState.storylineThreads = closeCompletedThreads(nextState); | ||
| nextState.storylineThreads = seedThreadsForWeek(nextState, playedWeek); |
There was a problem hiding this comment.
Skip seeding new storylines after season flips to playoffs
This call seeds fresh threads even when the same tick has already switched nextState.phase to 'playoffs' (the regular-season branch sets that at franchise-week.ts:874-876 before this block runs), so week-18 processing can close existing threads and then immediately create new active ones in postseason context. Because storyline progression/closure is only executed inside if (completedRegularSeasonWeek), those newly seeded playoff threads will then sit active through playoffs/offseason and carry stale narratives into later weeks.
Useful? React with 👍 / 👎.
Summary
packages/engine/src/media-cycle/module — deterministic weekly power rankings (0.40·strength + 0.30·win_pct + 0.20·momentum + 0.10·sov), category-prioritized headlines, hot takes, and digest assemblypackages/engine/src/storyline-threads/module — 5 archetypes (hot-seat-coach,qb-controversy,rookie-of-year-chase,records-chase,comeback-player) with pureseed / advance / closelifecyclefranchise-week.ts) archives digests + ranking snapshots and runs storyline orderadvance -> close -> seedmediaCycleandstorylineThreads+ refreshed v34 fixturepowerRankingscontract preserved via thin adapter over media-cycleReview gates (all green)
pnpm -r typecheck— engine + web cleanpnpm --filter @mfd/engine test— 1622 tests passing (+81)pnpm --filter @mfd/web test— 753 tests passing (unchanged)scripts/check-math-random.sh— no unauthorizedMath.random()scripts/check-bundle-size.sh— engine chunk 253 KB (ceiling 312 KB)scripts/smoke-full-season.sh— 3-season integration + save round-trip passContract notes for the web track
StorylineThreadincludes theheat: numberandnextBeatHint: string | nullfields the newsroom UI needs. Archetype keys are kebab-case (hot-seat-coachetc) and differ from the web track's temporary 8-archetype placeholder list — a follow-up web PR will swap the localapps/web/src/features/newsroom/types.tsforimport type { StorylineThread } from '@mfd/engine'and adapt the display maps.Test plan
🤖 Generated with Claude Code