Skip to content

sprint-67(media-cycle): weekly digest + storyline threads engine - #6

Merged
KevinBigham merged 1 commit into
mainfrom
codex/sprint-67-media-cycle
Apr 23, 2026
Merged

sprint-67(media-cycle): weekly digest + storyline threads engine#6
KevinBigham merged 1 commit into
mainfrom
codex/sprint-67-media-cycle

Conversation

@KevinBigham

Copy link
Copy Markdown
Owner

Summary

  • New 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 assembly
  • New packages/engine/src/storyline-threads/ module — 5 archetypes (hot-seat-coach, qb-controversy, rookie-of-year-chase, records-chase, comeback-player) with pure seed / advance / close lifecycle
  • Regular-season resolver (franchise-week.ts) archives digests + ranking snapshots and runs storyline order advance -> close -> seed
  • Save bump 34 -> 35 with inline migration defaults for mediaCycle and storylineThreads + refreshed v34 fixture
  • Legacy powerRankings contract preserved via thin adapter over media-cycle

Review gates (all green)

  • pnpm -r typecheck — engine + web clean
  • pnpm --filter @mfd/engine test1622 tests passing (+81)
  • pnpm --filter @mfd/web test — 753 tests passing (unchanged)
  • scripts/check-math-random.sh — no unauthorized Math.random()
  • scripts/check-bundle-size.sh — engine chunk 253 KB (ceiling 312 KB)
  • scripts/smoke-full-season.sh — 3-season integration + save round-trip pass
  • Determinism skill — no new hazards introduced
  • Save-migration skill — chain 1→34 continuous, v34→v35 well-formed

Contract notes for the web track

StorylineThread includes the heat: number and nextBeatHint: string | null fields the newsroom UI needs. Archetype keys are kebab-case (hot-seat-coach etc) and differ from the web track's temporary 8-archetype placeholder list — a follow-up web PR will swap the local apps/web/src/features/newsroom/types.ts for import type { StorylineThread } from '@mfd/engine' and adapt the display maps.

Test plan

  • Full gate green locally (see above)
  • CI green on push
  • No new save-load regressions on existing fixtures

🤖 Generated with Claude Code

@KevinBigham
KevinBigham merged commit 6690c69 into main Apr 23, 2026
2 checks passed
@KevinBigham
KevinBigham deleted the codex/sprint-67-media-cycle branch April 23, 2026 15:06

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +1160 to +1162
nextState.storylineThreads = advanceStorylineThreads(nextState, playedWeek);
nextState.storylineThreads = closeCompletedThreads(nextState);
nextState.storylineThreads = seedThreadsForWeek(nextState, playedWeek);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant