Repository navigation
chore(appcomposition): delete dead HomeViewModel factory - #33
Merged
Merged
Conversation
Closes the orthogonal observation flagged in PR #16: RootView constructs its own HomeViewModel inline with a path Binding (post-#15 fix), so AppComposition.homeViewModelFactory and its Live/Preview implementations are never consumed. Option Delete chosen over Plumb-through: - HomeViewModel.init(path: Binding) needs the post-composition RootViewModel instance — () -> HomeViewModel factory shape can't supply it - Plumb-through would require RootView.init signature change (out of scope) - HomeViewModel has zero injected collaborators; no DI parity lost Files: removed factory prop + init param + call sites in AppComposition + Live + Preview, and the _ = factory touch line in CompositionTests. Test count unchanged (363). §未決 (FOLLOW-UP): All 6 other ViewModelFactory entries (dailyHub/practiceHub/game/completion/leaderboard/settings) also appear unread by production consumers outside the AppComposition module. Subagent flagged but didn't fix here. Filing as separate issue. impl-notes: meetings/2026-05-20_drop-dead-home-vm-factory.impl-notes.md
This was referenced May 20, 2026
wei18
added a commit
that referenced
this pull request
May 20, 2026
… (#44) 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 was referenced May 20, 2026
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.
PR #16 orthogonal cleanup. HomeViewModel factory was dead code after RootView started constructing the VM inline with a path Binding.
§未決 FOLLOW-UP: all 6 other ViewModelFactory entries also appear unread by production. Will file as separate issue.
🤖 Claude Code