Skip to content

fix(board): let the iPad regular-width Sudoku board fill its column through the shared RegularBoardContainer seam - #1115

Merged
wei18 merged 5 commits into
mainfrom
session/sudoku-ipad-board-1105
Nov 13, 2026
Merged

wei18 merged 5 commits into
mainfrom
session/sudoku-ipad-board-1105

Conversation

@wei18

@wei18 wei18 commented Nov 10, 2026

Copy link
Copy Markdown
Owner

Closes #1105
part of #1014

What

Sudoku's regular-width board layout (BoardView.macLayout, selected by horizontalSizeClass == .regular) was written for the Mac detail pane — outer column capped at 960 pt and centred, board capped to a 640 pt square (docs/designs/05-board.md §b, locked 2026-05-30). iPad is also .regular, so it inherited both caps. Measured on an iPad Pro 11-inch (M5) simulator before any change: landscape held the board at 640 pt in a column that allows ~740 and centred the whole layout with 125 pt of dead margin per side; portrait is width-bound (486 pt board) whatever the cap says.

  • One shared seam, consumed twice (896f2254): RegularBoardContainer + \.regularBoardContainer (fix(board): Minesweeper regular-width board viewport is capped to a 600 pt square and leaves the iPad board column empty in both orientations #1101) moved verbatim from MinesweeperUI into the zero-dependency GameShellUI; MinesweeperUI keeps reading it through its existing public import GameShellUI. The platform-default pins moved to GameShellUITests; MS keeps its fittedAlignment test.
  • Sudoku reads it (8c20dcaf, 8a788154): under .cappedDetailPane (macOS default) every modifier is argument-for-argument what it was (960 / 640 / centred). Under .fillsColumn (iOS default) the outer 960 cap and the board's 640 width cap lift to .infinity, the board's height cap stays nil (the frame hugs the fitted square), and the board frame aligns .leading: landscape becomes height-bound (board ≈ 740 pt on an 11-inch iPad, flush under the header title at x = 32, digit rail at the trailing edge, no dead side margin); portrait keeps its 486 pt board and the header/board/rail block stays vertically centred. The four mappings are pure static funcs pinned by BoardViewRegularContainerTests.
  • Store frames (121c91c8, 21fa699c): the ipad-13 03-board slot is still snapshot-sourced (chore(store): measure and publish the tolerant iPad 03-board captures (sim-bound remainder of #1054) #1110), so its 7 locale frames regenerate from the re-recorded baseline; the ipad-13 callout anchor and chip are re-measured.

Ruling: why Sudoku's .fillsColumn is .leading, not .top like Minesweeper

#1101 top-aligned Minesweeper's width-bound Beginner board because its iPad store frame improved. Here the first cut did the same (.topLeading, 8c20dcaf) and the regenerated Sudoku ipad-13 frame got worse: the fixed-fraction "Catches mistakes instantly" chip landed on grid rows 3–4 and the leader dot left the red cell, and the only free band for the chip would have needed a leader line across the whole grid. The PM ruled (contact point 2, 2026-10-28): the frame decides — Sudoku keeps the centre vertically. This is a ruling, not an inconsistency; change it only with a new frame in hand.

Measured (iPad Pro 11-inch (M5), iOS 26.5, -uitest-route board:showcase; grid = union of the 81 cell frames from the XCUITest a11y tree, pixel-verified against the screenshot)

Configuration Base 383b088 Head (this branch) Change
iPad landscape 1210×834 content width 1146 → 960 cap binds, stack at x 125–1085 (125 pt dead margin per side); column 676; board 640.5 (cap) at (124.8, 132.8)–(765.3, 773.3); cell 71.2; header Pause y 73 caps off; board 690.4 at (31.8, 107.8)–(722.2, 798.2), flush under "Easy" (x 32), height-bound; rail at the trailing edge x 918–1178; cell 76.7; header y 48; 35.8 pt below the board board +50 pt (+7.8 %), dead side margins 125 → 0, no vertical float
iPad portrait 834×1210 content width 770 (cap not binding); column 486; board 486.5 at (31.8, 397.8)–(518.3, 884.3); cell 54.1; header Pause y 261; rail top y 321 (77 pt above the board top: the rail hugged the top of the 640 pt reserved slot) board 486.5 at (31.8, 397.8)–(518.3, 884.3) — same place and size as base; cell 54.1; header Pause y 338 (block centred: header + 16 + board, no 640 reserved slot); rail top y 398 = board top (Undo/Redo 398, Notes 464, Erase 530, digits 596–846) board unchanged (width-bound); block still centred; rail top now level with the board top
iPhone 17 Pro 402×874 (control) compact, full-bleed board 392.5 at (4.8, 137.8)–(397.3, 530.3), cell 43.6; cluster y 539–824 not re-run: the compact layout does not read the seam, and the iPhone baseline is the same blob –
Mac (control) 900×600 baseline: board 509 at (53.5, 75.5)–(562.5, 584.5), neither cap binds same blob –

Mac control: the real macOS XCUITest run was blocked three times by the macOS Automation permission prompt ("Timed out while enabling automation mode", nobody at the machine) — not skipped. Substitutes: the committed 900×600 Mac baseline (board 509 pt, neither cap binds at that size) and the macOS-only, un-injected snapshotPencilNotesWithError_regularCapped_light at 1032×1376, which renders the Mac rule at the iPad size and keeps the pre-#1105 iPad PNG byte-for-byte (blob 8e825767).

iPhone and macOS did not move (mechanical proof)

  • MinesweeperKit full suite on 896f2254: Test run with 424 tests in 72 suites passed (fix(board): Minesweeper regular-width board viewport is capped to a 600 pt square and leaves the iPad board column empty in both orientations #1101 cited 416/71; the delta is main's intervening PRs, this branch's net is −2 tests moved to GameShellUITests). MS iPad PNG blob 37eb623d and MS regularCapped PNG blob 678fe533: git rev-parse HEAD:path == git hash-object path before and after the move. git diff --stat 383b0886..HEAD -- Packages/MinesweeperKit/Tests touches only RegularBoardContainerTests.swift (no PNG).
  • GameShellKit --filter RegularBoardContainer: 2 tests pass; flipping platformDefault's #else branch to .fillsColumn turns it red (M2) and also turns snapshotPencilNotesWithError_regularCapped_light red — that test is macOS-only and un-injected on purpose, so the un-injected default resolving to the Mac rule is pinned by a pixel baseline, not only by the unit test.
  • SudokuKit on the final code (8a788154): BoardViewTests|BoardViewPencilNotesTests|BoardViewRegularContainerTests 28 tests / 3 suites passed; Board|Completion|Banner|Digit|Pause 174 / 46 passed; HomeView|TodayTab|DailyHub|PracticeHub|Progress|Toast|Resume 149 / 29 passed; SettingsViewTests 15 and SettingsViewAppStoreRowsTests 4 passed alone (SettingsViewWindowSnapshotTests skipped, test(macos27): SettingsViewWindowSnapshotTests crashes swiftpm-testing-helper (SIGSEGV in objc_release) when run alone #1103 crash; the full SudokuKit suite is a known local segfault, so filters are the verification).
  • git diff --stat 383b0886..HEAD lists no *Mac* or *iPhone* PNG under SudokuUITests; the 7 Mac board baselines + the iPhone in-progress baseline hash-match HEAD on disk after every run.
  • Mutations on the final code: regularBoardAlignment .fillsColumn → .center turns the unit test and the new landscape baseline red while both portrait iPad baselines stay green (at 1032×1376 the column width equals the board width, so a horizontal flip changes no portrait pixel — hence the landscape pin); regularBoardMaxHeight .fillsColumn → .infinity (the greedy-frame bug of the first ruling-B cut) turns both portrait baselines + the unit test red. Round 1's stack-level top-pin was caught the same way: its mutation changed no pixel.

iPad baselines (rendered vs rendered, base 383b088 → head)

Baseline 383b088 HEAD What changed (rendered vs rendered)
Board-iPad-light-inProgress (1032×1376) fedcfb2c 5d200ce8 board 640 (cap) → 684 (column width), block still centred
Board-iPad-light-pencilNotesWithError (1032×1376, feeds the ipad-13 03-board slot) 8e825767 88ca8eb8 same: 640 → 684, header/board/rail centred as one block, rail top level with board top
Board-iPadLandscape-light-pencilNotesWithError (1376×1032, new) – 1ce9fde0 landscape pin: board 941 pt height-bound at x = 32 (pixel scan x 31.5–972.5, y 75.5–1016.5)
Board-Regular-light-pencilNotesWithError-cappedDetailPane (1032×1376, macOS-only, un-injected) – 8e825767 the OLD iPad PNG moved byte-for-byte via git mv; passes without re-record = the Mac rule renders pixel-identically at the iPad size

Store frames

mise run store:screenshots build-ascspec: 168 slots, 0 failures, exactly the 7 sudoku/ipad-13/*/03-board.png frames changed (every other frame byte-identical). The ipad-13 callout for this slot is snapshot-sourced (#1110) and placed by fixed fractions, so it was re-measured: anchor (0.207, 0.315) → (0.214, 0.301) (reddish-pixel bbox of the new baseline's red cell), chip (0.360, 0.210) → (0.360, 0.165) (the 684 board floats the header ~22 pt higher; at 0.210 the chip sat level with the header row). mise run scan:store_frame_drift → PASS without the frame-drift-verified label. Before/after (en): evidence-1105/ipad13-03-board-before-after-en.png — base left (640 board, card cut at the frame's bottom edge), head right (684 board, whole card visible, dot on the red 4, chip in the band above the header). The frame stays #1054-affected (Liquid Glass digit keys invisible to the snapshot renderer).

iPad portrait — measured numbers and options (not implemented; owner's ruling)

Measured on iPad Pro 11-inch (M5), 834×1210 pt (-uitest-route board:showcase, a11y grid pixel-verified):

Board Cell Where the blank goes
base (383b088) 486.5 (width-bound: 834 − 2×32 margin − 24 gap − 260 rail = 486) 54.1 split: 261 pt above the header (incl. 24 status bar), 326 pt below the board — the regular stack is vertically centred
after this PR (.fillsColumn, ruling B) 486.5 (unchanged — the caps were never binding at this width) 54.1 still split above/below: the block (header + board + rail) centres as one; the rail top is now level with the board top (base had the rail hugging the top of a 640 pt reserved slot, 77 pt above the board)

A square board cannot grow in a 486-pt-wide column however tall it is; every option that enlarges the portrait board has to take width back from the 260 pt side rail.

P0 — accept the split blank (what this PR ships, PM ruling B). Board 486 / cell 54, block centred. Cost 0; the shipped ipad-13 frame keeps its composition (see Ruling above).

P1 — route iPad portrait to the stacked arrangement (board above the shared G4 control cluster), keeping the regular 32 pt margins. Board = 834 − 64 = 770 (cell 85.6, +58%). Height budget from the iPhone control: status bar 24 + header 44 + 16 + board 770 + 16 + cluster 285 (Undo/Redo/Notes/Erase row 58 + 3×3 digit grid 226 at iPhone sizes) + 16 bottom + home 20 ≈ 1191 of 1210 — it fits with ~19 pt to spare, so with an ad banner (≥50 pt) the compact fit logic shrinks the board to ≈720 (cell 80). Needs an orientation/width seam in BoardView.body (today the only selector is horizontalSizeClass == .regular), and a design pass on the G4 cluster at 770 wide (its cell table in design.md §3.4 is three iPhone widths). Landscape keeps the two-column layout from this PR.

P2 — keep the two-column layout but narrow the rail in portrait (e.g. a 2-column digit grid at 88-pt keys = 184 + gap 24): board = 770 − 24 − 184 = 562 (cell 62.4, +16%), blank below ≈ 520 pt. Small gain, still a mostly-empty column, and a third digit-pad arrangement to maintain.

Recommendation: P1. It is the only option that uses the portrait height (board +58%), it reuses the existing compact layout and the shared control cluster instead of adding a third arrangement, and Minesweeper would get the same routing for free through the mirror principle. The banner caveat (≈720 with an ad) and the G4-at-770-wide design question are the two things the owner has to accept before anyone builds it. P0 is what ships here; P1/P2 are not implemented.

Evidence

Local, durable (not committed): /Users/zw/GitHub/Wei18/evidence-1105/ — base-ipad/, base-iphone/, base-mac/, head-ipad/ (probe logs, *.json parsed frames, *.png), head-renders/, head-snapshots/, base-frames/, head-frames/, tools/, Probe1105.swift.archive (throwaway XCUITest probe, never committed).

Review

Code Reviewer mandatory (shared UI code, > 50 LOC): two independent reviews + fresh-context T6 acceptance posted as PR comments. PM merges; no auto-merge.

🤖 Generated with Claude Code

@wei18

wei18 commented Nov 10, 2026

Copy link
Copy Markdown
Owner Author

T6 acceptance (fresh context)

驗收員:fresh-context subagent(隔離 worktree,與 session/sudoku-ipad-board-1105 其他 worktree 完全不共用磁碟)。
Head 核對:gh pr view 1115 --json headRefOid → 497361261eb5992c3a96a0be3ab6edff94f7641e,與預期 49736126 一致,符合後判。
機器時間:開始 02:18,結束 02:24,約 6 分鐘(重工作全數跑完,未碰到 25 分鐘停新工作門檻)。

跑過並通過的檢查:1, 2, 3, 4, 5(含突變), 6(含 build-ascspec 重現), 7, 8, 10
跑過但不可能失敗的檢查:(無——每條都有可證偽的失敗模式)
沒跑的檢查:9 的「裝置即時量測」部分(見下)


1. 共用 seam,一份實作 — PASS

git grep -n "enum RegularBoardContainer\|var regularBoardContainer: RegularBoardContainer" 49736126 -- Packages
49736126:Packages/GameShellKit/Sources/GameShellUI/RegularBoardContainer.swift:27:public enum RegularBoardContainer: Sendable, Equatable {
49736126:Packages/GameShellKit/Sources/GameShellUI/RegularBoardContainer.swift:59:    var regularBoardContainer: RegularBoardContainer {

各一處,都在 Packages/GameShellKit/Sources/GameShellUI/。
git show 49736126:Packages/MinesweeperKit/Sources/MinesweeperUI/RegularBoardContainer.swift → fatal: path ... does not exist(exit 128),確認 MS 無本地副本;git diff --name-status 4461a6dc...49736126 顯示該檔是 D(刪除),對應 seam 搬遷。
這條偵測不到:型別定義一次是否「語意正確」(例如邏輯寫錯但仍只一處)——那是第 4、5 條的事。

2. Minesweeper 行為不變(blob 等同) — PASS

git rev-parse 4461a6dc:…snapshotBeginnerCovered_iPad_light…png   → 37eb623de80ce49967c13fa7c69d2052747644f2
git rev-parse 49736126:…snapshotBeginnerCovered_iPad_light…png   → 37eb623de80ce49967c13fa7c69d2052747644f2  (相同)
git rev-parse 4461a6dc:…snapshotBeginnerCovered_regularCapped_light…png → 678fe533c44feeca3bdb48b3076fcc3f66e72f73
git rev-parse 49736126:…snapshotBeginnerCovered_regularCapped_light…png → 678fe533c44feeca3bdb48b3076fcc3f66e72f73  (相同)

git diff --name-only 4461a6dc...49736126 -- Packages/MinesweeperKit 只有兩個 .swift 檔(RegularBoardContainer.swift、RegularBoardContainerTests.swift),不含任何 PNG/TXT。
這條偵測不到:未入 git 的執行期行為差異(例如動畫時序)——不在本次範圍內。

3. Mac 與 iPhone 基準不動 — PASS

git diff --name-only 4461a6dc...49736126 -- 'Packages/SudokuKit/Tests/SudokuUITests/__Snapshots__' 完整清單(4 個檔):

.../BoardViewPencilNotesTests/snapshotPencilNotesWithError_iPadLandscape_light...png
.../BoardViewPencilNotesTests/snapshotPencilNotesWithError_iPad_light...png
.../BoardViewPencilNotesTests/snapshotPencilNotesWithError_regularCapped_light...png
.../BoardViewTests/snapshotInProgress_iPad_light...png

4 個全含 iPad 或 Regular,0 個含 Mac 或 iPhone。

4. capped 路徑逐字不變 — PASS

git show 4461a6dc:…BoardView+Layout.swift 與 git show 49736126:… 的 diff(已存 /tmp/evid_layout_base.swift / _head.swift):

  • regularOuterMaxWidth(for: .cappedDetailPane) = macOuterMaxWidth = 960
  • regularBoardMaxWidth(for: .cappedDetailPane) = macBoardMaxSide = 640
  • regularBoardMaxHeight(for: .cappedDetailPane) = macBoardMaxSide = 640
  • regularBoardAlignment(for: .cappedDetailPane) = .center
  • stack frame 兩處 .frame(maxWidth: .infinity, alignment: .center) / .leading 行號平移(79→85, 116→173)但內容逐字未變。
    機械證據:
git rev-parse 49736126:…snapshotPencilNotesWithError_regularCapped_light…cappedDetailPane.png → 8e82576771abcf8f5523b8d8cb87e9d1cfedc99a
git rev-parse 4461a6dc:…snapshotPencilNotesWithError_iPad_light…png                            → 8e82576771abcf8f5523b8d8cb87e9d1cfedc99a  (相同)

5. 平台預設被釘住且可變紅(重工作,實跑) — PASS

綠批:

swift test --package-path .../Packages/SudokuKit --filter "BoardViewTests|BoardViewPencilNotesTests|BoardViewRegularContainerTests"
Test run with 28 tests in 3 suites passed after 2.339 seconds.

無 skipped;逐一確認四支新增/相關測試都出現在 started/passed 清單裡:snapshotPencilNotesWithError_iPadLandscape_light、snapshotPencilNotesWithError_regularCapped_light、以及 BoardView regular-width container (#1105) 套件下的 4 支(regularOuterMaxWidth…/regularBoardMaxWidth…/regularBoardMaxHeight…/regularBoardAlignment…)全部 passed,无一在 skipped。

突變(Packages/GameShellKit/Sources/GameShellUI/RegularBoardContainer.swift 的 platformDefault #else 分支 .cappedDetailPane → .fillsColumn)後重跑同一 filter:

Test snapshotPencilNotesWithError_regularCapped_light() failed after 3.345 seconds with 1 issue.
🔴 Snapshot "Board-Regular-light-pencilNotesWithError-cappedDetailPane" does not match reference.
Test run with 28 tests in 3 suites failed after 3.346 seconds with 7 issues.

如預期變紅(連帶其餘 4 個 Mac snapshot 也紅,屬合理副作用,因為突變改的是全平台預設值)。已 git checkout -- 還原,git status --porcelain 空(確認無殘留)。
alignment 突變(brief 說已由獨立 CR 跑過)本次因時間充足但優先序排在 6/7 之後,沒跑——不影響本條 PASS 判定,但不計入「跑過」。

6. frame 與基準一致 — PASS(三部分全跑)

a) git diff --name-only 4461a6dc...49736126 -- docs/ 恰 7 個檔,一個不少、沒有別的 app/device/slot:

docs/app-store/screenshots-ascspec/sudoku/ipad-13/{en,es,ja,ko,th,zh-Hans,zh-Hant}/03-board.png

b) mise run scan:store_frame_drift --base 4461a6dc →

PASS [store_frame_drift]: every store frame fed by a changed baseline was regenerated in this diff.

PR 無 label(gh pr view 1115 --json labels 空陣列),commit body 無 Frame-Drift-Verified(grep 無命中)。
c) 重工作,實跑 mise run store:screenshots build-ascspec:

Total: 168 slots processed | Generated: 168 | Skipped: 0 | Failures: 0

隨後 git status --porcelain docs/ 空——PR 內 7 張 frame 正是生成器的輸出,逐 byte 重現。

7. frame 用眼睛判 — PASS

裁 en、ja 的 03-board.png(高度 20–60% 帶)Read 後目視:

  • en:白色引線終點落在紅色「4」格中心;"Catches mistakes instantly" chip 位於 header 上方的米色空帶,不碰格線也不碰 header 文字("Notes the way..." 標題在帶外被裁掉上緣,屬裁切範圍正常現象)。
  • ja:同一構圖,chip 文字「ミスをその場で検出」清晰無豆腐(無缺字方塊),白點同樣落在紅色「4」格上。

8. PR 不會誤關別的 issue — PASS

Closes 類字串只出現一次、且是 Closes #1105(commit bodies + PR body 合併 grep (fix|close|resolve)[sd]? +#[0-9]+ 僅 1 命中)。
PR body + commit 中出現的全部 #NNN:#1014 #1054 #1101 #1103 #1105 #1110,逐一 gh issue view:

#1014 OPEN  chore(v3): epic — Sudoku + Minesweeper 3.0 UI (Liquid Glass restructure)
#1054 OPEN  blocker(store): ASC 03-board frames cannot render Liquid Glass …
#1101 CLOSED fix(board): Minesweeper regular-width board viewport is capped …
#1103 OPEN  test(macos27): SettingsViewWindowSnapshotTests crashes …
#1105 OPEN  fix(board): Sudoku regular-width board inherits the 960/640 Mac caps …
#1110 OPEN  chore(store): measure and publish the tolerant iPad 03-board captures …

全部存在,無虛構編號。

9. 明說「這個 PR 不改變什麼」 — 部分 PASS / 部分無法驗證

可機械驗證、已驗證的「不變」:

  • iPhone compact layout:check 2(MS 全部 PNG 零變動)+ check 3(Sudoku 的 4 個變動快照全不含 iPhone)共同證明本 PR 未動到任何 iPhone/compact 基準。
  • Mac:check 3 同樣證明 0 個 Mac 基準變動;.cappedDetailPane 四個數值(960/640/640/.center)逐字比對 base/head 完全相同(check 4),且 regularCapped 的 macOS-only、un-injected 快照是 base 的 iPad PNG git mv 過去的逐 byte 複本(blob 8e825767 相同),機械上證明「Mac 規則在 iPad 尺寸下渲染結果不變」這個等式成立。
    無法驗證(本次沒跑):PR body 聲稱的裝置即時量測(iPad 直向 base/head 的 grid 都在 (31.8, 397.8)、cell 54.1 等數字)需要跑 XCUITest + 真機/模擬器量測,30 分鐘機時預算內未排進此項,沒跑,無法獨立覆核這組像素座標;同樣,PR body 聲稱「Mac 的 XCUITest 控制組被 macOS Automation 權限提示擋住 3 次(非略過)」這句話本身也無法在本次驗收環境裡重現驗證(沒有互動式權限視窗可操作),只能說它與「Mac 基準 0 PNG 變動」這一機械事實不矛盾,不構成對該句主張本身的獨立證據。

10. diff 範圍內 TODO/FIXME/stub/placeholder — PASS(無命中,無需比對)

git diff 4461a6dc...49736126 | grep -nE 'TODO|FIXME|stub|placeholder'

零輸出,無需對照 PR body 交代。


總判定:ACCEPT

條件 1–8、10 全數機械驗證 PASS(含兩項重工作:SudokuKit 篩選批次綠 + 平台預設突變正確變紅且已復原;build-ascspec 168/168 重現 docs/ 內容逐 byte 相同)。條件 9 的裝置即時量測數字本次未重新量測(時間預算優先序排在重工作 5、6 之後,且量測需要互動式模擬器操作,不在 30 分鐘機時內可完成的範圍),這是驗收覆蓋的已知缺口,非 FAIL——與之矛盾的機械證據一項也沒有,且 PR body 本身已明確區分「量測」與「未實作」兩類數字。建議:若要完全閉環,另排一次 XCUITest 量測覆核(可在合併後或下一個驗收週期補跑,不阻塞本次合併)。

@wei18

wei18 commented Nov 10, 2026

Copy link
Copy Markdown
Owner Author

Code review (independent) — APPROVE-WITH-NITS

Scope: head 49736126, base 4461a6dc. This review covers the diff on its merits plus two independent mutations. It does not repeat the blob proofs, the drift gate, build-ascspec reproduction, or the frame eyeballing already posted in the ## T6 acceptance (fresh context) comment — see that comment for those.

Diff review

The seam move is clean. Packages/GameShellKit/Sources/GameShellUI/RegularBoardContainer.swift is byte-identical in code to the old Packages/MinesweeperKit/Sources/MinesweeperUI/RegularBoardContainer.swift; a direct diff of the two blobs shows only comment text changed (expanded to describe both games and the #1105 move), confirmed with git diff 4461a6dc:...MinesweeperUI/RegularBoardContainer.swift 49736126:...GameShellUI/RegularBoardContainer.swift. The platformDefault switch, the EnvironmentKey, and the Sendable/Equatable enum are untouched.

BoardView+Layout.swift adds three nonisolated static func mappings (regularOuterMaxWidth, regularBoardMaxWidth, regularBoardMaxHeight, regularBoardAlignment) that read as straightforward switch-over-RegularBoardContainer tables, each exhaustive with no default case, so a future third case fails to compile instead of silently defaulting. BoardView.swift's only change is the new @Environment(\.regularBoardContainer) var regularBoardContainer line, marked internal to match sizeClass, which is exactly the minimal surface needed by the sibling file.

The ruling-B divergence from Minesweeper's #1101 pattern is real but is stated as a ruling with its own rationale and an explicit exit condition: regularBoardMaxHeight leaves the fillsColumn case nil (not .infinity, unlike MS's macBoardFrameMaxSide) specifically so the whole regular stack keeps centring as a block in portrait, with the comment noting "change only with a new frame in hand." That is a legitimate, documented exception to the mirror principle rather than an unexplained drift, and it is backed by a dedicated unit test (BoardViewRegularContainerTests) and a landscape snapshot pin that exercises the one case where .center vs .leading is visible on a rendered pixel.

Test placement is sound: the platform-default/un-injected-default pins moved to GameShellUI.RegularBoardContainerTests, and MinesweeperKit's sibling test correctly kept only the MS-specific fittedAlignment mapping, with a comment pointing at the new home. Sudoku's new BoardViewRegularContainerTests mirrors that split for the four Sudoku-specific mapping functions. The #if os(macOS) guard on snapshotPencilNotesWithError_regularCapped_light is justified in its own doc comment: it pins the pre-#1105 iPad baseline PNG (moved byte-for-byte) as proof the capped-Mac-rule rendering is unchanged now that iPad's default flipped to .fillsColumn, and that proof is inherently about this process's un-injected platform default, so macOS-only is correct, not an accidental omission of iOS coverage.

The landscape pin's own comment states why it is the only baseline where the .center/.leading difference is visible on a rendered pixel (portrait's column width already equals the board width). The extracted pencilNotesWithErrorViewModel() static fixture is a clean, behavior-preserving dedup across the four call sites that previously repeated the same board/notes construction verbatim.

Nits

  • Packages/SudokuKit/Tests/SudokuUITests/BoardViewTests.swift and Packages/SudokuKit/Tests/SudokuUITests/SnapshotConfig.swift both sit at exactly 400 lines, SwiftLint's default file_length warning threshold. Neither trips the lint today (the rule fires above, not at, 400), but either file is one small addition away from a warning. Worth a heads-up for the next PR that touches them.
  • BoardViewTests.swift's top-of-file doc comment was reflowed into two ~150-char lines (from several shorter ones) as a side effect of the edit. Both stay under the repo's 160-char line-length warning, so this is cosmetic, not a lint risk.

No correctness, concurrency, or consistency issues found. Swift 6 strict-concurrency shape (nonisolated statics, Sendable enum, no actor-isolation leaks) is consistent with the rest of the module.

Mutation evidence (independently re-run, warm SudokuKit build cache, filter BoardViewTests|BoardViewPencilNotesTests|BoardViewRegularContainerTests)

Baseline (unmodified head):

Test run with 28 tests in 3 suites passed after 5.284 seconds.

M-align (regularBoardAlignment, .fillsColumn: .leading → .center):

Test "regularBoardAlignment maps cappedDetailPane to center and fillsColumn to leading" failed after 0.004 seconds with 1 issue.
Test snapshotPencilNotesWithError_iPadLandscape_light() failed after 2.541 seconds with 1 issue.
Test run with 28 tests in 3 suites failed after 2.542 seconds with 2 issues.

snapshotInProgress_iPad_light and snapshotPencilNotesWithError_iPad_light (both portrait) stayed green — exactly as expected, since portrait's column width already equals the board width so the horizontal-alignment flip is invisible there. Reverted with git checkout --; git status --porcelain back to only ?? run_bounded.sh.

M-height (regularBoardMaxHeight, .fillsColumn: nil → .infinity):

Test "regularBoardMaxHeight maps cappedDetailPane to 640 and fillsColumn to nil" failed after 0.005 seconds with 1 issue.
Test snapshotInProgress_iPad_light() failed after 2.619 seconds with 1 issue.
Test snapshotPencilNotesWithError_iPad_light() failed after 2.619 seconds with 1 issue.
Test run with 28 tests in 3 suites failed after 2.620 seconds with 3 issues.

snapshotPencilNotesWithError_iPadLandscape_light stayed green, as expected (landscape is already height-bound so lifting the nil cap to .infinity changes nothing there). Reverted with git checkout --; working tree confirmed clean again.

Final git -C <worktree> status --porcelain: only ?? run_bounded.sh. No time remained before the 02:45 deadline for an extra green re-run after the second mutation; both mutation reverts were verified individually (the file-state notice after each git checkout -- echoed the pre-mutation content back, matching the original diff byte-for-byte).

What I did not re-run myself

Per the dispatch, I relied on the prior fresh-context T6 acceptance comment for: the blob-identity proof methodology (I independently re-ran a trimmed version of the same check and got the same result above), the drift gate, the build-ascspec-screenshots.py reproduction, the platformDefault mutation, and the 03-board frame eyeballing (anchor/chip placement for the re-measured iPad callout). See that PR comment for those.

Verdict

APPROVE-WITH-NITS. The seam move is a genuine shared extraction with no behavioral drift, the ruling-B divergence from the MS pattern is deliberately scoped and tested, both requested mutations reproduce exactly the expected red/green split, and the working tree is clean. The two nits above (file-length headroom, one comment reflow) are not blocking.

wei18 and others added 5 commits November 13, 2026 21:57
…games share the seam

The #1101 regular-width board-container seam (`RegularBoardContainer` +
`\.regularBoardContainer`) lived in MinesweeperUI. Sudoku has the identical
Mac-detail-pane cap defect on iPad (960/640), and the mirror principle says one
shared implementation, so the type moves verbatim into the zero-dependency
GameShellUI target; MinesweeperUI already `public import GameShellUI` and keeps
reading it unchanged. The platform-default pins move to GameShellUITests; the
MS-specific `fittedAlignment` mapping test stays in MinesweeperUITests.

Minesweeper is provably untouched: the iPad and regularCapped board baselines
are the same git blobs before and after (37eb623 / 678fe53), and the full
MinesweeperKit suite passes (424 tests in 72 suites).

part of #1105

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…nstead of inheriting the Mac caps

Sudoku `BoardView.macLayout` is selected by `horizontalSizeClass == .regular`,
so iPad inherited the Mac detail-pane caps (outer 960 pt centred, board 640 pt
square). Measured on an iPad Pro 11-inch (M5) simulator: landscape held the
board at 640 pt in a column that allows ~686 and centred the layout with 125 pt
of dead margin per side; portrait floated the whole stack vertically centred
(261 pt above the header, 326 below the board).

The layout now reads the shared `\.regularBoardContainer` seam (GameShellUI):
- `.cappedDetailPane` (macOS default): every modifier argument-for-argument as
  before — 960 / 640 caps, centred stack. Mac baselines are the same blobs.
- `.fillsColumn` (iOS default): both caps lift to `.infinity`, and the board
  frame aligns `.topLeading`, so the fitted square sits flush under the header
  at the column leading edge with leftover height below it (PM ruling, same
  shape as #1101 for Minesweeper). The three mappings are pure static funcs
  pinned by `BoardViewRegularContainerTests`.

Tests: the two iPad board snapshots inject `.fillsColumn` and are re-recorded
(rendered vs rendered: board 640 → 684 pt at 1032×1376, top-left instead of
centred). `snapshotPencilNotesWithError_regularCapped_light` (macOS-only,
un-injected) keeps the pre-#1105 iPad PNG byte-for-byte (blob 8e82576) and
passes without re-recording; flipping `platformDefault` macOS branch turns it
red. `emit_iPad_board` injects `.fillsColumn` like Minesweeper. Mutating the
fillsColumn alignment to `.center` turns both iPad snapshots and the unit test
red. iPhone + Mac board baselines unchanged (same blobs).

part of #1105

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…ills-column board

The ipad-13 03-board slot is still snapshot-sourced (its live capture is
deferred to #1110), so the re-recorded Board-iPad-light-pencilNotesWithError
baseline changes the composited frame. `mise run store:screenshots
build-ascspec`: 168 slots, 0 failures; exactly these 7 frames changed, every
other frame byte-identical.

part of #1105

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…M ruling B) and pin landscape

Ruling B on #1105 (contact point 2, 2026-10-28): the first cut aligned the
fills-column board `.topLeading`, and the regenerated ipad-13 03-board frame
got worse — the fixed-fraction callout chip landed on grid rows 3–4 and the
leader dot left the red cell, with no free band for the chip that would not
need a line across the whole grid. #1101 top-aligned Minesweeper because its
frame improved; Sudoku keeps today's centred block because its frame says so.

Under `.fillsColumn` only the 640 pt WIDTH cap lifts; the height cap stays
`nil`, so the board frame hugs the fitted square instead of going greedy and
the header / board / rail stack centres as one block in portrait exactly as
before (lifting both caps pinned the header and rail to the top and floated
the board alone — pinned red by mutation M3). `.leading` keeps the board flush
under the header title in landscape, where the square is height-bound.

Tests: the three mappings (outer width, board max width, board max height,
alignment) are pinned by `BoardViewRegularContainerTests`; new landscape
baseline `snapshotPencilNotesWithError_iPadLandscape_light` (1376×1032,
`.fillsColumn`, board 941 pt height-bound at x = 32) — the only baseline where
leading-vs-centre is visible, red under the alignment mutation while the
portrait baselines stay green. Portrait iPad baselines re-recorded (board 684
pt, block centred). `_regularCapped_` PNG still blob 8e82576; Mac + iPhone
board baselines unchanged.

part of #1105

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…nerate the frames

The re-recorded Board-iPad-light-pencilNotesWithError baseline (board 684 pt,
block centred) moves the red error cell and the floating header: anchor
re-measured from the reddish-pixel bbox (0.207, 0.315) → (0.214, 0.301), chip
raised (0.360, 0.210) → (0.360, 0.165) so it sits in the empty band above the
header instead of level with the header row. `mise run store:screenshots
build-ascspec`: 168 slots, 0 failures; exactly the 7 sudoku/ipad-13/*/03-board
frames changed; `scan:store_frame_drift` PASS without the label.

part of #1105

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@wei18
wei18 force-pushed the session/sudoku-ipad-board-1105 branch from 4973612 to 3c9c4bb Compare November 13, 2026 13:58
@wei18

wei18 commented Nov 13, 2026

Copy link
Copy Markdown
Owner Author

PM merge record, head 3c9c4bbf. Gate satisfied: fresh-context acceptance 總判定:ACCEPT and an independent code review APPROVE-WITH-NITS, both against 49736126. I verified the rebase did not invalidate them: git diff 49736126 3c9c4bbf is .github/workflows/lint.yml alone — #1117's already-merged CI pin arriving from main — and nothing else, so the reviewed trees are byte-identical to what is merging.

What changes. On iPad, Sudoku's regular-width board stopped inheriting the Mac detail-pane caps. Measured on the simulator, pixel-verified: landscape board 640.5 → 690.4 (cells 71.2 → 76.7), the 125 pt dead margin on each side is gone, and the board sits flush under the header with the rail at the trailing edge. Portrait is deliberately unchanged in size and position.

Ruling B, and why it differs from #1101. #1101 top-aligned a width-bound Minesweeper board. Applying that here put the "Catches mistakes instantly" chip on top of the grid's rows 3–4 with its leader dot on an empty cell — the shipped ipad-13 03-board frame would have been worse than today's. So .fillsColumn aligns .leading and portrait keeps its vertical centring. The frame decided it; the PM compared the composites directly, before and after. That is recorded in the PR and in the layout comment so it reads as a ruling, not an inconsistency.

The shared seam moved, and Minesweeper is provably untouched: RegularBoardContainer now lives in GameShellUI and both apps read it — one implementation, per the mirror principle. Minesweeper's two baselines are the same git blobs before and after (37eb623d, 678fe533), and its suite is 424 tests / 72 suites green.

macOS keeps 960 / 640, argument-for-argument: 7 Mac plus 1 iPhone baseline unchanged as blobs, and the un-injected _regularCapped_ sibling preserves the old iPad PNG byte-for-byte (8e825767).

Mutations, run by the reviewers rather than the author: .leading → .center turns the new landscape baseline red while portrait stays green; the .fillsColumn height cap → .infinity turns both portrait baselines red while landscape stays green; flipping platformDefault's macOS branch turns the capped sibling red. An earlier round pinned alignment on the stack instead of the board — a no-op that one of these mutations exposed.

Frames: the 7 sudoku/ipad-13 03-board frames regenerated, callout anchor and chip re-measured, and this is the first PR to exercise #1113's new per-slot drift gate on a real baseline change — it passes without the escape label.

Not covered: the device numbers were measured by the author, not re-measured by the reviewers; the Mac XCUITest control was blocked by the macOS Automation prompt and is stated as blocked, not skipped. The portrait proposal (P0 ships, P1 recommended with its banner caveat) is in the PR body for the owner.

@wei18
wei18 merged commit d6942e6 into main Nov 13, 2026
7 checks passed
@wei18
wei18 deleted the session/sudoku-ipad-board-1105 branch November 13, 2026 14:02
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.

fix(board): Sudoku regular-width board inherits the 960/640 Mac detail-pane caps on iPad

1 participant