Skip to content

feat(stats): per-app Statistics screen v1 from PersonalRecord (Home entry) - #820

Merged
wei18 merged 1 commit into
mainfrom
feat/773-stats-screen
Jul 14, 2026
Merged

wei18 merged 1 commit into
mainfrom
feat/773-stats-screen

Conversation

@wei18

@wei18 wei18 commented Jul 14, 2026

Copy link
Copy Markdown
Owner

What

Closes #773 — per-app Statistics screen v1 reading only existing PersonalRecord fields (zero schema change), with a secondary-weight Home entry.

Owner-adjudicated scope (recorded on the issue)

Home entry ONLY (no Settings row) · Daily/Practice stacked sections · NO streak number (follows #774 later) · NO MS win-rate tile (no loss data) · per-app screens (issue scope note) · direct implementation from docs/v2/stats-screen-proposal.md.

How

  • Shared HomeScreen gains a SecondaryLink generic slot (default EmptyView — existing callers pixel-identical); HomeSecondaryEntryLink renders the flat, visually-subordinate Statistics row. Threaded via GameConfig.statsRoute → GameHomeViewModel/View → per-app AppRoute.stats + LiveRouteFactory arms (with per-case sentinel tests, added in CR round 1).
  • Tiles per difficulty: Completed / Best / Average (computed total/count, zero-guarded); nil best → '—'; CK fetch degrades soft per the daily-hub posture (renders empty tiles offline/signed-out, errors funneled).
  • A11y: AX3 stacks grid AND per-tile stat columns (PNG-verified); VoiceOver reads each tile as one combined element. iPad 3-column reflow; macOS 960pt clamp.
  • Telemetry statsViewed (once per mount, latch-tested). 11 L10n keys × 7 locales × both catalogs.
  • Deviations (documented): just-set-PB status.success accent omitted (unknowable from existing fields — vacuously satisfies the criterion; grep-verified zero status.success in the new views); footnote copy corrected to a factually-true iCloud note (proposal allowed 'or similar').
  • Rebased over feat(settings): Share App + Write a Review rows; GC invite-friends row (iOS 26+) #744 (53c3daa): 4 conflict files resolved keep-both; reviewer diffed both parents — nothing from feat(settings): Share App + Write a Review rows; GC invite-friends row (iOS 26+) #744 lost; one genuinely-orphaned SDD-003-era comment line removed to hold the 400-line lint ceiling.

Verification

MS full suite 281/281 (--no-parallel) · Sudoku Stats/Home/RouteFactory filters green (known machine-local full-suite segfault reproduces on unmodified main) · GameAppKit 35/35 · GameShellKit 28/28 · TelemetryKit 32/32 · scan:l10n pass · swiftlint --strict clean.
8 new Stats baselines + 10 Home re-records, all eyeballed (incl. by the Leader: sections/dots/placeholders/no-celebration all per spec).
Dual code review: mechanical APPROVE (11-point) + adversarial round-2 APPROVE (sentinel tests verified to exercise the factory arms; rebase resolution independently diffed against both parents).

🤖 Generated with Claude Code

…ntry)

Implements docs/v2/stats-screen-proposal.md as amended by the owner's
2026-07-14 adjudication comments on the issue (which are binding and
supersede the older body/proposal text where they conflict):

- Entry point: Home ONLY — a secondary-weight HomeSecondaryEntryLink row
  below the four mode cards (new optional secondaryLink slot on the shared
  HomeScreen scaffold; GameConfig.statsRoute drives it). The Settings
  disclosure row is DROPPED from scope per adjudication 4 — SettingsScreen
  is untouched.
- Layout: Daily and Practice as two stacked sections (adjudication 1, no
  segmented control).
- NO streak number anywhere (adjudication 2 — #774 adds it later).
- NO MS win-rate tile (adjudication 3 — no loss counter exists).
- Per-app screens (SudokuUI StatsView/StatsViewModel + MinesweeperUI
  MinesweeperStatsView/MinesweeperStatsViewModel; proposal §7 scope note —
  no shared cross-app Stats component), reading ONLY existing
  PersonalRecord fields: completedCount, bestTimeSeconds (nilable),
  totalTimeSeconds → average computed as total/count. Zero schema changes.
- MS Daily AND Practice sections ship with real data (#705 closed via
  #779 — practice PBs write for both).

Screen behavior:
- Pushed route per app (AppRoute.stats + LiveRouteFactory mapping; MS's
  destination split into LiveRouteFactory+Stats.swift for the 400-line
  file_length ceiling). Compact: 1-column tiles; iPad/Mac regular:
  3-column reflow + the boards' 960pt clamp-and-center; .accessibility3+:
  grid AND per-tile stat columns stack vertically (LeaderboardView's
  policy), no truncation.
- VoiceOver: each tile is one combined element with an explicit localized
  label ("Easy, 14 completed, best time 3 minutes 12 seconds, ...").
- Fetch: renders empty tiles instantly, fills as async CK reads land;
  offline / iCloud-signed-out degrades to zeroes via errorReporter funnel
  (daily-hub graceful-degrade posture). No monetization surface.
- Telemetry: new TelemetryEvent.statsViewed fired once per screen mount.
- L10n: 8 new keys in both catalogs (7 locales), +3 MS-only (Completed /
  Daily / Practice were missing from the MS catalog); l10n fixture
  regenerated; scan:l10n passes.

Deviation (documented): the proposal's conditional status.success accent
on a "just-set personal best" tile is omitted — PersonalRecord carries no
"best changed at last update" signal, so the screen cannot know
"just-set" (the dispatch's stated fallback).

Tests: VM unit tests both apps (average computation, nil-best / zero-count
tiles, fetch-failure degrade, one-shot telemetry, nil-store MS path);
strict-image snapshot baselines for the new screen (iPhone light, AX3,
iPad, Mac × both apps) recorded once and eyeballed; Home baselines
re-recorded for the new entry (both apps) and eyeballed. SudokuKit
verified in filtered batches (full-suite segfault is the known local
issue, reproduced on unmodified main); MinesweeperKit --no-parallel
276/276; GameAppKit 35/35; GameShellKit 28/28; TelemetryKit 32/32.
swiftlint --strict clean on changed files.

CR round-1 fix: per-case route-factory sentinel tests added for `.stats`
(statsRouteReturnsStatsView in SudokuKit RouteFactoryTests;
factoryReturnsViewForStatsRoute in MS LiveRouteFactoryTests). Rebased over
#744 (53c3daa): kept both sides in MS LiveRouteFactory/Live (their
share/review/invite-friends params + this branch's stats route); removed
an orphaned doc-comment line #744 left at the file tail and compressed the
`.stats` case to hold the 400-line file_length ceiling.

Closes #773

Co-Authored-By: Claude Fable 5 <[email protected]>
@wei18
wei18 enabled auto-merge (squash) July 14, 2026 14:51
@wei18
wei18 merged commit c59b828 into main Jul 14, 2026
4 checks passed
@wei18
wei18 deleted the feat/773-stats-screen branch July 14, 2026 14:52
@github-actions github-actions Bot mentioned this pull request Jul 14, 2026
wei18 added a commit that referenced this pull request Jul 16, 2026
…elemetry, prototype Stats re-tags, doc counts (#827)

The 6 "Accepted — fixing" rows from the #757 triage comment pinned to
_Generated 2026-07-14T21:06:06.381Z_:

- App/Minesweeper/Info.plist: add NSGameKitFriendListUsageDescription
  (key name taken from Sudoku's plist, which is the truth — the report's
  and an earlier research note's spellings disagreed). MS ships the #744
  invite-friends surface and reads the shared GameCenterKit friends scope,
  so the usage string is required; without it the prompt is a review/TCC
  risk.
- App/{Minesweeper,Sudoku}/Resources/InfoPlist.xcstrings: localize that key
  to all 7 locales in BOTH apps, mirroring how NSUserTrackingUsageDescription
  is handled (#371): plist literal stays as the base fallback, the catalog
  carries the localizations.
- App/Sudoku/Resources/Localizable.xcstrings: delete an orphaned, fully
  translated copy of the same friend-list string keyed by its English value
  (added f728a1c, 2026-06-08). Info.plist usage strings are never read from
  Localizable.xcstrings, so those translations have been dead since the day
  they landed — the exact bug class this wave fixes for MS, found by the
  code review of this commit's own first cut. Its brand-name handling also
  diverged (數獨/数独 vs the catalog's own convention of leaving "Sudoku"
  untranslated, per the neighbouring ATT string); the live InfoPlist entry
  follows the convention. Fixture regenerated accordingly.
- GameAppKit MakeGameApp+Helpers.swift: the bootMonetization success branch
  printed to stdout while the failure branch already funnelled through
  Telemetry. It now observes a new TelemetryEvent.bootStepSucceeded, mapped
  in OSLogSink at .info with public privacy (source + step are stable
  taxonomy strings — BootStep is a closed ump/att/adMob enum, no PII).
  This was the only production print() left in Packages; there are now zero.
- docs/designs/sudoku-app-flow.prototype.html +
  docs/minesweeper/minesweeper-app-flow.prototype.html: re-tag for the
  Statistics screen (#773, shipped #820) per each file's existing
  SUPERSEDED-note convention — header meta + Home flow-sub, mocks untouched.
- docs/designs/code/SnapshotMatrix.md: the stale "Total target: ≈50
  (21+16+13)" line contradicted the file's own Coverage summary; corrected
  to 58 (21+13+17+7). §4's header count (6) was stale against its 7 rows —
  corrected in passing since it sits inside the same contradiction.
- docs/designs/README.md: the "25 images" citation predates the matrix's
  growth; now points at the Coverage summary and notes the 25 figure is a
  historical v1 lock.

Verification: scan:l10n green (2 catalogs, 7 locales, 0 placeholders — the
gate caught the fixture drift from the orphan deletion and it was
regenerated); plutil -lint clean on both plists; TelemetryKit 32/32;
GameAppKit 35/35; swiftlint --strict clean; both prototypes parse; tuist
generate succeeds.

Part of #757.

Co-authored-by: Claude Fable 5 <[email protected]>
@github-actions github-actions Bot mentioned this pull request Aug 3, 2026
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.

feat(shell): Statistics screen v1 from PersonalRecord (adopted proposal)

1 participant