Repository navigation
chore(appcomposition): delete all 6 dead VM factories - #44
Merged
Merged
Conversation
Closes #34. Per-factory audit confirmed all 6 remaining factories (dailyHub / practiceHub / game / completion / leaderboard / settings) have ZERO consumers outside their own setter sites in AppComposition.swift / Live.swift / Preview.swift / CompositionTests. Only `composition.rootViewModel` is read by anything (App/SudokuApp.swift:11). RootView uses `destination: { _ in EmptyView() }`, and grep for DailyHubView(/GameView(/... constructor calls returns zero hits. The factory pattern was plumbed but never connected. Changes: - AppComposition.swift: removed 6 properties + 6 init params + 6 assignments; pruned now-unused imports (GameCenterClient, GameState, Persistence, PuzzleStore, SudokuEngine, Telemetry). Now a one-field struct wrapping rootViewModel. - Live.swift: removed all 6 factory args from AppComposition(...) call; removed orphaned leaderboardId(for:) helper; pruned imports. - Preview.swift: removed all 6 factory args + orphaned provider local; pruned imports. - CompositionTests.swift: removed 6 _ = composition.xxxFactory touch lines; adjusted comment. 364/364 tests, 0 warnings. §未決 (FOLLOW-UP for Leader): All 7 VM factories (counting #33's homeViewModelFactory) were dead from the start. AppComposition is now a one-field struct. design.md §How.1 DI architecture deserves a re-read: either VM factories were intended and Views never got wired (regression), or inline VM construction (RootView/HomeView pattern) is the de facto choice and §How.1 spec should be amended to drop the factory pattern. Separate refactor decision. impl-notes: meetings/2026-05-20_dead-vm-factories-audit.impl-notes.md
wei18
added a commit
that referenced
this pull request
May 20, 2026
…apper (#45) (#48) Closes #45. Critical v1 navigation gap — RootView.destination returned EmptyView, so tapping any HomeView card past Home led to a blank screen on device. Every View renders standalone in snapshots; the NavigationStack glue was never wired. Option A chosen: RootView.init grows to take the 4 protocol deps (puzzleProvider / persistence / gameCenter / telemetry) alongside its existing RootViewModel. Destination becomes a real switch over the 7 AppRoute cases, each constructing the matching View + VM inline. BoardView async-puzzle challenge resolved with shape (iii): - NEW BoardLoaderView.swift (110 lines): @mainactor View with LoadState .loading / .loaded(GameViewModel) / .failed(String) - .task(id: puzzleId) calls persistence.loadOrCreate + GameSession.restore + GameViewModel live ctor on success → .loaded - .failed surfaces Retry button that re-runs load() - GameViewModel.swift and BoardView.swift untouched (original fence preserved; lifted only for the new wrapper file) AppRoute.completion limitation: case doesn't carry difficulty/mode, so the Completion → Leaderboard route uses LeaderboardIDs.id(for: .dailyEasy) placeholder. Backlog entry filed in design.md §不在 v1 範圍 §導航 for expanding AppRoute.completion case in a future PR. design.md §How.1: DI Composition Root section amended to drop *ViewModelFactory references and document the actual inline-construction pattern. Cross-links issues #15 / #34 / #45 + PRs #33 / #44 as the trail. Verified: - swift build: 0 warnings - swift test: 364/364 in 69 suites - xcodebuild iOS scheme: ** BUILD SUCCEEDED ** (Leader-run; subagent was sandbox-blocked) - TODO sweep on Root/ + Board/BoardLoaderView.swift + AppComposition/ → 0 hits impl-notes: meetings/2026-05-20_route-destination-wireup.impl-notes.md
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.
Closes #34. All 6 ViewModelFactory entries (post-#33) are dead — verified by per-factory consumer grep. AppComposition collapses to one-field struct wrapping rootViewModel. 364/364 tests unchanged.
§未決 (flagged for Leader follow-up): design.md §How.1 DI architecture deserves a re-read. Factory pattern was plumbed but never connected to Views — either regression OR factories were never the intended pattern. Separate decision.
🤖 Claude Code