Sync MFD marathon updates - #70
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: aa10369f85
ℹ️ 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".
| */ | ||
| export async function runAdvanceWeek(game: GameState, options?: AdvanceFranchiseWeekOptions): Promise<EngineOutput> { | ||
| const workerResult = postWorkerRequest<'advanceWeek'>({ kind: 'advanceWeek', game, options }); | ||
| if (workerResult) return workerResult; |
There was a problem hiding this comment.
Keep system-fit RNG on the seeded thread
When Worker construction succeeds, this returns before advanceFranchiseWeek runs in the main thread, but the store still calls updateSystemFit(userTeam) after runAdvanceWeek. That helper consumes the global RNG.dev; the worker’s setSeed/reseedWeek calls do not update the main-thread RNG, so system-fit growth now comes from a stale/default stream and can differ after a reload or between the worker and fallback paths for the same save. Move this RNG-driven update into the worker/engine result or reseed the main thread before calling it.
Useful? React with 👍 / 👎.
| const userTeam = Object.values(nextGame.teams).find((team) => team.isUser) ?? null; | ||
| if (userTeam) { | ||
| updateSystemFit(userTeam); |
There was a problem hiding this comment.
Apply system-fit ticks for every simmed week
When Sim Ahead advances multiple weeks, this post-processing runs updateSystemFit only once after the whole batch, while pressing Advance Week repeatedly applies it once per completed week. Using the 4 Weeks or End Regular Season controls therefore saves materially less system-fit growth for the user roster than the equivalent manual advances; apply the tick inside each simulated week or move it into the engine path that simulateWeeks loops over.
Useful? React with 👍 / 👎.
|
|
||
| const nextGame = result.nextState; | ||
| ensureGovernanceState(nextGame); | ||
| const deadlineInterrupted = isTradeDeadlineInterrupted(current, nextGame); |
There was a problem hiding this comment.
Route to the deadline after sim-ahead stops there
When the user starts Sim Ahead before the trade-deadline week and targets Trade Deadline, simulateWeeks stops with nextGame.tradeDeadlineState.isDeadlineWeek, but this check compares the final state to the original current week. Because the original week is not the deadline week, deadlineInterrupted is false, so the committed save remains on Week Advance instead of opening the trade-deadline workflow; key this branch off result.stopReason === 'trade_deadline' or the final state's deadline flag.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: da15ea7583
ℹ️ 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".
| disabled={isBusy} | ||
| onClick={() => void handleSimAhead(control.target, control.label)} |
There was a problem hiding this comment.
Gate sim-ahead behind the required game plan
When the current week has a user matchup and currentGamePlan is missing, this screen explicitly says weekly prep is required and the normal Advance button redirects to /game-plan, but the new Sim Ahead buttons remain enabled because they only check isBusy. Clicking 4 Weeks or End Regular Season from that state calls simAhead and simulates the current game(s), bypassing the required Game Plan workflow and producing results from an unprepared save; disable or redirect these controls when needsGamePlan is true.
Useful? React with 👍 / 👎.
| if (!current) return null; | ||
| clearUndo(); | ||
|
|
||
| const result = await runSimAhead(current, target, onProgress); |
There was a problem hiding this comment.
Preserve halftime decision pauses in sim-ahead
In regular-season/playoff weeks with halftime decisions enabled, advanceWeek first previews the user matchup and commits postGameUi.pendingHalftimeDecision instead of simulating, but this new path jumps straight into runSimAhead. Any Sim Ahead target can therefore resolve the current user game without presenting the configured halftime choice; add the same pending/preview guard before running the batch, or make the batch stop when a halftime decision would be staged.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 79efb2ab30
ℹ️ 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".
| const tier = player.injury?.severityTier; | ||
| if (tier !== 'severe' && tier !== 'season_ending') return false; | ||
| const previousInjury = previous.players[player.id]?.injury; | ||
| return previousInjury?.id !== player.injury?.id || previousInjury?.gamesOut !== player.injury?.gamesOut; |
There was a problem hiding this comment.
Stop treating existing injury recovery as a new injury
When a user player already has a severe or season-ending injury with more than one game remaining, advanceFranchiseWeek decrements gamesOut as part of normal recovery, so this comparison reports user_injury even though no new injury occurred. That makes every Sim Ahead batch stop after a single week until the known injury heals, preventing targets like 4 Weeks or End Regular Season from working for rosters that already have a major injury; compare injury ids only, or otherwise distinguish newly created injuries from recovery ticks.
Useful? React with 👍 / 👎.
Summary
Publishes the accidental
/goalmarathon work from/Users/kevin/Documents/GitHub/MFDso it is safely on GitHub.This branch includes the mission-ledger patch set for MFD Waves 0-10: save diet and migrations through v37, event-log retention, save reference rehydration, cartridge v2/size guard, worker sim boundary, Sim Ahead, newsroom MFSN sections, matchup radar, Chip memory callbacks, Save Health Meter, challenge seed sharing, adaptive transparency, and the future dynasty timeline archive ADR.
Notes
The accidental checkout was based on an older
maincommit (dc7740a), while the current repository main has moved forward. This PR is draft so it can be reviewed/rebased carefully without overwriting newer work.Verification
git diff --cached --checkpassed before commit.origin/agent/mfd-marathon-syncatab5e48c0d61e3a6000097d0f5278fbd795ef52b6.