Repository navigation
refactor(persistence): inject per-app CK identifiers via PrivateCKConfig - #219
Merged
Merged
Conversation
Extract `zoneName` / `subscriptionID` from `PrivateCKConstants` (Sudoku- hardcoded) into a new `PrivateCKConfig` value-type injected at the `LivePersistence` / `LivePrivateCKGateway` boundary. `PrivateCKConfig.sudoku` holds the original strings — Sudoku's `AppComposition.Live` passes it explicitly. Required (no default) so a second consumer (Minesweeper, planned in `meetings/2026-05-31_minesweeper-rfc.md`) cannot accidentally bind to Sudoku's CKContainer zone. Record-type names (`SavedGame` / `PersonalRecord` / `MonetizationState`) stay in `PrivateCKConstants` — they're scoped to each app's CKContainer and thus safe to share verbatim across apps. `LivePersistence.ckConfig` is `nonisolated let` so the existing `nonisolated monetizationStateStore()` factory can read it without an actor hop (PrivateCKConfig is Sendable Equatable). PR A of 3 (PR B: AppMonetizationKit IDs; PR C: Minesweeper skeleton). Co-Authored-By: Claude Opus 4.7 <[email protected]>
3 of 4 tasks
2 of 3 tasks
wei18
added a commit
that referenced
this pull request
May 31, 2026
* refactor(monetization): inject per-app banner ad unit + IAP IDs
Move Sudoku-specific monetization identifiers out of AppMonetizationKit
into the Sudoku app's composition root (`AppComposition.Live`), so the
package can serve a second app (Minesweeper, planned in PR D / RFC
`meetings/2026-05-31_minesweeper-rfc.md`) without baking Sudoku's
ASC product ID and AdMob banner unit into its binary.
API changes
-----------
- `LiveStoreKit2IAPClient.init(onCatalogDesync:)`
→ `LiveStoreKit2IAPClient.init(knownProductIds:onCatalogDesync:)`
Required `knownProductIds:` (no default) prevents Minesweeper from
silently inheriting Sudoku's `com.wei18.sudoku.iap.remove_ads` via
arg omission.
- `LiveAdMobAdProvider.init()` → `LiveAdMobAdProvider.init(bannerAdUnitID:)`
- `LiveAdMobBridge.init()` → `LiveAdMobBridge.init(bannerAdUnitID:)`
(internal — only `LiveAdMobAdProvider` constructs it)
The Sudoku-only `IAPProductIDs` enum stays as an internal test fixture
(in-package tests reference it as the canonical value). Production no
longer reads it; `AppComposition.Live` spells out the literal IDs.
Release-safety relocation
-------------------------
The `#if DEBUG / #else fatalError` swap point for the Sudoku banner ad
unit ID moves from a module-level computed `var` in `LiveAdMobBridge`
to an immediately-invoked closure inside the `#if os(iOS)` branch of
`AppComposition.Live`. Two semantic shifts worth flagging:
* Crash timing: was lazy (first ad load); now eager (composition-root).
Misconfigured Release builds fail at launch instead of mid-session —
surfaces on smoke test, not in user gameplay. Net positive.
* Per-platform: macOS direct builds skip the closure entirely (they
use NoopAdProvider), preserving the existing macOS behaviour.
PR B of 4 (A: persistence config #219 ✓ ; B: this; C: rename App/ →
Sudoku/ + Workspace.swift; D: Minesweeper skeleton + new packages).
Reviewed by Code Reviewer subagent: APPROVE_WITH_NITS → 2 doc-comment
nits applied.
Co-Authored-By: Claude Opus 4.7 <[email protected]>
* ci(swiftlint): convert pre-existing TODO to issue ref (#221)
The TODO at LiveAdMobBridge.swift:92 was pre-existing (not introduced
by this PR), but the strict swiftlint check runs only on changed files,
so this PR's touch surfaced it as a violation. Filed #221 to track the
`dispose(handle:)` work and converted the comment to an issue ref.
Co-Authored-By: Claude Opus 4.7 <[email protected]>
---------
Co-authored-by: Claude Opus 4.7 <[email protected]>
wei18
added a commit
that referenced
this pull request
May 31, 2026
* refactor(tuist): rename App/ → Sudoku/, project Sudoku → Game
Prep for hosting a second app (Minesweeper, planned in PR D / RFC
`meetings/2026-05-31_minesweeper-rfc.md`) as a sibling target under
the same Tuist project umbrella. The Sudoku TARGET keeps its name,
bundle id `com.wei18.sudoku`, and scheme; only the umbrella project
becomes `Game` and the app's source/resource dir becomes `Sudoku/`.
Path renames
------------
- App/ → Sudoku/ (all 11 contents move via git mv)
- Project.swift `App/X` paths → `Sudoku/X` (5 occurrences)
- license_plist.yml outputPath (App/Resources → Sudoku/Resources)
- .gitignore Settings.bundle entry (same rename)
Project rename
--------------
- `Project(name: "Sudoku")` → `Project(name: "Game")`
- Generated artifacts: Sudoku.xcodeproj → Game.xcodeproj, similarly .xcworkspace
- Heads-up: Xcode Cloud workflows in App Store Connect reference the
.xcworkspace path → needs user reconfig post-merge (user-owned).
- Local Xcode "Open Recent" entries break for everyone (acceptable).
Doc comment updates
-------------------
.mise.toml / ci_scripts/ci_post_clone.sh / Packages/SudokuKit/Package.swift
/ Packages/SudokuKit/Tests/AppCompositionTests/{L10nTests,PrivacyManifestTests}.swift
— all reference the path or generated artifact name.
LiveAdMobBridge.swift comments mentioning `App/Info.plist` are intentionally
NOT touched here (PR B deletes those lines as part of the Monetization
config refactor — resolving on rebase rather than touching the same lines
in two PRs).
Verification
------------
- `tuist generate --no-open` → produces `Game.xcodeproj` + `Game.xcworkspace`
- `tuist build Sudoku --platform iOS` → Build Succeeded
PR C of 4 (A: persistence config #219 ✓ ; B: monetization config #220 ⏳ ;
C: this; D: Minesweeper skeleton + new packages).
Co-Authored-By: Claude Opus 4.7 <[email protected]>
* docs: address CR misses (README, ci_post_clone, symlink wording)
Three follow-ups to PR C's rename sweep flagged by Code Reviewer:
1. README.md L6/L28/L51 — three stale `App/` references in user-facing
doc updated to `Sudoku/` + line 51 mentions Game umbrella for future
Minesweeper sibling.
2. ci_scripts/ci_post_clone.sh L37 — workspace name reference
`Sudoku.xcworkspace` → `Game.xcworkspace`.
3. Packages/SudokuKit/Package.swift L170 + L10nTests.swift / L10nCompletenessTests.swift /
PrivacyManifestTests.swift comments — claim "via symlinks under
Resources/" was stale; actual implementation uses literal copies
(with `.xcstrings` → `.json` extension hack so the xcstrings
compiler skips it). Corrected.
Co-Authored-By: Claude Opus 4.7 <[email protected]>
---------
Co-authored-by: Claude Opus 4.7 <[email protected]>
4 of 5 tasks
wei18
added a commit
that referenced
this pull request
May 31, 2026
…ackages (#223) * feat(minesweeper): add app target skeleton + MinesweeperCoreKit/Kit packages Closes the 4-PR Minesweeper-prep arc (A: persistence config #219 ✓; B: monetization config #220 ✓; C: rename + project→Game #222 ✓; D: this). Adds a second app target `Minesweeper` (bundleId `com.wei18.minesweeper`) inside the existing Game project, plus two new local SwiftPM packages mirroring the Sudoku{CoreKit,Kit} shape: - `Packages/MinesweeperCoreKit/` — pure-Swift game core, single module `MinesweeperEngine` (placeholder `public struct`) + smoke test - `Packages/MinesweeperKit/` — UI + composition, modules `MinesweeperUI` (placeholder `MinesweeperRootView` "Hello, Minesweeper" screen) and `MinesweeperAppComposition` (`bootRootView()` factory) App target dir `Minesweeper/` mirrors `Sudoku/`: - `MinesweeperApp.swift` (@main → `MinesweeperAppComposition.bootRootView()`) - `Info.plist` (no AdMob keys yet) - `Minesweeper.entitlements` — separate iCloud container `iCloud.com.wei18.minesweeper`, app-sandbox, GameKit - `Assets.xcassets/` — placeholder (copied from Sudoku; flip when Minesweeper has its own AppIcon art) - `Resources/Localizable.xcstrings` — empty `en` catalog - `Resources/PrivacyInfo.xcprivacy` — copied verbatim from Sudoku (anticipates AdMob wiring; revisit when monetization actually lands) - `Minesweeper.xctestplan` — pointed at `MinesweeperEngineTests` only `Project.swift`: - Adds `minesweeperTarget` (same `appTargetSettings` icon-name override) - Adds `Packages/MinesweeperKit` to `packages:` - Adds Minesweeper scheme alongside the existing Sudoku scheme Module names (`MinesweeperEngine` / `MinesweeperUI` / `MinesweeperAppComposition`) are namespaced to avoid colliding with SudokuCoreKit's `GameState` and SudokuKit's `SudokuUI` / `AppComposition` in the same Xcode project's package graph. Verified -------- - `tuist generate --no-open` → produces `Game.xcworkspace` with both schemes - `tuist build Sudoku --platform iOS` → green (regression) - `tuist build Minesweeper --platform iOS` → green - `swift test --package-path Packages/MinesweeperCoreKit` → 1/1 pass Follow-ups (filed as separate work, NOT part of this skeleton) - Provision `iCloud.com.wei18.minesweeper` CloudKit container in Dashboard - Wire Minesweeper's own AdMob banner + IAP product IDs (consumes the PR B parameterization) - Wire `LivePersistence` with a `PrivateCKConfig.minesweeper` constant (consumes the PR A parameterization) - Replace placeholder MinesweeperEngine with real mine placement + flood-fill + win/lose detection - Replace placeholder AppIcon with Minesweeper art Co-Authored-By: Claude Opus 4.7 <[email protected]> * docs(minesweeper): address CR nits 1. PrivacyInfo.xcprivacy header — prepend Minesweeper PR D context note explaining the verbatim copy + flip condition (no XML change). 2. MinesweeperEngine.swift — drop unused `internal import Foundation`. 3. Project.swift header — generalize the bundle-id / deployment-target bullet to cover both Sudoku and Minesweeper targets. Co-Authored-By: Claude Opus 4.7 <[email protected]> --------- Co-authored-by: Claude Opus 4.7 <[email protected]>
wei18
added a commit
that referenced
this pull request
Jun 3, 2026
…zone/subscription namespace (#257) Mini-PR ahead of MS monetization wire Phase 3 (per meetings/2026-06-02_minesweeper-monetization-wire-proposal.md §Phase 3 prerequisite). PR #219's per-app injection pattern for `PrivateCKConfig` already supported this; now adds the Minesweeper counterpart. - `PrivateCKConfig.minesweeper`: - `zoneName: "com.wei18.minesweeper.userZone"` - `subscriptionID: "com.wei18.minesweeper.userZone.changes"` - CKContainer itself (`iCloud.com.wei18.minesweeper`) resolved by `CKContainer.default()` from the Minesweeper App target's entitlements — not encoded in PersistenceKit - Sentinel test `minesweeperConfigUsesDistinctNamespace` confirms zone+subscription IDs are distinct from `.sudoku` User has already provisioned the MS CK container on Apple Developer portal + bound to the MS App ID (audit U4, 2026-06-02). MS production schema deploy is a separate user task post-Phase-3 ship. Subagent stalled at verification phase; Leader applied + verified (4/4 PersistenceTests pass). Co-authored-by: Claude Opus 4.7 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
zoneName/subscriptionIDfrom the Sudoku-hardcodedPrivateCKConstantsinto a newPrivateCKConfigvalue-type, injected at theLivePersistence/LivePrivateCKGatewayboundary.PrivateCKConfig.sudokuholds the original strings (com.wei18.sudoku.userZone+.changes); Sudoku'sAppComposition.Livepasses it explicitly.SavedGame/PersonalRecord/MonetizationState) stay inPrivateCKConstants— they're scoped to each app's CKContainer and safe to share verbatim across apps.Context — RFC
PR A of 3 preparing the repo to host a second app (Minesweeper) alongside Sudoku in the same workspace. See `meetings/2026-05-31_minesweeper-rfc.md` §5.1 for the full audit and §6 for the phasing.
Design notes
ckConfig:is required (no default): prevents a future Minesweeper composition root from silently binding to Sudoku's CKContainer zone via parameter omission. There is exactly ONE caller today; the diff cost is minimal.nonisolated let ckConfigon theLivePersistenceactor — required becausemonetizationStateStore()is alreadynonisolated. Safe: `PrivateCKConfig` is an immutable Sendable Equatable struct.LivePrivateCKGateway.init: required `config:` first, defaulted `container:` second (CR nit applied).Behavior preserved
CKRecordZone.IDandCKDatabaseSubscription.Test plan
Review
Reviewed by Code Reviewer subagent: APPROVE_WITH_NITS → param-order nit applied.
🤖 Generated with Claude Code