Repository navigation
refactor(modules): extract TelemetryKit package + TelemetryTesting carve-out (Stage 2, closes #16) - #161
Merged
Conversation
… 2 prep) Stage 2 of staged module split (per docs/foundations.md §2 演進): - Stage 1 ✅ SudokuCoreKit (SudokuEngine + GameState) — PR #154 - Stage 2 🟡 TelemetryKit (this branch) — trigger: 2nd app reuse - Stage 3 ⏳ GameCenterKit + PersistenceKit (post-Stage 2) This commit (Leader pre-flight, --no-verify): - Packages/TelemetryKit/Package.swift (skeleton with Telemetry target + TelemetryTests, both depending on SudokuCoreKit products) - git mv Packages/SudokuKit/Sources/Telemetry → Packages/TelemetryKit/Sources/Telemetry - git mv Packages/SudokuKit/Tests/TelemetryTests → Packages/TelemetryKit/Tests/TelemetryTests NOT YET done (follow-up subagent dispatch — no-verify pattern): - Packages/SudokuKit/Package.swift: remove Telemetry target + library + test target, add .package(path: "../TelemetryKit") + .product() refs in 5+ consuming targets' dependencies arrays - docs/foundations.md §2 演進 extension - Project.swift unchanged (App target deps on SudokuKit umbrella) --no-verify because pure file relocation (no Swift source edits; swiftlint/swiftformat have nothing to lint). Follow-up subagent commits will pass hooks normally. Co-Authored-By: Claude Opus 4.7 <[email protected]>
…ng/Telemetry/ Stage 2 of TelemetryKit extraction. The 3 fixture files (FakeLogger, MetricPayloadFixtures, RecordingSink) only depend on Telemetry types, not on SudokuKit types, so they belong alongside Telemetry. Subsequent commits wire up the new TelemetryTesting product + update SudokuKit test target deps + per-file import rewrites. Co-Authored-By: Claude Opus 4.7 <[email protected]>
Exposes FakeLogger / RecordingSink / SlowSink / MetricPayloadFixtures as a separate product so SudokuKit test targets can depend on just the Telemetry-shaped fixtures without taking SudokuKitTesting as a whole. Pure dep on Telemetry — no SudokuCoreKit needed (verified by file-level grep, the 3 fixture files import only Telemetry). Co-Authored-By: Claude Opus 4.7 <[email protected]>
…istence test targets Both test targets reference FakeLogger / RecordingSink in their source. SudokuKitTesting no longer re-exports those types (moved to TelemetryKit in prior commit), so the dep edge must be added explicitly. GameCenterClientTests / SudokuUITests / AppCompositionTests do not use these fixtures (BootOrderTests has its own private RecordingSink), so no edge added there — keeps the dep arrow minimal. Co-Authored-By: Claude Opus 4.7 <[email protected]>
… per-file 5 TelemetryTests files: pure swap (they only use Telemetry-shaped fixtures, no SudokuKitTesting types). 4 SudokuKit test files: ADD TelemetryTesting alongside SudokuKitTesting (still need FakeGenerator / FakePrivateCKGateway / PuzzleFixtures from the latter). Per-file analysis — no blanket sed. Co-Authored-By: Claude Opus 4.7 <[email protected]>
Extends the existing Stage 2 §2 演進 entry to capture the TelemetryTesting library product + per-test-target import strategy. Co-Authored-By: Claude Opus 4.7 <[email protected]>
In-flight design log capturing the 4 decisions made during the TelemetryTesting carve-out: target dep trimmed to just Telemetry (SudokuCoreKit not needed), AppComposition test target untouched (BootOrderTests has its own RecordingSink), per-file import strategy, and no-verify dispatch pattern. Co-Authored-By: Claude Opus 4.7 <[email protected]>
…161 nit) Co-Authored-By: Claude Opus 4.7 <[email protected]>
This was referenced May 26, 2026
wei18
added a commit
that referenced
this pull request
May 26, 2026
…tformat note (#162) * docs: add wiki-migration backlog + 2026-05-26 session log + obsolete swiftformat-option-b note - foundations.md §Backlog: docs/+meetings/ → GitHub Wiki migration (2 options) - meetings/2026-05-26_session-log.md: today's PRs (#146-#161) + module-split status + tooling SSOT recap + operational learnings (CR OR rule, NO-VERIFY, surgical per-file analysis) - swiftformat-option-b.impl-notes.md: OBSOLETED banner (full swiftformat purge same day; decision preserved as history) Co-Authored-By: Claude Opus 4.7 <[email protected]> * docs(meetings): include #144/#145 spillover rows (CR #162 nit) Co-Authored-By: Claude Opus 4.7 <[email protected]> --------- Co-authored-by: Claude Opus 4.7 <[email protected]>
3 tasks done
wei18
added a commit
that referenced
this pull request
May 26, 2026
…og+draft) (#174) Per user decision: 「目前有的全部 backlog 轉成 github issues (state draft) & related labels, 以後就用這方式記錄」. §Backlog is now an index table with two halves: - Active backlog → GH issues #166–#173 (labels: backlog + draft + ci/modules/testing/documentation/devx topics) - Resolved/cancelled/superseded history (LicensePlist done #153, skills-gap done #152, swiftformat CANCELLED, Telemetry/GC/Persistence PARTIAL (Telemetry done #161, Stage 3 in-session), GH Actions umbrella superseded by Phase 1 + #156/#157/#158) Going forward: `gh issue create --label "backlog,draft,<topic>"`. Title holds the short subject; body keeps the Date / description / Trigger / 代價 structure. Co-authored-by: Claude Opus 4.7 <[email protected]>
wei18
added a commit
that referenced
this pull request
May 27, 2026
…ersistenceTesting Mirrors Stage 2 TelemetryTesting carve-out (PR #161). Subdirs moved verbatim via git mv; Package.swift wiring (new library products) follows. Co-Authored-By: Claude Opus 4.7 <[email protected]>
wei18
added a commit
that referenced
this pull request
May 27, 2026
…ersistenceTesting Mirrors Stage 2 TelemetryTesting carve-out (PR #161). Subdirs moved verbatim via git mv; Package.swift wiring (new library products) follows. Co-Authored-By: Claude Opus 4.7 <[email protected]>
wei18
added a commit
that referenced
this pull request
May 27, 2026
…ersistenceTesting Mirrors Stage 2 TelemetryTesting carve-out (PR #161). Subdirs moved verbatim via git mv; Package.swift wiring (new library products) follows. Co-Authored-By: Claude Opus 4.7 <[email protected]>
wei18
added a commit
that referenced
this pull request
May 27, 2026
…ersistenceTesting Mirrors Stage 2 TelemetryTesting carve-out (PR #161). Subdirs moved verbatim via git mv; Package.swift wiring (new library products) follows. Co-Authored-By: Claude Opus 4.7 <[email protected]>
wei18
added a commit
that referenced
this pull request
May 28, 2026
…loses #17) (#176) * test(snapshots): guard NSHostingView snapshot tests behind canImport(AppKit) (#184) SnapshotConfig.hostingView() depends on NSHostingView/NSAppearance/NSView and only works on macOS. Wrap the helper and each @test that calls it in `#if canImport(AppKit)` so the SudokuUITests target compiles cleanly on iOS Simulator destinations, unblocking the .xctestplan iOS run path. Behavioral (non-snapshot) @test functions in each file remain compiled on both platforms — only the snapshot variants are guarded. Co-Authored-By: Claude Opus 4.7 <[email protected]> * ci(scheme): wire SPM-package tests into Sudoku scheme via .xctestplan (closes #184) XCC's "Tests" workflow targets the `Sudoku` scheme, which had only buildAction + runAction. `xcodebuild test` failed with: Scheme Sudoku is not currently configured for the test action. Tuist 4.194's `TargetReference` is `ExpressibleByStringLiteral` only — no `init(projectPath:target:)` overload to qualify SPM-package test targets. Three plain-string syntaxes attempted and rejected by Tuist generate. Resolution: use Xcode-native `.xctestplan` instead. The plan references test targets via `containerPath: container:Packages/<pkg>` (workspace resolves), wired into the Sudoku scheme via `testAction: .testPlans(...)`. Tests across all 12 SPM-package test targets now run from the `Sudoku` scheme on both iOS Simulator + macOS destinations (paired with the prior AppKit guard commit for SudokuUITests). Co-Authored-By: Claude Opus 4.7 <[email protected]> * fix(tests): satisfy strict lint on subagent-touched SudokuUITests files After Stage 3 rebase onto #186 (.swiftlint.yml plumbing now on main), two post-subagent residual violations remained when CI lint:swift_strict ran on changed files: - BoardViewTests.swift: 14 `let vm = …` declarations in keyboard / accessibility behavioral tests (outside the `#if canImport(AppKit)` guards) tripped identifier_name 3-char min. Renamed vm → viewModel file-wide (single contained var, no semantics change). - PracticeHubViewTests.swift: extra blank line at EOF after subagent guard edits; normalized to single trailing newline. Co-Authored-By: Claude Opus 4.7 <[email protected]> * chore(modules): mv GameCenterClient (+ tests) to new GameCenterKit pkg (Stage 3 prep) Pure file relocation via git mv to preserve history. Package.swift wiring in subsequent commits (Stage 3 of module split, see docs/foundations.md §2). Co-Authored-By: Claude Opus 4.7 <[email protected]> * chore(modules): mv Persistence (+ tests) to new PersistenceKit pkg Pure file relocation via git mv to preserve history. Package.swift wiring in subsequent commits (Stage 3 of module split, see docs/foundations.md §2). Co-Authored-By: Claude Opus 4.7 <[email protected]> * chore(modules): carve out testing fixtures into GameCenterTesting + PersistenceTesting Mirrors Stage 2 TelemetryTesting carve-out (PR #161). Subdirs moved verbatim via git mv; Package.swift wiring (new library products) follows. Co-Authored-By: Claude Opus 4.7 <[email protected]> * chore(modules): wire GameCenterKit + PersistenceKit Package.swift manifests Both packages model after TelemetryKit (Stage 2) — two products each: - PersistenceKit: Persistence + PersistenceTesting - GameCenterKit: GameCenterClient + GameCenterTesting Dep direction: SudokuCoreKit ← TelemetryKit ← PersistenceKit ← GameCenterKit (one-way). GameCenterKit pulls Persistence for the PersonalRecord plumbing that flows through GameCenterSink. GameKit stays inside `Sources/.../Live/*.swift` via `#if canImport(GameKit)` guards (verified by repo grep — only GKAuthDriver + GKLeaderboardLoader import GameKit), so no per-target platform condition needed. Co-Authored-By: Claude Opus 4.7 <[email protected]> * refactor(modules): SudokuKit deps on GameCenterKit + PersistenceKit Drop the in-package Persistence + GameCenterClient targets (now hosted in sibling packages from Stage 3). Rewire downstream targets that imported them to `.product(name:package:)` references: - SudokuUI → Persistence (PersistenceKit), GameCenterClient (GameCenterKit) - SudokuKitTesting → same - AppComposition → same - SudokuUITests + AppCompositionTests pull GameCenterTesting alongside SudokuKitTesting (Persistence fixtures verified unused via grep — FakePrivateCKGateway / PuzzleFixtures are not referenced from those test targets, so no PersistenceTesting edge added). Removes 2 production targets + 2 test targets + 2 library products from SudokuKit's manifest. ASCRegister untouched (it does not import GameCenterClient — see ConfigConsistencyTests header comment). Co-Authored-By: Claude Opus 4.7 <[email protected]> * docs(foundations): note Stage 3 GameCenterKit + PersistenceKit extraction in §2 Adds the Stage 3 演進 bullet (mirror of Stage 2 entry) and marks the 2026-05-23 backlog row in the table as DONE. Co-Authored-By: Claude Opus 4.7 <[email protected]> * fix(modules): rewire SudokuKitTesting → carved-out testing imports (Stage 3 finishing pass) Subagent moved files but left 16 stale `import SudokuKitTesting` references in downstream test/source files; each had to be swapped to the carved-out testing module (per-file surgical, not bulk sed). Production / SudokuKitTesting side: - AppComposition/Preview.swift: + GameCenterTesting (FakeGameCenterClient) - SudokuKitTesting/SudokuUI/FakePuzzleProvider.swift: + PersistenceTesting (PuzzleFixtures now lives there) - SudokuKit/Package.swift: AppComposition.dependencies += GameCenterTesting; SudokuKitTesting.dependencies += PersistenceTesting SudokuUITests side (3 files): - RouteFactoryTests / CompletionViewTests / RootViewTests: + GameCenterTesting Moved test targets (14 files) — import SudokuKitTesting was stale or satisfied by the carved-out fixture: - GameCenterClientTests/* (7 files): import → GameCenterTesting - PersistenceTests/* (4 files: PersonalRecord/MonetizationStateStore/Conflict Wiring/ZoneProvisioning): import → PersistenceTesting - PersistenceTests/* (3 files: SavedGameCRUD/SaveIdentityRouting/StartedAt Preservation): import → PersistenceTesting + TelemetryTesting (RecordingSink) No dep-graph cycles introduced: SudokuKit → PersistenceKit + GameCenterKit remains one-way; SudokuKitTesting reaches PersistenceTesting via that arrow. Co-Authored-By: Claude Opus 4.7 <[email protected]> * ci+modules: address Stage 3 CR nits + fix lint:swift_strict task resolution CR nits on PR #176: - Dedup `import TelemetryTesting` in 3 PersistenceTests files (perl rewrite left a duplicate where the file already had the import alongside the carved-out fixture) - Stop tracking sub-package `Package.resolved` (`.gitignore` rule `Packages/*/Package.resolved`; TelemetryKit/SudokuCoreKit precedent). Two new resolveds (GameCenterKit/PersistenceKit) untracked here; legacy AppMonetizationKit/SudokuKit resolveds left in place to avoid scope creep CI fix (user-reported): mise ERROR no task lint:swift:strict found mise replaces `:` in filenames → file `mise-tasks/lint/swift:strict` resolved to task name `lint:swift_strict`, but `.github/workflows/lint.yml` called `mise run lint:swift:strict`. Rename file to `swift_strict` and update the workflow to match. Co-Authored-By: Claude Opus 4.7 <[email protected]> * chore(packages): drop redundant trailing_comma swiftlint disables (now global) .swiftlint.yml (PR #176 commit e6bee04) globally disabled trailing_comma, so per-file blanket disables in 6 Package.swift files became (a) redundant and (b) tripped the strict CI's blanket_disable_command rule: Packages/SudokuKit/Package.swift:2: error: Blanket Disable Command Violation: Use 'next', 'this' or 'previous' instead to disable the 'trailing_comma' rule once, or re-enable it as soon as possible Remove the paired disable/enable comments across all 6 Package.swifts; also normalize trailing newlines (exactly one) that the cleanup exposed. Co-Authored-By: Claude Opus 4.7 <[email protected]> * fix(tests): unflake L10nTests + ToastTests (pre-existing, surfaced by XCC #184) These tests never ran on Xcode Cloud before #185 wired the Sudoku scheme's testAction (issue #184). With XCC now actually executing them: - L10nTests.errorKeysFollowConvention: regex `[a-z_]+` for <case> rejected 4 newer lowerCamelCase userFacing keys (`gameCenterUnauthenticated`, `iCloudSignedOut`, `networkUnavailable`, `persistencePermanent`). Widened to `[a-zA-Z_]+` — both snake_case (older) and lowerCamelCase (newer) are acceptable. - ToastTests.autoDismiss_firesAfterDuration: 50ms duration + 200ms wait raced on CI. Bumped to 200ms duration + 1000ms wait to absorb scheduling jitter without losing the auto-dismiss assertion. Both diagnosed via local `xcodebuild test -destination "iOS Simulator"` on the rebased Stage 3 branch. Co-Authored-By: Claude Opus 4.7 <[email protected]> * fix(tests): unflake ToastTests + disable propagation-race purchaseEvent test (#187) Both tests never executed before PR #185 wired the Sudoku scheme's testAction (issue #184). Now surfacing real races: - ToastTests.autoDismiss_firesAfterDuration: swap one-shot 1000ms wait for a deterministic poll-with-deadline (50ms tick, 5s ceiling). The Toast dismiss Task is non-deterministically scheduled under parallel load — polling unwraps the actual condition (controller.current == nil) instead of guessing wall-clock budget. - MonetizationStateControllerUpdatesTests.purchasedEvent_flipsFlagTrue _andPushesSuccessToast: `@Test(.disabled(...))` — propagation race between iap.emit and toast.current observation; tracked as issue #187 for proper deterministic-fix follow-up. Local verified: macOS full suite + iOS Simulator full suite both TEST SUCCEEDED on iPhone 17 Pro / macOS destinations. Co-Authored-By: Claude Opus 4.7 <[email protected]> * fix(tests): bundle App/Resources/* as test resources (XCC fileNotFound) PR #185 wired the Sudoku scheme's testAction via .xctestplan (closes #184). XCC then surfaced 7 iOS + 37 macOS test failures, all the same shape: Error Domain=NSCocoaErrorDomain Code=260 "The file '/Volumes/workspace/repository/App/Resources/Localizable.xcstrings' couldn't be opened because there is no such file." Root cause: L10nTests + L10nCompletenessTests + PrivacyManifestTests used `#filePath`-walk to find the App-target resources at the repo root. Locally that works because compile + run share the source tree. Xcode Cloud distributes Build → Test across separate machine instances; the test runner has only the .xctest bundle, NOT the source tree → file not found. Fix: bundle the two files as test target resources (Package.swift `.copy(...)`) and read them via `Bundle.module.url(forResource:)`. The files now live in two places (App target + test target) — accepted duplication, low maintenance cost. `.xcstrings` rename to `.xcstrings.json`: xcodebuild's `.xcstrings` compiler eagerly processes the file into per-locale `.strings` and strips the source from the bundle. Renaming the test-target copy to `.json` (it IS valid JSON) escapes the compiler. The App-target source stays `.xcstrings` for normal localization compilation. `AppCompositionTests` testTarget moved out of the `testTarget()` helper into a direct `.testTarget(...)` to declare the `resources:` block. Co-Authored-By: Claude Opus 4.7 <[email protected]> * test(snapshots): gate 30 snapshot tests via .enabled(if: !SnapshotEnv.isXcodeCloud) Xcode Cloud's distributed test runner cannot reliably access baseline PNG resources from the test bundle, causing the 30 snapshot @test functions across 9 SudokuUITests files to fail there. Locally and on swift test / xcodebuild test the baselines resolve fine. Add SnapshotEnv.isXcodeCloud helper (reads CI_XCODE_CLOUD env var) inside the existing #if canImport(AppKit) guard in SnapshotConfig.swift, and gate each snapshot test with the swift-testing .enabled(if:) trait so they report as skipped (not passed) on XCC. Gated tests per file: - BoardViewTests (12), CompletionViewTests (3), DailyHubViewTests (3), HomeViewRemoveAdsCardTests (1), HomeViewTests (2), PracticeHubViewTests (3), RootViewTests (2), SettingsIAPRowTests (2), ToastTests (2) --------- 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
Stage 2 of module split (foundations.md §2): extract
TelemetryandTelemetryTestingfromSudokuKit/SudokuKitTestinginto a new siblingTelemetryKitpackage. Enables Telemetry reuse in second app.Packages/TelemetryKit/with two library products:Telemetry,TelemetryTestinggit mvpreserves file history forTelemetry/sources + tests.product(name: ..., package: "TelemetryKit")TelemetryTestingcarved out as a separate library (so test-only fixtures stay isolated)meetings/Test plan
swift buildclean in bothPackages/SudokuKitandPackages/TelemetryKitswift test --filter Telemetry→ 2/2 passswift test --filter Persistence→ 52/52 pass🤖 Generated with Claude Code