Patch 3.2: Counterfactual FA receipts - #69
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7c4f2d6520
ℹ️ 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".
| <div style={{ ...monoSm, color: 'var(--mfd-text-dim)' }}>No targets available.</div> | ||
| ) : targets.map((target) => { | ||
| const receipt = buildFATargetMarketReceipt(target); | ||
| const counterfactual = counterfactuals.get(target.player.id) ?? null; |
There was a problem hiding this comment.
Render lost-bid receipts before filtering live targets
When a FA round resolves and the user loses a target, resolveFreeAgencyRound marks the bids won/lost only for the player that signs, then removes that player from game.freeAgents. I checked selectFATargetBoard: if any stored target is no longer in game.freeAgents, it rebuilds from selectFreeAgentPlayers, so the signed loser is omitted before this targets.map lookup runs. As a result the new Target Board “Saved bid receipt / Why they won” UI is unreachable for the normal lost-target case; render those saved lost-bid receipts from the stored board/watchlist or a separate resolved section instead of only current target rows.
Useful? React with 👍 / 👎.
Summary
Adds Patch 3.2 Counterfactual FA Receipts as a pure web read-model/UI patch. Free Agency Hub saved bid-resolution rows now expose an expandable
Why they wonreceipt, and FA Target Board rows show compact saved-bid receipts when the user lost that target.The new
buildBidCounterfactualread-model explains saved outcomes only from persisted bid rows, winning-team amount, user bid comparison, saved cap/posture data, and the existingcomputeTeamWindowread-model. It fails closed tonullon sparse or older saves.Scope / Fences
GameState, save schema, migrations,SAVE_VERSION, sim math, RNG, dependencies, CI/deploy wiring, or engine source changes.Math.randomorDate.nowin touched logic.Verification
corepack pnpm --filter @mfd/web test -- src/lib/fa-counterfactuals.test.ts src/features/free-agency/FreeAgencyHub.test.tsx src/features/free-agency/FATargetBoard.test.tsx— 3 files / 20 tests passed.corepack pnpm -r --workspace-concurrency=1 typecheck— design-system, engine, and web passed.bash scripts/check-math-random.sh— passed.packages/engine/srcedits.Base Note
PR #68 is green but still open at the time this PR was created. This branch currently contains #68's docs commit plus the Patch 3.2 commit; once #68 merges, this PR should reduce to the Patch 3.2 diff only.