Skip to content

docs(contracts): sync screen contracts and navigation flows to as-built - #930

Merged
wei18 merged 3 commits into
mainfrom
docs/sync-screen-contracts-as-built
Jul 21, 2026
Merged

wei18 merged 3 commits into
mainfrom
docs/sync-screen-contracts-as-built

Conversation

@wei18

@wei18 wei18 commented Jul 21, 2026

Copy link
Copy Markdown
Owner

A navigation-contract audit of all 22 screen contracts found that the navigation implementation is healthy — the contract docs are what rotted. Both apps' drift was symmetric, so the mirror principle held in code; the gap was entirely documentation that stopped tracking as-built.

The contracts were written in #684 (2026-07-05). Since then #719 · #773 · #814 · #826 · #841 · #842 · #844 · #849 · #868 · #885 · #910 changed navigation without updating them.

What was stale

Gap Fix
Statistics had no contract at all New ## STATS contract; HOME gains the card + interaction row. It is not in HomeMode — the app layer injects it at GameHomeView.swift:80 — so the contract now reflects that structure
MS open path documented as "no loader" Three loaders with real state machines exist (MinesweeperDailyOpenGuardView #842, MinesweeperDailyReplayLoaderView #841, MinesweeperFreshBoardLoaderView #910). Documented as tiers with their .checking/.loading/.failed variants
Week strip absent from both Daily hubs DailyStripView (#826) added to element inventory + interactions; completed-day dots are tappable, so COMPLETION-REVIEW entry points were corrected
Close missing from board-load-failed Added to both apps' element inventory + interaction rows (#719)
Contracts described divergence that no longer exists Practice CTA is "New Game" on both since #885; MS completion overlay does have the reminder affordance since #814
GC entry points listed only the Home card Settings' Game Center row is a real entry too (same guard, #685/#714) — added to GC-DASHBOARD, GC-SIGNED-OUT-ALERT and SETTINGS
Stale code anchor GC-signed-out alert lives in GameRoot.swift:113-123, not MakeGameApp+Modifiers.swift (moved in #685)
navigation-flows.md route enums Added .stats and .completion's day parameter; .leaveReady (#849/#868) recorded with a dated note

Verification

Every added or edited row was re-anchored against current source with rg/sed before being written — audit-report line numbers were treated as stale by default. Sampled anchors confirmed: the STATS entry chain, all three MS loader state machines, the GC alert's new home, both apps' Close/Retry rows, both Practice CTAs, and the completion detent parity ([.medium, .large]). Markdown table structure checked by pipe-count scan.

Docs only — no .swift touched.

Deliberately not in this PR

  • REMINDER-DENIED — left untouched while the foreground-refresh gap it depends on was being verified. That turned out to be a real bug, fixed in fix(settings): re-poll reminder permission on foreground return #929; this contract should gain the foreground re-poll behavior once that merges.
  • ATT-PRIMER — the audit flagged a suspected "primer never fires" bug. Investigated and dismissed: ATTPrimerSheetModifier is a real ViewModifier body with a @Bindable projection over an @Observable coordinator, so observation works correctly. No doc change, and deliberately no warning added for a non-issue.
  • One further audit finding (Sudoku BoardLoaderView's .completedRedirect state) is outside this PR's scope and awaits triage.

🤖 Generated with Claude Code

wei18 and others added 3 commits July 21, 2026 17:29
…drift to as-built

Nav audit (flow-audit-hubs/board/periphery.md) found docs/screen-contracts.md
frozen at #684 (2026-07-05) while a dozen merged PRs changed navigation
underneath it. This pass fixes gaps 1-4:

- add ## STATS contract (Statistics Home entry, #773/#844) + wire it into
  HOME's element inventory/interactions (was completely undocumented)
- rewrite MS-BOARD-LOAD-FAILED into 4 tiers covering the new
  MinesweeperDailyOpenGuardView (#842) / MinesweeperDailyReplayLoaderView
  (#841) / MinesweeperFreshBoardLoaderView (#910) loaders the docs claimed
  didn't exist ("direct mount, no loader" was wrong); update MS-DAILY-HUB's
  per-interaction table to route through them
- add the week-strip (DailyStripView, #826) to SUD/MS-DAILY-HUB element
  inventory + interactions, and fix SUD/MS-COMPLETION-REVIEW's stale
  "completed-card tap only" entry points
- add the Close button (#719) to SUD/MS-BOARD-LOAD-FAILED's element
  inventory, previously Retry-only
- add SUD-BOARD's .leaveReady branch (#849/#868) to its interaction table,
  mirroring MS-BOARD's existing #681 note; extend PAUSE-OVERLAY's Resume row
  to name both apps' view-local flags

No .swift changes — docs only. Every new/edited row re-verified against
current source via rg before writing.

Co-Authored-By: Claude Fable 5 <[email protected]>
…der, route enums

Continues the previous commit (gaps 1-4) with gaps 5-8 from the same nav
audit:

- drop stale Practice hub CTA divergence: both apps read "New Game" since
  #885 (was "Draw new puzzle" Sudoku / "Start" MS); also note the MS Start
  tap now routes through MinesweeperFreshBoardLoaderView (#910)
- add MS-COMPLETION-OVERLAY's reminder affordance (#814, mirrors Sudoku's
  #287) — was documented as Sudoku-only; update REMINDER-PRIMER's entry
  points to match
- add the SETTINGS Game Center row as a real second entry point into
  GC-DASHBOARD / GC-SIGNED-OUT-ALERT (#685/#714), and give SETTINGS' own
  interaction table the row it was missing
- fix GC-SIGNED-OUT-ALERT's code anchor: the alert moved from
  MakeGameApp+Modifiers.swift to GameRoot.swift:113-123 under #685
- navigation-flows.md: add the `.stats` case to both route enum
  reproductions, widen MS `.completion` with its `day` param (#826), add a
  dated note for Sudoku's `.leaveReady` state (#849/#868, mirrors MS's
  #681 note), and fix N14's stale GC-alert anchor to match

No .swift changes — docs only. Every new/edited row re-verified against
current source via rg before writing.

Co-Authored-By: Claude Fable 5 <[email protected]>
CR round 1 — all three were coordinates pointing at the wrong code, not
wrong claims about behavior:

- HOME footnote 2: sidebarItems(from:) is at HomeScreen.swift:115-127,
  not :103-116 (that range covered the previous init + the extension header).
- MS-BOARD-LOAD-FAILED tier 2: the whole anchor set had drifted. content
  switch is :145-205 (not :141-192), exitToHub :207-214 (not :198-205),
  resolve :244-265 (not :207-231 — that range is actually exitToHub +
  check() + resolve levels doc comment). Added check() explicitly. File is
  266 lines, not 267.
- MS-COMPLETION-OVERLAY #814 note: the daily-only gate for THIS live
  overlay is MinesweeperBoardView.swift:1110-1121, which gates on mode AND
  an actual win. LiveRouteFactory.swift:308 carries a near-identical
  mode == .daily line but belongs to the pushed .completion re-view route;
  the note now spells out the distinction so the next reader does not
  re-anchor to the wrong one.

Co-Authored-By: Claude Fable 5 <[email protected]>
@wei18
wei18 merged commit 118289f into main Jul 21, 2026
5 checks passed
@wei18
wei18 deleted the docs/sync-screen-contracts-as-built branch July 21, 2026 14:10
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