Skip to content

refactor(mirror): unify SettingsView wrapper + Root.plist into one shared source - #838

Merged
wei18 merged 1 commit into
mainfrom
refactor/832-settings-convergence
Jul 16, 2026
Merged

wei18 merged 1 commit into
mainfrom
refactor/832-settings-convergence

Conversation

@wei18

@wei18 wei18 commented Jul 16, 2026

Copy link
Copy Markdown
Owner

What

Closes #832 — the two per-app SettingsView wrappers had structurally diverged (Sudoku VM-driven with bootstrap + generator About row vs MS primitive params, the exact #448 drift class). Now ONE shared GameAppKit.SettingsView<Banner> + SettingsViewModel; per-app files reduced to 2-line typealias shims. Settings.bundle Root.plist is single-sourced from App/Shared/ via a gen:settings_root byte-copy task wired into tuist generate + CI post-clone.

Shape

  • Landed in GameAppKit (needs MonetizationUI/GameCenterClient/Persistence/Telemetry — SettingsKit's near-zero-dep ban rules it out; zero NEW dependency edges, all products already declared).
  • Per-game config: generatorVersionLabel: String? (Sudoku passes GeneratorVersion.v1.rawValue, MS omits → row absent, matching prior behavior); the row itself is a new dep-free SettingsUI.SettingsAboutExtraRow.
  • MS converges to the richer shape (gains VM + bootstrap — a no-op today since MS's saves live in its own store; verified in code). MS's near-duplicate clearCache free function deleted; its 2 tests replaced 1:1 by SudokuKit tests exercising the identical shared class (326→324 accounted).
  • Root.plist: two 'elegant' mechanisms tried and empirically disproven (second Tuist resource entry → 'Multiple commands produce'; tracked symlink → Copy Bundle Resources preserves symlinks verbatim, broken in the built .app) — byte-copy codegen chosen; silent-drift scan gate tracked in the follow-up issue filed from review.

Review

Dual CR. Mechanical: 10/10 PASS. Adversarial: REQUEST_CHANGES on one docs defect — three comments (.gitignore + 2× Project.swift) still called the copies 'symlinks', an intra-PR contradiction that would mislead the next editor into a silently-discarded edit; fixed Leader-inline (all three now say byte-copy + edit-the-shared-source warning), tuist generate re-verified after amend. All code claims independently reproduced: mirror fidelity line-by-line (zero Sudoku behavior change, Sudoku baselines byte-identical, zero PNG churn), layer placement, typealias compatibility, test accounting, CI ordering. Reviewer also confirmed the PersistenceKit 'revert' visible in a stale-base diff is an artifact (branch cut one commit behind; disjoint files, squash-merge safe).

Verification

SudokuKit Settings 43/43 + Composition 31/31 · SettingsKit 49/49 · GameAppKit 43/43 · MinesweeperKit 324/324 --no-parallel · scan:l10n green · swiftlint --strict clean · tuist generate + real xcodebuild build succeed with Root.plist landing correctly beside LicensePlist output.

🤖 Generated with Claude Code

…dle Root.plist into one shared source

SettingsView + SettingsViewModel had structurally diverged (Sudoku was
VM-driven with a bootstrap task; Minesweeper took primitive version:/
clearCache: params and duplicated the clear-cache logic as a free function
on LiveRouteFactory). Both now live once in GameAppKit as GameAppKit.SettingsView
/ SettingsViewModel — the "shared composition, deps allowed" layer, since the
wrapper needs Persistence/MonetizationUI/GameCenterClient that SettingsKit
(near-zero-dep) must not import. SudokuUI/MinesweeperUI keep thin generic
typealiases so existing call sites stay source-compatible. The Sudoku-only
Generator row is now a genuinely per-game config value
(SettingsViewModel.generatorVersionLabel: String?, replacing the SudokuEngine-
typed GeneratorVersion field) rendered via the new shared
SettingsUI.SettingsAboutExtraRow building block. Minesweeper gains the VM's
bootstrap()/clearCache() seam it had drifted away from (a behavior no-op today
since its latestInProgress() still returns nil, matching prior documented
parity-only behavior).

Root.plist (the Settings.bundle entry point LicensePlist never writes) is
single-sourced at App/Shared/Settings.bundle/Root.plist; a new
gen:settings_root mise task re-syncs byte-identical copies into both apps'
own Settings.bundle before every tuist generate (wired into
mise-tasks/tuist/generate + ci_post_clone.sh) so a stale/hand-edited per-app
copy can't survive the next generate. Two alternative mechanisms were tried
and reverted after a local xcodebuild reproduced real failures: a second
Tuist resource entry pointing straight at the shared path collides with
Xcode's "Multiple commands produce" once license-plist's per-app output
exists alongside it; a tracked symlink resolves fine in the checkout but
ships broken (Xcode's Copy Bundle Resources preserves symlinks verbatim
instead of dereferencing them).

Sudoku's snapshot baselines stay byte-identical (verified — the shared VM's
generatorVersionLabel default is nil, so Sudoku's test fixtures now pass
GeneratorVersion.v1.rawValue explicitly, matching production's LiveRouteFactory
wiring). Minesweeper's LiveRouteFactory.clearCache free function + its
ClearCacheFeedbackTests are removed (redundant with the shared VM's own
coverage in SudokuKit's SettingsViewTests, now exercising the identical
class).

Closes #832

Co-Authored-By: Claude Fable 5 <[email protected]>
@wei18
wei18 enabled auto-merge (squash) July 16, 2026 16:24
@wei18
wei18 merged commit abbbbb3 into main Jul 16, 2026
4 checks passed
@wei18
wei18 deleted the refactor/832-settings-convergence branch July 16, 2026 16:25
@wei18 wei18 mentioned this pull request Jul 17, 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.

refactor(mirror): unify Sudoku/MS SettingsView wrapper + Settings.bundle Root.plist into one shared source

1 participant