Skip to content

Patch 3.2: Counterfactual FA receipts - #69

Open
KevinBigham wants to merge 2 commits into
mainfrom
goat/patch-3.2-fa-counterfactuals
Open

Patch 3.2: Counterfactual FA receipts#69
KevinBigham wants to merge 2 commits into
mainfrom
goat/patch-3.2-fa-counterfactuals

Conversation

@KevinBigham

Copy link
Copy Markdown
Owner

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 won receipt, and FA Target Board rows show compact saved-bid receipts when the user lost that target.

The new buildBidCounterfactual read-model explains saved outcomes only from persisted bid rows, winning-team amount, user bid comparison, saved cap/posture data, and the existing computeTeamWindow read-model. It fails closed to null on sparse or older saves.

Scope / Fences

  • No CPU bidding behavior or market resolution changes.
  • No GameState, save schema, migrations, SAVE_VERSION, sim math, RNG, dependencies, CI/deploy wiring, or engine source changes.
  • No Math.random or Date.now in 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.
  • Confirmed zero packages/engine/src edits.

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.

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

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

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