Skip to content

Sync MFD marathon updates - #70

Open
KevinBigham wants to merge 5 commits into
mainfrom
agent/mfd-marathon-sync
Open

Sync MFD marathon updates#70
KevinBigham wants to merge 5 commits into
mainfrom
agent/mfd-marathon-sync

Conversation

@KevinBigham

Copy link
Copy Markdown
Owner

Summary

Publishes the accidental /goal marathon work from /Users/kevin/Documents/GitHub/MFD so 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 main commit (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 --check passed before commit.
  • Branch pushed to origin/agent/mfd-marathon-sync at ab5e48c0d61e3a6000097d0f5278fbd795ef52b6.
  • Mission ledger records the focused checks that passed and local Vitest/Vite/esbuild runner blockers encountered during the original marathon session.

@KevinBigham
KevinBigham marked this pull request as ready for review July 8, 2026 13:30

@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: 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;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

Comment on lines +1622 to +1624
const userTeam = Object.values(nextGame.teams).find((team) => team.isUser) ?? null;
if (userTeam) {
updateSystemFit(userTeam);

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 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);

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

@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: 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".

Comment on lines +879 to +880
disabled={isBusy}
onClick={() => void handleSimAhead(control.target, control.label)}

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 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);

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

@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: 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;

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

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