Skip to content

test(sudoku): add macOS Home + Daily hub snapshot baselines - #979

Merged
wei18 merged 1 commit into
mainfrom
worktree-agent-a35b4cd084b20aae6
Jul 30, 2026
Merged

wei18 merged 1 commit into
mainfrom
worktree-agent-a35b4cd084b20aae6

Conversation

@wei18

@wei18 wei18 commented Jul 30, 2026

Copy link
Copy Markdown
Owner

Summary

  • Sudoku had a mac-trait Home baseline only in the cold-start no-resume state, and no mac-trait Daily hub baseline at all, while Minesweeper already covers both surfaces at the mac trait (MinesweeperHomeSnapshotTests/MinesweeperDailyHubSnapshotTests regular_light/regular_dark).
  • Adds snapshotMacLightWithResume/snapshotMacDarkWithResume to HomeViewTests.swift (resume-candidate fixture: ResumePill + mode/stats cards, not a blank first-launch screen) and snapshotAllCompletedMacLight/snapshotAllCompletedMacDark to DailyHubViewTests.swift (allDone fixture: 🔥 7+ day streak, all three difficulty cards checked).
  • Unblocks the macOS App Store screenshot pipeline, which needs a mac-shaped Home and Daily hub render with real content to source marketing screenshots from.

Test plan

  • swift test --package-path Packages/SudokuKit --filter "HomeViewTests|DailyHubViewTests" — 28/28 passed (first run recorded the 4 new baselines under .missing record mode; second run asserted against them clean)
  • swiftlint lint --strict --quiet on both changed files — clean, 0 violations
  • Eyeballed all 4 recorded PNGs (not just dimensions) — correct content and theme in each
  • git status confirms only the intended 2 .swift + 8 baseline (png+txt) files changed

🤖 Generated with Claude Code

Sudoku had no mac-trait Home baseline with real content (resume pill /
stats) and no mac-trait Daily hub baseline at all, while Minesweeper
already covers both surfaces at the mac trait. Adds
snapshotMacLightWithResume/snapshotMacDarkWithResume to HomeViewTests
and snapshotAllCompletedMacLight/snapshotAllCompletedMacDark to
DailyHubViewTests, mirroring MinesweeperHomeSnapshotTests /
MinesweeperDailyHubSnapshotTests' regular_light/regular_dark pair.
Fixtures use the fullest honest state (resume candidate for Home,
7+ day streak allDone for Daily) since these baselines feed the
macOS App Store screenshot pipeline.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@wei18
wei18 merged commit 76ca3ed into main Jul 30, 2026
5 checks passed
@wei18
wei18 deleted the worktree-agent-a35b4cd084b20aae6 branch July 30, 2026 04:33
wei18 added a commit that referenced this pull request Jul 30, 2026
- MS iPhone Board: swap `beginner-covered` (untouched, all-grey grid) to
  `beginner-flagged` from a sibling suite (MinesweeperBoardRevealedSnapshotTests)
  round 1's per-slot-suite-only search missed. `flagged` is `midReveal`'s
  revealed number cells plus three placed flags, matching both verbs in
  "Flag, reveal, solve." in one frame. Re-verified the iPhone callout (no
  grid to overlap, header-chrome anchor unaffected) across all 7 locales.
- Corrected every "#979" citation in the script and strategy doc describing
  this pipeline's own chip-overlap/crop history — #979 is an unrelated
  macOS snapshot-baselines PR. Dropped the invented reference rather than
  leave a pointer that sends the next reader somewhere wrong.
- Added the chip_max_w lesson directly in the CALLOUTS comment: any
  `chip_at` callout needs a chip_max_w sanity check as a matter of course,
  not just the slot someone happens to touch that round.
- Documented (not applied) two round-2 findings that trade fullness against
  something already reviewed/shipped rather than against pure emptiness:
  Sudoku Board's `pencilNotes` fixture (real in-grid notes, but no error
  cell for the existing "catches mistakes instantly" callout to anchor to)
  and Sudoku Settings' `appStoreRows` fixture (3 more real rows, but only
  recorded in the unpurchased $2.99 state). Also logged the suites
  reviewed and rejected (loss states, edge/failure states, unrelated
  screens) so the next audit doesn't re-walk the same ground.

Full 126-PNG regen: dims/RGB/no-alpha green, full-res + thumbnail visual
pass on the changed slot across all 7 locales.

Part of #976.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
wei18 added a commit that referenced this pull request Aug 3, 2026
1. MS iPad Daily still shipped the exact defect this PR exists to fix: the
   only baseline (`Daily-iPad-light-regular`) has `weekStrip == .unknown`
   (no streak) AND Expert badged Failed — with `detect_content_bottom()`
   correctly cropping it, that composited as a ~7%-tall panel sliver over
   ~75% flat gradient, the worst-emptiness frame in the whole 126-PNG set.
   Records `MinesweeperDailyHubSnapshotTests.snapshotDaily_iPad_light_streak`
   (2-day streak, all three difficulties completed, zero isFailed) and
   wires it into SLOTS in place of the sliver.

2. Thai line-wrap could orphan a combining mark: the character-split
   fallback iterated code points, and `unicodedata.combining()` returns 0
   for most Thai vowel/tone marks (a Unicode quirk — Thai is a visual-order
   script) even though they're category Mn. Reproduced the reported break
   (`ปักธงจุดที่สงสัยว่ามีระเบิด` at 360-365px → a line starting with a bare
   MAI HAN-AKAT) and fixed with a `grapheme_clusters()` helper keyed on
   `unicodedata.category() in (Mn, Mc, Me)`, applied to both the callout-chip
   wrap and the headline/subhead wrap (same bug shape, same fix). Re-verified
   against the exact repro: breaks now land on full clusters.

3. The same wrap function silently discarded any wrapped label past two
   lines (`lines[:2]`) — a future longer translation would lose text with
   every automated check green. Now raises with the offending
   slot/locale/label instead of truncating silently.

4. Dropped a stray `#979` citation at line 568 — #979 is the macOS
   Home/Daily baselines PR, unrelated to this chip-geometry docstring. The
   other #979 reference (BoardViewPencilNotesTests.swift:79) was verified
   correct and left untouched, per the reviewer's finding.

Full 126-PNG regen: dims/RGB/no-alpha sweep green; only the 7 MS iPad Daily
locale frames changed pixel content (confirms items 2-4 are latent-bug
fixes with no effect on already-shipped output). Full-res + thumbnail pass
on every changed frame.

Part of #976.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
wei18 added a commit that referenced this pull request Aug 3, 2026
* feat(store): generator for Direction C+B marketing frames

Replaces the caption-panel-over-flat-tint + centered-bezel marketing frame
with Direction C (full-bleed brand-gradient ground in each app's own theme
accent, headline/subhead set directly into the gradient, device screenshot
bleeding off the bottom edge, small app-icon badge) on Home/Daily/Settings,
layered with Direction B (one feature-callout chip + leader line, authored
in screen-fraction coordinates, reused across locales) on Board/Completion.

Wires every slot to a per-locale baseline (en uses the existing baseline;
zh-Hant/zh-Hans/ja/ko/es/th come from new *Localized snapshot tests) so the
compositor can hang a locale-correct caption on each frame, and documents a
known limitation this surfaced: SwiftUI's Text(LocalizedStringKey) resolves
against Bundle.main, not .environment(\.locale), so the underlying app
screenshot itself never localizes inside a headless swift test host — every
locale's raw baseline is pixel-identical to en. Only the composited caption
overlay is genuinely translated. Pre-existing gap (3 prior locale baselines
already showed this), not a regression, but now documented precisely rather
than understated.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* test(store): per-locale snapshot tests for the ASC marketing pipeline

Adds *Localized parameterized @test(arguments: SnapshotLocales.storeLocales)
snapshot tests to HomeView/DailyHubView/BoardView/CompletionView/
SettingsView (Sudoku) and the MS equivalents, reusing the existing
hostingView(locale:) injection — no new capture mechanism. Extracts
SnapshotLocales (shared zh-Hant/zh-Hans/ja/ko/es/th list) so every suite
draws from one place.

BoardViewTests.swift and SettingsViewTests.swift crossed SwiftLint's
400-line file_length ceiling once the new tests landed; split the two new
BoardView locale tests into BoardViewLocalizedTests.swift (an extension on
the same @suite struct — swift-testing picks up @test funcs from extensions
in any file of the same target) and trimmed SettingsViewTests.swift's
pre-existing multi-line comments to single lines (line_length ignores
comments per .swiftlint.yml, so this is free).

Verified: swift test --package-path Packages/SudokuKit and
--package-path Packages/MinesweeperKit both pass in full (SudokuKit's
SudokuUITests target segfaults when run as a single 380-test process — a
known local-only AppKit NSWindow-accumulation issue, see
sudokukit-full-suite-segfault-local memory note — so it was run in 12
batches of ~30 tests each; all batches green, 466 SudokuKit tests / 380
MinesweeperKit tests total).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* test(store): record per-locale snapshot baselines

108 new baselines (60 Sudoku + 48 MS) recorded by the *Localized tests
added in the prior commit, via the suites' existing SnapshotMode.recordMode
= .missing (auto-records only when a baseline file is absent).

No existing baseline changed — every pre-existing PNG in these
__Snapshots__ trees is untouched; this commit is additive only.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* chore(store): regenerate ascspec marketing frames (Direction C+B)

Regenerates all 126 slots (2 apps x 2 devices x 7 locales, minus MS having
no Settings slot) from the final generator + baseline state via
`mise run store:screenshots build-ascspec`, so the committed PNGs match the
committed code and baselines from the prior three commits.

Verified independently of the generator's own self-check: a Pillow sweep
over all 126 output PNGs confirms exact ASC pixel dimensions (1290x2796
iphone-6.9, 2064x2752 ipad-13), RGB mode, no alpha channel. Spot-checked
ja/ko/zh-Hans/zh-Hant/th frames for correct script rendering (no tofu) and
es for accented characters — all correct. Thumbnail legibility (~300px
wide) verified on representative Home/Board/Completion frames in both
apps: headlines, subheads, and Direction B callout chips all stay readable
at storefront-thumbnail scale; no slot needed its chip dropped.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* revert(store): back out per-locale snapshot tests + baselines

Byte-for-byte comparison showed all 108 *Localized baselines added in
7dc9ed4/2097aea were pixel-identical to their `en` counterpart, for every
slot, in both apps — SwiftUI's Text(LocalizedStringKey) resolves against
Bundle.main, not .environment(\.locale, ...), so a headless `swift test`
host (no compiled .lproj in Bundle.main) can never localize the underlying
screenshot content. Landing 108 files that look like localized coverage
while providing none would repeat the exact failure mode
docs/app-store/screenshots/README.md already warns about for a prior,
unrelated instance of byte-identical "placeholder" screenshots.

Backs BoardViewTests.swift, SettingsViewTests.swift, CompletionViewTests.swift,
DailyHubViewTests.swift, HomeViewTests.swift, the 4 MinesweeperUITests
snapshot files, and MinesweeperUITests/SnapshotConfig.swift out to their
origin/main shape (verified: zero diff against origin/main after this
commit). Deletes BoardViewLocalizedTests.swift and SnapshotLocales.swift —
they existed only to host the now-removed tests; BoardViewTests.swift
reverts to its original 400-line shape with no split needed. Removes all
108 baseline PNGs. The 3 pre-existing locale baselines in BoardViewTests
(ja/ko/zhTW, predating this branch) are untouched, as are the 12 orphaned
baseline PNGs already cleaned up in an earlier commit.

Root cause, evidence, and two real fix paths (Bundle injection at Text call
sites vs. capturing from the Simulator where Bundle.main genuinely carries
.lproj resources) are filed as #977.

Re-verified after this revert: swift test --package-path Packages/SudokuKit
(456 tests, batched per the documented local segfault workaround) and
--package-path Packages/MinesweeperKit (372 tests, single process) both
green; swiftlint --strict reports 0 diff-relevant violations (no Swift
files differ from origin/main after this commit).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(store): generator falls back to a single baseline per slot

Companion to the prior revert commit: Slot.baseline() no longer takes a
locale argument or looks up a *_localized-prefixed file — it always resolves
the one baseline recorded per slot, matching pre-redesign behavior (every
locale composites its translated caption over the same underlying
screenshot). Drops the now-unused localized_prefix field and the 12
now-stale localized_prefix arguments across the SLOTS table.

Updates the module docstring and the strategy doc's "Localized UI" section
to stop describing a per-locale-baseline mechanism that no longer exists in
this PR, and points at #977 for the root cause + real fix paths instead.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(store): crop dead-space + stop callout chips covering the grid

Two visual defects found by manual review of the actual output (not just
thumbnails), both now fixed and re-verified:

1. Direction C's panel bled the FULL baseline screenshot to the canvas
   edge, so a scrolled list's own empty tail bled too — Home/Daily/Settings
   showed 40-60% flat cream space inside the panel, worse than the
   pre-redesign layout it replaced. Fix: crop the baseline to its
   content-bearing region (new detect_content_bottom(), alpha+color-aware
   so it handles both a full opaque device screenshot and a floating
   hero-reveal card) before compositing, at the existing width-fill scale.
   The panel is now exactly as tall as its real content; slots whose
   content already reaches deep (Board's digit pad, ~92%) still bleed past
   the canvas edge same as before, nothing forces it for shorter slots.

   An earlier version of this fix also over-zoomed short slots to force
   bleed on every slot, then center-cropped the overflow back to screen_w.
   That regressed worse than the bug: MS iPad's covered board (grid+panel
   only 44% tall) needed enough zoom to outgrow the width too, and the
   crop-back clipped the "Reveal" button off the canvas edge — hiding real
   product UI, the same failure class as defect 2 below. Reverted to the
   simpler width-only scale; a shorter panel with the brand gradient
   showing below it (not cream, not a clipped button) meets the actual bar
   ("no flat area with nothing in it") without that risk.

2. Direction B's callout chip always dropped straight below its anchor
   dot. On Sudoku Board (both devices) that landed the chip on live grid
   cells (row2's "9"/"8"), and on MS iPad it landed on the covered grid
   tiles — a marketing shot hiding the thing it advertises. Fix:
   draw_callout_chip gains an optional chip_xy target, independent of the
   anchor position, with the leader line drawn straight from anchor to
   chip instead of assuming "chip sits below the dot"; CALLOUTS gains a
   matching chip_at per (slot, device) that needed it. All three targets
   were measured directly off the baseline's own pixel geometry (grid
   bounding box, header-row text extent, button bottom edge — not
   guessed), and each was re-verified against the actual rendered output,
   not just computed: the first two attempts at each target were wrong
   (margin-clamp interaction pushed the Sudoku chip back onto the cells it
   was meant to avoid; the Y target for iPad didn't account for the chip's
   own height and its bottom edge dipped into the grid) — third attempt
   confirmed clean via full-resolution crops of the actual PNGs.

Re-verified after every change: full 126-PNG dims/RGB/no-alpha sweep
(clean), full-resolution visual check of every touched slot (Home/Daily/
Settings/Board on both devices, both apps, plus Completion and MS Home to
confirm no side effects), and a ~300px thumbnail legibility pass on the
moved chips — all read clean, no chip needed dropping.

Also noted, not fixed (out of scope — production app-code bug, not a
generator issue): the MS iPad Board baseline shows "leave.game.leave" as
a raw, unlocalized string-catalog key in the header instead of translated
text. Flagging for a separate issue.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(store): #967 ja/th daily copy, fuller fixtures, chip overflow

- ja/th Daily Hub subhead now matches the shipped Easy/Medium/Hard
  strings (Localizable.xcstrings): ja やさしい・ふつう・むずかしい,
  th ปานกลาง for Medium instead of the shortened กลาง.
- Audited every slot's baseline fixture against its snapshot-suite
  siblings for a fuller, still-honest state: Sudoku Daily Hub (iPhone)
  and Minesweeper Daily Hub (iPhone) swap to their streak/all-done
  fixtures; Minesweeper Completion (iPhone) swaps to the daily-reminder
  fixture. Board/Completion fixtures with a message-relevant reason to
  stay (Sudoku Board's error-highlight demo) were left alone; iPad and
  Home slots had no honest fuller candidate and are documented as such.
- The Completion fixture swap moved MS iPhone's Direction-B callout
  anchor onto the new reminder row's text; re-measured and fixed.
- Re-verifying every locale (not just en) found MS iPad Board's callout
  chip overlapping the grid for ja/es/th — those labels are wider than
  the available column space that only en's shorter label fit by
  accident. draw_callout_chip() gained an optional max_width that wraps
  onto a second line (word-split, with a character-split fallback for
  CJK/Thai's space-free scripts).

Full 126-PNG regen verified: dims/RGB/no-alpha sweep green, full-res +
thumbnail visual pass on every changed slot, no tofu, no grid overlap.

Part of #976. Closes #967.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(store): widen fixture audit to every suite dir, fix #979 mis-cites

- MS iPhone Board: swap `beginner-covered` (untouched, all-grey grid) to
  `beginner-flagged` from a sibling suite (MinesweeperBoardRevealedSnapshotTests)
  round 1's per-slot-suite-only search missed. `flagged` is `midReveal`'s
  revealed number cells plus three placed flags, matching both verbs in
  "Flag, reveal, solve." in one frame. Re-verified the iPhone callout (no
  grid to overlap, header-chrome anchor unaffected) across all 7 locales.
- Corrected every "#979" citation in the script and strategy doc describing
  this pipeline's own chip-overlap/crop history — #979 is an unrelated
  macOS snapshot-baselines PR. Dropped the invented reference rather than
  leave a pointer that sends the next reader somewhere wrong.
- Added the chip_max_w lesson directly in the CALLOUTS comment: any
  `chip_at` callout needs a chip_max_w sanity check as a matter of course,
  not just the slot someone happens to touch that round.
- Documented (not applied) two round-2 findings that trade fullness against
  something already reviewed/shipped rather than against pure emptiness:
  Sudoku Board's `pencilNotes` fixture (real in-grid notes, but no error
  cell for the existing "catches mistakes instantly" callout to anchor to)
  and Sudoku Settings' `appStoreRows` fixture (3 more real rows, but only
  recorded in the unpurchased $2.99 state). Also logged the suites
  reviewed and rejected (loss states, edge/failure states, unrelated
  screens) so the next audit doesn't re-walk the same ground.

Full 126-PNG regen: dims/RGB/no-alpha green, full-res + thumbnail visual
pass on the changed slot across all 7 locales.

Part of #976.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(store): record a Sudoku board baseline that proves both Shot 3 claims

Every existing Board baseline proved only half of Shot 3's copy: `inProgress`
had the red error cell but zero in-grid pencil notes, and `pencilNotes` had
notes but no error cell. Neither fixture could be swapped in without moving
the unproven-claim problem rather than fixing it.

Records `BoardViewPencilNotesTests.snapshotPencilNotesWithError_iPhone_light`
/ `..._iPad_light` — reusing `BoardViewTests.inProgressClues`'s exact
userCells/errorCells/selection/elapsedSeconds (so the existing Direction-B
chip anchor for ("sudoku", "03-board") keeps working unrecalculated) plus
pencil notes added into three cells confirmed empty. Wires it into SLOTS in
place of `BoardViewTests/inProgress` and regenerates all 126 ASC-spec
frames.

Also rules on the two other screenshot-strategy.md open items: Settings
stays on `purchased` (the alternate fixture's only variant shows the stale
$2.99 price — filed #981, not fixed here) and Completion is left as-is
(not enough evidence to tell a real surface from a test double).

Chip-geometry re-verified against the new baseline across all 7 locales x
both device classes (no grid overlap); 126/126 regenerated frames pass the
dims/RGB/no-alpha sweep.

Part of #976.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(store): address 4 code-review findings on the board/daily fixture PR

1. MS iPad Daily still shipped the exact defect this PR exists to fix: the
   only baseline (`Daily-iPad-light-regular`) has `weekStrip == .unknown`
   (no streak) AND Expert badged Failed — with `detect_content_bottom()`
   correctly cropping it, that composited as a ~7%-tall panel sliver over
   ~75% flat gradient, the worst-emptiness frame in the whole 126-PNG set.
   Records `MinesweeperDailyHubSnapshotTests.snapshotDaily_iPad_light_streak`
   (2-day streak, all three difficulties completed, zero isFailed) and
   wires it into SLOTS in place of the sliver.

2. Thai line-wrap could orphan a combining mark: the character-split
   fallback iterated code points, and `unicodedata.combining()` returns 0
   for most Thai vowel/tone marks (a Unicode quirk — Thai is a visual-order
   script) even though they're category Mn. Reproduced the reported break
   (`ปักธงจุดที่สงสัยว่ามีระเบิด` at 360-365px → a line starting with a bare
   MAI HAN-AKAT) and fixed with a `grapheme_clusters()` helper keyed on
   `unicodedata.category() in (Mn, Mc, Me)`, applied to both the callout-chip
   wrap and the headline/subhead wrap (same bug shape, same fix). Re-verified
   against the exact repro: breaks now land on full clusters.

3. The same wrap function silently discarded any wrapped label past two
   lines (`lines[:2]`) — a future longer translation would lose text with
   every automated check green. Now raises with the offending
   slot/locale/label instead of truncating silently.

4. Dropped a stray `#979` citation at line 568 — #979 is the macOS
   Home/Daily baselines PR, unrelated to this chip-geometry docstring. The
   other #979 reference (BoardViewPencilNotesTests.swift:79) was verified
   correct and left untouched, per the reviewer's finding.

Full 126-PNG regen: dims/RGB/no-alpha sweep green; only the 7 MS iPad Daily
locale frames changed pixel content (confirms items 2-4 are latent-bug
fixes with no effect on already-shipped output). Full-res + thumbnail pass
on every changed frame.

Part of #976.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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