From 8516b055c684beb93f9bad1f81e21eff82246cc2 Mon Sep 17 00:00:00 2001 From: KevinBigham Date: Tue, 5 May 2026 17:52:29 -0500 Subject: [PATCH 01/11] Checkpoint Chip public-release hardening Preserves the recovered onboarding, guidance, route-coaching, mobile hardening, and release metadata work before the release-candidate lock-in pass continues. Save schema, engine behavior, and deploy surfaces remain untouched. --- .codex/MFD/chip-onboarding-goal.md | 260 +++++++++++++ .../MFD/public-release-chip-recovery-goal.md | 264 ++++++++++++++ .codex/MFD/public-release-readiness-matrix.md | 85 +++++ apps/web/index.html | 7 +- apps/web/src/app/App.test.tsx | 2 +- apps/web/src/app/App.tsx | 21 +- apps/web/src/app/indexDocument.test.ts | 20 + apps/web/src/app/store/selectors.test.ts | 45 +++ apps/web/src/app/store/selectors.ts | 4 +- apps/web/src/features/companion/ChipDock.css | 51 ++- .../src/features/companion/ChipDock.test.tsx | 82 ++++- apps/web/src/features/companion/ChipDock.tsx | 40 +- .../src/features/companion/chipShare.test.ts | 63 ++++ apps/web/src/features/companion/chipShare.ts | 87 +++++ .../src/features/companion/chipVoice.test.ts | 67 ++++ apps/web/src/features/companion/chipVoice.ts | 102 ++++++ .../features/companion/decisionImpact.test.ts | 43 +++ .../src/features/companion/decisionImpact.ts | 136 +++++++ .../features/companion/eventBridge.test.ts | 4 + .../web/src/features/companion/eventBridge.ts | 9 + .../companion/featureVisibilityMatrix.ts | 345 ++++++++++++++++++ .../companion/onboardingMachine.test.ts | 76 ++++ .../features/companion/onboardingMachine.ts | 183 ++++++++++ .../src/features/companion/readReceipts.ts | 17 + .../src/features/companion/useChipEvents.ts | 53 ++- .../features/companion/weeklyGuidance.test.ts | 44 +++ .../src/features/companion/weeklyGuidance.ts | 109 ++++++ .../features/contracts/CapLaboratory.test.tsx | 6 + .../src/features/contracts/CapLaboratory.tsx | 18 +- .../features/depth-chart/DepthChart.test.tsx | 7 + .../src/features/depth-chart/DepthChart.tsx | 140 +++---- .../src/features/game-plan/GamePlanSetup.tsx | 226 ++++++------ .../monday-briefing/MondayBriefing.tsx | 74 ++-- .../route-coaching/routeBeatRegistry.test.ts | 16 +- .../route-coaching/routeBeatRegistry.ts | 60 +++ .../route-coaching/spotlightAnchors.test.ts | 4 + .../useActiveRouteBeats.test.ts | 12 + .../route-coaching/useActiveRouteBeats.ts | 25 +- apps/web/src/features/trades/TradeCenter.tsx | 17 +- .../week-advance/WeekAdvance.test.tsx | 3 + .../src/features/week-advance/WeekAdvance.tsx | 74 ++-- .../src/lib/roster-continuity-store.test.ts | 9 + apps/web/src/lib/roster-continuity-store.ts | 11 +- .../PixelSelect/PixelSelect.test.tsx | 19 + .../components/PixelSelect/PixelSelect.tsx | 2 +- packages/design-system/tokens/index.css | 2 + packages/design-system/tokens/index.test.ts | 14 + 47 files changed, 2694 insertions(+), 264 deletions(-) create mode 100644 .codex/MFD/chip-onboarding-goal.md create mode 100644 .codex/MFD/public-release-chip-recovery-goal.md create mode 100644 .codex/MFD/public-release-readiness-matrix.md create mode 100644 apps/web/src/app/indexDocument.test.ts create mode 100644 apps/web/src/app/store/selectors.test.ts create mode 100644 apps/web/src/features/companion/chipShare.test.ts create mode 100644 apps/web/src/features/companion/chipShare.ts create mode 100644 apps/web/src/features/companion/chipVoice.test.ts create mode 100644 apps/web/src/features/companion/chipVoice.ts create mode 100644 apps/web/src/features/companion/decisionImpact.test.ts create mode 100644 apps/web/src/features/companion/decisionImpact.ts create mode 100644 apps/web/src/features/companion/featureVisibilityMatrix.ts create mode 100644 apps/web/src/features/companion/onboardingMachine.test.ts create mode 100644 apps/web/src/features/companion/onboardingMachine.ts create mode 100644 apps/web/src/features/companion/weeklyGuidance.test.ts create mode 100644 apps/web/src/features/companion/weeklyGuidance.ts create mode 100644 packages/design-system/components/PixelSelect/PixelSelect.test.tsx create mode 100644 packages/design-system/tokens/index.test.ts diff --git a/.codex/MFD/chip-onboarding-goal.md b/.codex/MFD/chip-onboarding-goal.md new file mode 100644 index 00000000..54456ba5 --- /dev/null +++ b/.codex/MFD/chip-onboarding-goal.md @@ -0,0 +1,260 @@ +# MFD Chip Onboarding Goal Checkpoint + +Date: 2026-05-05 +Repo: `/Users/tkevinbigham/Documents/GitHub/MFD` +Branch: `main` +Baseline: `dc7740a Sprint 46: Polish standings signals (#54)` + +## Active Goal Summary + +Perfect the Chip-guided onboarding and weekly guidance loop so Chip becomes the main player-facing guide layer for Mr. Football Dynasty. The work must improve first-time orientation, weekly next-action guidance, decision-impact clarity, replay/reset/snooze controls, and safe TTS/share scaffolding behind feature flags. + +## Resume 2026-05-05 09:45:09 CDT + +Current objective: finish Slice 9 honestly by verifying the current Chip implementation, diagnosing local blockers, fixing P0/P1 issues found in the continuation, and completing the first-3-week onboarding audit against actual runtime behavior. + +Verification plan: + +1. Reconfirm repo rules, package scripts, current branch, and safe git state without destructive git operations. +2. Diagnose the `git status` / `git diff` hang using time-boxed read-only commands. +3. Inspect Chip onboarding, weekly guidance, decision-impact, dock controls, TTS, share, route coaching, feature flags, and mount paths. +4. Reproduce the hanging targeted tests one file at a time with explicit timeouts and verbose output. +5. Diagnose typecheck hangs with repo-standard and targeted package commands before attempting fixes. +6. Start the app with Chip enabled and complete browser/manual or equivalent runtime verification; document exact blocker if browser tooling fails. +7. Update this checkpoint with commands, results, blocker root causes, and remaining P0/P1/P2 issues. + +Blocker diagnosis: + +- `git status` / `git diff`: reproduced. `git rev-parse --show-toplevel`, branch, and inside-work-tree checks return immediately, and no `.git/index.lock` exists. Both `git -c core.fsmonitor=false status --short --untracked-files=no` and `git -c core.fsmonitor=false diff --stat` time out after 30s. Follow-up read-only checks show `.git/objects/pack/pack-7e55b47cf628dd9df812d78dfb6410f37d6f870f.pack` repeatedly errors as `far too short to be a packfile`, and `git diff --cached --stat --no-ext-diff --no-renames` exits 128 with `fatal: unable to read 39cbc7bc99415d388a173e44d4cad585f3519bf9`. No `.git` repair has been attempted. +- `dockControls.test.ts`: blocked before file-specific execution. Direct Vitest bootstrap via bundled Node (`node .../vitest/vitest.mjs run ...`) produced no runner output after 180s and sat at 0% CPU inside Node dependency loading; killed only that spawned process. +- TSX/component suites: root cause is at least partly filesystem/local install level. `apps/web/src/features/week-advance/WeekAdvance.tsx` was a regular 14 KB file by `stat`, but `sed`, `wc`, and `dd` all blocked trying to read the working-tree inode. The unreadable inode was moved to `.codex/MFD/evidence/WeekAdvance.tsx.unreadable-20260505-1008`, the source was recreated from `git show HEAD:...`, and the Chip decision-impact panel was reapplied. `WeekAdvance.test.tsx` is now readable and still expects the panel copy. +- `tsc --noEmit`: still blocked after WeekAdvance repair. Direct bundled Node command `node .../typescript/lib/tsc.js --noEmit --project apps/web/tsconfig.json --pretty false` produced no diagnostics after 180s; `ps` showed 0% CPU and `lsof` showed Node blocked while reading dependency declarations such as `vite/types/hmrPayload.d.ts`. +- Browser/manual playthrough: fresh Vite build/dev is blocked before startup. Existing stale `apps/web/dist` can be served only by stripping the `/MFD` base path; the stale build loads with no console errors but has Chip disabled and cannot count as current Chip verification. + +Commands run during resume: + +- `pwd`: `/Users/tkevinbigham/Documents/GitHub/MFD`. +- `git rev-parse --show-toplevel`: `/Users/tkevinbigham/Documents/GitHub/MFD`. +- `git branch --show-current`: `main`. +- `git rev-parse --is-inside-work-tree`: `true`. +- `ls -la .git/index.lock 2>/dev/null || true`: no lock file output. +- `git -c core.fsmonitor=false status --short --untracked-files=no`: timeout after 30s. +- `git -c core.fsmonitor=false diff --stat`: timeout after 30s. +- `git config --show-origin --get-regexp 'core.fsmonitor|core.untrackedCache|diff.external|filter|lfs'`: only LFS filter config found. +- `ls -lh .git/index`: 133K. +- `git count-objects -vH`: one pack, reported 89.05 MiB. +- `git -c core.fsmonitor=false -c core.untrackedCache=false status --porcelain=v1 --untracked-files=no --no-renames`: timeout after 20s. +- `git -c core.fsmonitor=false -c core.untrackedCache=false diff --name-only --no-ext-diff --no-renames`: timeout after 20s with repeated corrupt-pack errors. +- `git diff --cached --stat --no-ext-diff --no-renames`: exit 128 after corrupt-pack errors. +- `git ls-files -m`: timeout after 20s. +- `git show HEAD:apps/web/src/features/week-advance/WeekAdvance.tsx`: succeeds in subprocess capture and was used only to recover the unreadable working-tree file. +- `dd if=apps/web/src/features/week-advance/WeekAdvance.tsx of=/dev/null bs=1048576`: blocked before file recovery. +- `wc -l apps/web/src/features/week-advance/WeekAdvance.tsx`: after recovery, succeeds with 352 lines. +- `git diff -- apps/web/src/features/week-advance/WeekAdvance.tsx .codex/MFD/chip-onboarding-goal.md --stat`: targeted diff succeeds and shows the WeekAdvance decision-impact patch; full diff still blocks. +- `git fsck --no-progress`: timeout after 30s. +- `node .../vitest/vitest.mjs run src/features/week-advance/WeekAdvance.test.tsx --reporter=verbose --pool=forks`: no runner output after 180s; process sampled at 0% CPU while loading Node dependencies. +- `node .../typescript/lib/tsc.js --noEmit --project apps/web/tsconfig.json --pretty false`: no diagnostics after 180s; process sampled at 0% CPU while reading dependency declarations. +- `node .../vite/bin/vite.js build --mode production`: produced no output and exited/killed with code -1 before Vite startup output in this desktop shell. +- Static stale preview: `python3` server mapping `/MFD/` to `apps/web/dist` plus in-app browser loaded the old build with no console errors, but Chip was not enabled in that build. + +## Preflight Repo State + +- `git status --short`: clean at start. +- `git branch --show-current`: `main`. +- `git log -1 --oneline`: `dc7740a Sprint 46: Polish standings signals (#54)`. +- Repo rules: no checked-in `AGENTS.md` or `CLAUDE.md` found in this checkout; applying Kevin's supplied AGENTS instructions from the prompt. +- Existing `.codex/MFD`: `sprint71-resume-audit.md` only. +- `pnpm --version`: unavailable (`pnpm: command not found`). +- `node_modules`: missing. +- Fallback expected for test commands: `npx --yes pnpm@9.15.9 ...`. +- Save schema baseline: `packages/engine/src/config/difficulty.ts` exports `SAVE_VERSION = 35`. +- Initial dirty files: none. + +## Existing Chip / Guidance Audit + +### Components and Stores + +- `packages/design-system/components/Chip/`: Chip SVG primitive, poses, dialogue bubble, reduced-motion behavior. +- `apps/web/src/features/companion/ChipHost.tsx`: setup/onboarding overlay, `VITE_CHIP_ENABLED` gate, legacy localStorage skip key `mfd.chip.onboarding`. +- `apps/web/src/features/companion/ChipDock.tsx`: persistent post-setup dock, controls, route beat/live beat rendering, quiet controls, `What now?`, `Where am I?`, pending decision badge. +- `apps/web/src/features/companion/store.ts`: Zustand Chip state, pose priority windows, dialogue fields, read receipts, basic `advance/dismiss/reset`. +- `apps/web/src/features/companion/dockPersistence.ts`: local dock preferences at `mfd.chip.local`. +- `apps/web/src/features/companion/readReceipts.ts`: additive web-only read receipts at `mfd.chip.read.v1`. +- `apps/web/src/features/companion/useChipEvents.ts` and `eventBridge.ts`: week rollover Chip events, weekly dialogue selection, pose reactions, quiet and spam guards. +- `apps/web/src/features/route-coaching/routeBeatRegistry.ts`: route coaching beats for roster, staff, cap lab, draft, trade center, scouting. +- `apps/web/src/features/route-coaching/useActiveRouteBeats.ts`: resolves route beat eligibility using store receipts. + +### Dialogue and Onboarding + +- `apps/web/src/features/companion/dialogue/onboarding.ts`: 9 setup beats oriented around franchise setup. Current copy is stronger for setup identity than post-setup weekly play. +- `apps/web/src/features/companion/dialogue/weekly.ts`: short deterministic weekly dialogue variants by outcome. +- `apps/web/src/features/monday-briefing/MondayBriefing.tsx`: existing Chip commentary around briefing. +- `apps/web/src/features/onboarding/TutorialOverlay.tsx` and `packages/engine/src/systems/tutorial.ts`: older generic tutorial/help surfaces. + +### Decision and Weekly Surfaces + +- `apps/web/src/features/week-advance/WeekAdvance.tsx`: readiness checklist, matchup radar, stakes panel, advance button. +- `apps/web/src/features/contracts/ContractsCap.tsx`: contract detail modal with consequence list for cuts. +- `apps/web/src/features/contracts/CapLaboratory.tsx`: cap sandbox, queued moves, projection, consequence list. +- `apps/web/src/features/trades/TradeCenter.tsx`: incoming/proposal trade workflow with value comparison and confirmation. +- `apps/web/src/features/depth-chart/DepthChart.tsx` and `apps/web/src/features/game-plan/GamePlanSetup.tsx`: high-priority route targets for first-ten-minute guidance. + +### Feature Flags and Persistence + +- Existing Chip gate: `VITE_CHIP_ENABLED === 'true'`. +- No TTS scaffold found. +- Existing share/export helpers exist for season recap and scrapbook via `apps/web/src/features/season/recap-share.ts`, but no Chip share-event scaffold found. +- Chip persistence is browser-local only and does not touch dynasty save schema. + +### Existing Tests + +- Companion: `ChipHost.test.tsx`, `ChipDock.test.tsx`, `store.test.ts`, `eventBridge.test.ts`, `useChipEvents.test.ts`, `readReceipts.test.ts`, route coaching tests. +- Weekly dialogue determinism: `dialogue/weekly.test.ts`. +- Onboarding dialogue validation: `dialogue/onboarding.test.ts`. +- Week advance, contracts, cap lab, trades each have focused component tests. + +## Current Journey vs Target Journey + +Current: +- Setup Chip is present and visually strong, but it is mostly a setup companion. +- Post-setup Chip gives short weekly outcome remarks and route coaching on a few routes. +- `What now?` replays the last weekly line instead of producing a ranked next action. +- Decision impact exists in isolated UI pieces, but there is no common immediate/season/future/risk language. +- Skip/read receipts suppress repetition, but there is no formal onboarding progress state machine or clear reset/replay/snooze workflow. +- TTS and share-card scaffolding are absent. + +Target: +- Chip has explicit onboarding progress, beat IDs, route/context gates, idempotent trigger handling, resume, reset, replay, and snooze. +- First-time players get a concise first-10-minute arc: chair framing, weekly loop, briefing, roster/depth, game plan, advance, post-advance debrief, decision impact, and advanced-system map. +- After week advance, Chip explains what changed, why it matters, top next actions, risks, feature links, and confidence. +- Major decision surfaces share concise impact explainers: immediate, this season, future, risk/uncertainty, and difficulty/severity where available. +- Player can replay/reset onboarding, snooze Chip temporarily, and ask what to do now without being trapped. +- TTS/share scaffolds are feature-flagged and default safe. + +## Slice Checklist + +- [x] Slice 1: Preflight safety check, repo rule scan, current Chip audit. +- [x] Slice 1: Create checkpoint file. +- [x] Slice 2: Formal Chip onboarding state machine and tests. +- [x] Slice 3: First-10-minute arc copy/context upgrades and tests. +- [x] Slice 4: Deterministic weekly guidance ranking and tests. +- [x] Slice 5: Decision impact explainers on highest-impact surfaces and tests. +- [x] Slice 6: Replay/reset/snooze/re-enable controls and tests. +- [x] Slice 7: TTS scaffold behind `VITE_CHIP_TTS_ENABLED` and tests. +- [x] Slice 8: Share scaffold behind `VITE_MFD_SHARE_ENABLED` and tests. +- [ ] Slice 9: QA, targeted/full verification, manual playthrough, final completion audit. + +## Files Touched Per Slice + +- Slice 1: + - `.codex/MFD/chip-onboarding-goal.md` +- Slice 2: + - `apps/web/src/features/companion/onboardingMachine.ts` + - `apps/web/src/features/companion/onboardingMachine.test.ts` +- Slice 3: + - `apps/web/src/features/companion/dialogue/onboarding.ts` + - `apps/web/src/features/companion/dialogue/onboarding.test.ts` + - `apps/web/src/features/route-coaching/routeBeatRegistry.ts` + - `apps/web/src/features/route-coaching/routeBeatRegistry.test.ts` + - `apps/web/src/features/route-coaching/useActiveRouteBeats.ts` + - `apps/web/src/features/route-coaching/useActiveRouteBeats.test.ts` + - `apps/web/src/features/companion/featureVisibilityMatrix.ts` + - `apps/web/src/features/companion/featureVisibilityMatrix.test.ts` +- Slice 4: + - `apps/web/src/features/companion/weeklyGuidance.ts` + - `apps/web/src/features/companion/weeklyGuidance.test.ts` + - `apps/web/src/features/companion/eventBridge.ts` + - `apps/web/src/features/companion/eventBridge.test.ts` + - `apps/web/src/features/companion/useChipEvents.ts` + - `apps/web/src/features/companion/useChipEvents.test.ts` +- Slice 5: + - `apps/web/src/features/companion/decisionImpact.ts` + - `apps/web/src/features/companion/decisionImpact.test.ts` + - `apps/web/src/features/week-advance/WeekAdvance.tsx` + - `apps/web/src/features/week-advance/WeekAdvance.test.tsx` + - `apps/web/src/features/contracts/CapLaboratory.tsx` + - `apps/web/src/features/contracts/CapLaboratory.test.tsx` + - `apps/web/src/features/trades/TradeCenter.tsx` + - `apps/web/src/features/trades/TradeCenter.test.tsx` +- Slice 6: + - `apps/web/src/features/companion/dockControls.ts` + - `apps/web/src/features/companion/dockControls.test.ts` + - `apps/web/src/features/companion/ChipDock.tsx` + - `apps/web/src/features/companion/ChipDock.test.tsx` +- Slice 7: + - `apps/web/src/features/companion/chipVoice.ts` + - `apps/web/src/features/companion/chipVoice.test.ts` +- Slice 8: + - `apps/web/src/features/companion/chipShare.ts` + - `apps/web/src/features/companion/chipShare.test.ts` + +## Tests Run Per Slice + +- Slice 1: + - Not applicable; audit/checkpoint only. +- Slice 2: + - `npx --yes pnpm@9.15.9 --filter @mfd/web exec vitest run src/features/companion/onboardingMachine.test.ts` + - Result: PASS, 4 tests. +- Slice 3: + - `npx --yes pnpm@9.15.9 --filter @mfd/web exec vitest run src/features/route-coaching/routeBeatRegistry.test.ts src/features/route-coaching/useActiveRouteBeats.test.ts` + - Result: PASS, 18 tests. + - `npx --yes pnpm@9.15.9 --filter @mfd/web exec vitest run src/features/companion/dialogue/onboarding.test.ts` + - Result: PASS, 8 tests. +- Slice 4: + - `npx --yes pnpm@9.15.9 --filter @mfd/web exec vitest run src/features/companion/weeklyGuidance.test.ts` + - Result: PASS, 4 tests. + - `npx --yes pnpm@9.15.9 --filter @mfd/web exec vitest run src/features/companion/useChipEvents.test.ts src/features/companion/eventBridge.test.ts` + - Result: PASS, 24 tests. +- Slice 5: + - `npx --yes pnpm@9.15.9 --filter @mfd/web exec vitest run src/features/companion/decisionImpact.test.ts` + - Result: PASS, 3 tests. + - `npx --yes pnpm@9.15.9 --filter @mfd/web exec vitest run src/features/week-advance/WeekAdvance.test.tsx src/features/contracts/CapLaboratory.test.tsx src/features/trades/TradeCenter.test.tsx` + - Result: BLOCKED/HUNG locally before output; killed only the spawned Vitest worker/npm process after no runner output. +- Slice 6: + - `npx --yes pnpm@9.15.9 --filter @mfd/web exec vitest run src/features/companion/ChipDock.test.tsx` + - Result: BLOCKED/HUNG locally before output; killed only the spawned Vitest worker/npm process after no runner output. + - `npx --yes pnpm@9.15.9 --filter @mfd/web exec vitest run src/features/companion/dockControls.test.ts` + - Result: BLOCKED locally. After removing a TSX import from the control reducer, this isolated suite still exits/hangs without diagnostics in this shell. Production build covers the module syntactically, but this test file has not produced a clean pass locally. +- Slice 7: + - `./node_modules/.bin/vitest run src/features/companion/dockControls.test.ts src/features/companion/chipVoice.test.ts src/features/companion/chipShare.test.ts src/features/companion/featureVisibilityMatrix.test.ts --reporter=verbose` + - Partial result before manual stop: `chipVoice.test.ts` PASS, 4 tests. Combined command then stalled on `dockControls.test.ts`. +- Slice 8: + - `./node_modules/.bin/vitest run src/features/companion/dockControls.test.ts src/features/companion/chipVoice.test.ts src/features/companion/chipShare.test.ts src/features/companion/featureVisibilityMatrix.test.ts --reporter=verbose` + - Partial result before manual stop: `chipShare.test.ts` PASS, 4 tests; `featureVisibilityMatrix.test.ts` PASS, 4 tests. Combined command then stalled on `dockControls.test.ts`. +- Slice 9: + - `./node_modules/.bin/vite build --mode production` + - Result: PASS. Built 2,511 modules and completed in 11m 22s; existing large-chunk warning remains. + - `./node_modules/.bin/tsc --noEmit --project tsconfig.json --pretty false` + - Result: BLOCKED/HUNG locally; no diagnostics after >150s, killed only that MFD `tsc` process. + - Dev server smoke: `VITE_CHIP_ENABLED=true ./node_modules/.bin/vite --host 127.0.0.1 --port 5173` + - Result: server reached ready state at `http://127.0.0.1:5173/MFD/`, but browser tooling blocked. Playwright connector returned `Transport closed`; Playwright CLI wrapper stalled under `npm exec`; HTTP `curl` requests hung while Vite repeatedly restarted on watched config/package files. Manual browser playthrough not completed. + +## Feature Visibility Matrix + +Implemented as `apps/web/src/features/companion/featureVisibilityMatrix.ts`. + +- First-ten-minute features: Monday Briefing, Roster, Depth Chart, Game Plan, Week Advance. +- Weekly/post-result features: Inbox, Schedule, Standings, League Pulse, Film Room, Team Needs. +- Pressure-window features: Injuries, Contracts, Cap Lab, Trades, Waivers, Practice Squad. +- Offseason/draft features: Scouting, Draft, Free Agency. +- Deep-dive/legacy features: Coaching, Power Rankings, Analytics, Record Book, Settings/Save Load. + +The matrix records route/entry point, purpose, why it matters, best introduction moment, first-time action, advanced note, and verification status. + +## Completion Audit Status + +- Product audit: partially passing by code inspection and build. First-10-minute arc, weekly loop, route coaching expansion, decision-impact model, replay/reset/re-enable controls, feature matrix, TTS scaffold, and share scaffold are implemented. Browser/manual confirmation is blocked. +- Engineering audit: partially passing. State machine, idempotent progress, browser-local persistence, reset/replay/snooze controls, weekly guidance tests, decision-impact pure tests, safe flags, and production build are present. `dockControls.test.ts`, TSX component tests, typecheck, git status/diff, and browser manual pass remain blocked locally. +- Commands/evidence audit: build passed; many targeted tests passed before the local runner instability. Latest `git status`/`git diff` attempts hang with no output in this desktop session, while a GitHub Desktop git status process is also present in the repo. +- Manual playthrough: blocked. Dev server reached ready state but HTTP/browser inspection did not complete because Vite repeatedly restarted under watcher activity and both Playwright connector/CLI paths were unavailable. + +## Resume Instructions + +If context compacts or the run pauses: + +1. Re-read this file. +2. Re-run `git status --short`. +3. Continue from the highest-priority incomplete slice above. +4. Keep persistence browser-local unless a save-schema change becomes unavoidable. +5. Use `npx --yes pnpm@9.15.9 ...` if global `pnpm` is still unavailable. +6. Do not mark complete until the final completion audit passes against current repo state. diff --git a/.codex/MFD/public-release-chip-recovery-goal.md b/.codex/MFD/public-release-chip-recovery-goal.md new file mode 100644 index 00000000..93128256 --- /dev/null +++ b/.codex/MFD/public-release-chip-recovery-goal.md @@ -0,0 +1,264 @@ +# MFD Public Release + Chip Recovery Goal + +Updated: 2026-05-05 17:34:29 CDT +Original repo path: `/Users/tkevinbigham/Documents/GitHub/MFD` +Clean clone path: `/Users/tkevinbigham/Documents/GitHub/MFD-clean-chip-recovery` +Current branch: `codex/chip-public-release-recovery` +Checkout classification: clean recovery clone built from remote after the original checkout failed safe git inspection +Salvage folder: `/Users/tkevinbigham/Documents/GitHub/MFD-chip-salvage-20260505-111937` +Salvage manifest: `/Users/tkevinbigham/Documents/GitHub/MFD-chip-salvage-20260505-111937/MFD_CHIP_SALVAGE_MANIFEST.md` +Baseline commit in clean clone: `dc7740a Sprint 46: Polish standings signals (#54)` + +## Prior Blocker Summary + +- Previous Chip marathon work existed, but the original checkout was not trustworthy enough to mark MFD release-ready. +- `git status` hung in the original checkout and `git diff --stat` failed with `fatal: mmap failed: Operation canceled`. +- Earlier browser work only reached stale `dist`, and Chip was not proven in a current build. +- Recovery goals were: preserve Chip work, move into a clean clone, reapply, verify, then finish live Chip/public-release P0s. + +## Corrupt Repo Diagnosis + +- Original checkout identity was confirmed as MFD from `README.md` and `package.json`. +- Safe git inspection in `/Users/tkevinbigham/Documents/GitHub/MFD`: + - `git rev-parse --show-toplevel`: passed + - `git remote -v`: passed + - `git branch --show-current`: `main` + - `git log -1 --oneline`: `dc7740a Sprint 46: Polish standings signals (#54)` + - `git -c core.fsmonitor=false status --short --untracked-files=no`: timed out after 30s + - `git -c core.fsmonitor=false diff --stat`: failed with `fatal: mmap failed: Operation canceled` +- Conclusion: original repo stayed unsafe for build/test work. No destructive git repair was attempted. + +## Salvage + Recovery Result + +- Chip-related files and `.codex/MFD` notes were salvaged to the timestamped recovery folder above. +- Clean clone created at `/Users/tkevinbigham/Documents/GitHub/MFD-clean-chip-recovery`. +- Recovery branch created: `codex/chip-public-release-recovery`. +- All build, test, and browser verification work below was done only in the clean clone. + +## Implementation Summary + +- Reapplied and completed the Chip onboarding/weekly-guidance/decision-impact slice in the clean clone. +- Wired the formal onboarding state into the live shell and route-beat system instead of leaving guidance as isolated copy beats. +- Added guarded TTS/share scaffolds behind `VITE_CHIP_TTS_ENABLED` and `VITE_MFD_SHARE_ENABLED`. +- Added weekly guidance generation, decision-impact summaries, feature visibility sequencing, and replay/reset/snooze controls. +- Surfaced Chip guidance inside Monday Briefing, Week Advance, Game Plan, Depth Chart, Trade Center, and Cap Lab. +- Fixed a live Game Plan runtime P0 caused by an unstable selector result reference. +- Fixed a live Depth Chart DOM-nesting warning caused by rendering a player-link button inside a depth-slot button. +- Completed the P1 hardening pass for mobile tolerance, Trade Center, Cap Lab, accessibility basics, blank states, and release metadata. +- Fixed the mobile Chip dock so expanded route guidance no longer blocks underlying route controls, while dock controls remain reachable. +- Moved Cap Lab tables to responsive card mode on phone widths and raised PixelSelect plus Chip pending-badge controls to the shared 44px touch target. +- Fixed release HTML asset URLs so the `/MFD/` Vite base no longer double-prefixes the manifest/favicon/OG image paths. +- Kept save compatibility intact: no engine/schema/save-version changes were made, and sim determinism was not touched. + +## Commands Run + +### Install / recovery baseline + +- `npx --yes pnpm@9.15.9 install` + - Result: passed + +### Targeted regression proof before Game Plan selector fix + +- `npx --yes pnpm@9.15.9 --filter @mfd/web exec vitest run src/app/store/selectors.test.ts --reporter=verbose` + - Result before fix: failed + - Root cause: repeated `selectCurrentOpponentIntel(state)` calls returned different object references on unchanged state + +### Targeted verification after selector + tooltip fix + +- `npx --yes pnpm@9.15.9 --filter @mfd/web exec vitest run src/app/store/selectors.test.ts src/features/game-plan/GamePlanSetup.test.tsx --reporter=verbose` + - Result: passed + - Duration: 3.06s + +### Targeted verification after Depth Chart nesting fix + +- `npx --yes pnpm@9.15.9 --filter @mfd/web exec vitest run src/features/depth-chart/DepthChart.test.tsx src/app/store/selectors.test.ts src/features/game-plan/GamePlanSetup.test.tsx --reporter=verbose` + - Result: 3 files / 9 tests passed + +### P1 hardening targeted verification + +- `npx --yes pnpm@9.15.9 --filter @mfd/web exec vitest run src/features/contracts/CapLaboratory.test.tsx --reporter=verbose` + - Result: passed, 1 file / 5 tests +- `npx --yes pnpm@9.15.9 --filter @mfd/design-system exec vitest run components/PixelSelect/PixelSelect.test.tsx --reporter=verbose` + - Result: passed, 1 file / 1 test +- `npx --yes pnpm@9.15.9 --filter @mfd/web exec vitest run src/features/companion/ChipDock.test.tsx --reporter=verbose` + - Result: passed, 1 file / 38 tests +- `npx --yes pnpm@9.15.9 --filter @mfd/design-system exec vitest run tokens/index.test.ts components/PixelSelect/PixelSelect.test.tsx --reporter=verbose` + - Result: passed, 2 files / 2 tests +- `npx --yes pnpm@9.15.9 --filter @mfd/web exec vitest run src/app/indexDocument.test.ts src/features/companion/ChipDock.test.tsx src/features/contracts/CapLaboratory.test.tsx --reporter=verbose` + - Result: passed, 3 files / 44 tests +- `npx --yes pnpm@9.15.9 --filter @mfd/web exec vitest run src/app/indexDocument.test.ts --reporter=verbose` + - Result: passed, 1 file / 2 tests + +### Full repo gates in clean clone + +- `git diff --check` + - Result: passed +- `rg -n "SAVE_VERSION = 35|SAVE_VERSION =|Math\\.random\\(" packages/engine apps/web packages/design-system` + - Result: save version remained `35`; only existing non-sim audio `Math.random()` usage was reported +- `npx --yes pnpm@9.15.9 typecheck` + - Result: passed +- `npx --yes pnpm@9.15.9 --filter @mfd/design-system test` + - Result: passed + - Evidence: 14 test files / 88 tests passed +- `npx --yes pnpm@9.15.9 --filter @mfd/web test` + - Result: passed + - Evidence: 209 test files / 1282 tests passed + - Duration: 28.95s +- `npx --yes pnpm@9.15.9 build` + - Result: passed + - Evidence: production build completed, Vite reported chunk-size warnings only + - Build time: 5.90s + +### Earlier full-suite checkpoint from the same clean clone + +- `npx --yes pnpm@9.15.9 --filter @mfd/web test` + - Result: previously passed at 207 files / 1275 tests before final regression additions +- `npx --yes pnpm@9.15.9 typecheck` + - Result: previously passed +- `npx --yes pnpm@9.15.9 build` + - Result: previously passed + +## Browser Verification + +### Launch path + +- Dev server command: + - `env PATH="/Users/tkevinbigham/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/bin:$PATH" VITE_CHIP_ENABLED=true VITE_CHIP_TTS_ENABLED=false VITE_MFD_SHARE_ENABLED=false npx --yes pnpm@9.15.9 --filter @mfd/web dev -- --host 127.0.0.1 --port 4173` +- Served URL used in browser verification: + - `http://localhost:5174/MFD/` + - Note: `5173` was already occupied, so Vite served this current-code pass on `5174`. + +### Current-code first-3-week playthrough + +- Started a fresh dynasty from current source with Chip enabled. +- Completed setup flow: + - AGM: Deion "Coach D" Hardaway + - Head Coach: Dorian Cross + - Scouting Director: Marvin Tate + - Offense: Power Run + - Defense: 4-3 + - Depth philosophy: Best Players + - Cap package: Balanced Pressure Release + - Goals: Win Division, Cap Health, No Losing Streaks + - Culture mandate: Player Led +- Week 1 verified: + - Chip appeared in the live shell + - Monday Briefing copy clearly explained the weekly loop + - Dock controls present: `Where am I?`, `What now?`, `Replay`, `Snooze`, `Enable`, `Quiet for screen`, `Quiet until next week`, `Quiet this season`, `Reduce guidance`, `Disable animations` + - Route guidance verified on Monday Briefing, Roster, Depth Chart, Game Plan, and Week Advance + - Week Advance decision-impact UI showed `Immediate`, `This season`, `Future`, and `Risk` +- Week 1 advance: + - Game Plan required before advancing + - Halftime decision path was exercised + - Halftime modal: `Halftime Hell`, Jacksonville 0 - 14 New York, chose `Switch` +- Week 2 verified: + - Record updated to `0-1` + - Briefing surfaced the Week 1 result and injury notes + - Chip weekly copy changed appropriately and stayed contextual +- Week 3 verified: + - Record updated to `1-1` + - Briefing surfaced injuries, power-ranking movement, and next opponent + - Chip copy changed again and reduced repetition instead of replaying the same Week 1 text +- Replay was verified in the live Week 3 shell: replay restored the current weekly guidance after dismissal. +- TTS disabled path produced no autoplay voice or crash. +- Share disabled path produced no visible regression. + +### Runtime fixes verified in browser + +- Game Plan P0 before fix: + - `The result of getSnapshot should be cached to avoid an infinite loop` + - `Maximum update depth exceeded` +- Fix applied: + - `apps/web/src/app/store/selectors.ts` memoized `selectCurrentOpponentIntel` + - `apps/web/src/features/game-plan/GamePlanSetup.tsx` stopped passing `PixelPanel` directly as the tooltip child in the crashing surface +- Result: + - `#/game-plan` rendered normally with Chip route guidance and prep controls +- Depth Chart warning before fix: + - nested `