Skip to content

fix(homeview, sidebar): tap targets + Mac sidebar wiring + throwaway VM - #16

Merged
wei18 merged 1 commit into
mainfrom
fix/homeview-tap-targets-and-mac-sidebar
May 20, 2026
Merged

wei18 merged 1 commit into
mainfrom
fix/homeview-tap-targets-and-mac-sidebar

Conversation

@wei18

@wei18 wei18 commented May 20, 2026

Copy link
Copy Markdown
Owner

Closes #15.

Bugs fixed

# Bug Fix
1 HomeView mode cards: hit area = content, not card frame .contentShape(Rectangle()) on ModeCard
2 Mac NavigationSplit sidebar: 4 Labels inert (Phase 8 Part 1 stub) sidebar Labels → NavigationLink(value:) via shared HomeMode.appRoute
3 RootView built throwaway HomeViewModel — taps appended to discarded [AppRoute] HomeViewModel.init(path: Binding<[AppRoute]>? = nil) (Option A)
4 (bonus) ResumePill same .plain + Spacer shape bug .contentShape(Rectangle()) on ResumePill

Workflow used

Verified

  • swift build: 0 warnings
  • swift test: 340/340 in 65 suites
  • xcodebuild iOS scheme: ** BUILD SUCCEEDED ** 0 warnings
  • 0 PNG re-records needed

Why these slipped through Phase 8 review

  • Snapshot tests render but don't click — hit-test regions unverified
  • ViewModel behavior tests bypass the View layer — interactions untested
  • Phase 8 Part 1 "sidebar is a stub" TODO never enforced across subsequent phases
  • Mac-specific NavigationSplit interaction not in any test matrix

Methodology improvements queued separately (Phase TODO sweep + SwiftUI footgun checklist).

🤖 Generated with Claude Code

…VM (#15)

Closes #15. Fixes 4 functional bugs surfaced by macOS smoke test:

1. HomeView mode cards: tap target only covered content, not the full
   72pt card frame. Fixed by .contentShape(Rectangle()) on ModeCard
   between .frame(minHeight: 72) and .glassEffect.

2. Mac NavigationSplitView sidebar: 4 placeholder Labels were inert.
   Phase 8 Part 1 left a stub with a TODO that never got picked up.
   Sidebar items now wire through NavigationLink(value:) using a shared
   HomeMode.appRoute computed property (single source of truth used by
   both HomeView card taps and the Mac sidebar links).

3. Throwaway HomeViewModel: RootView created a fresh HomeViewModel()
   inline whose path was never observed by NavigationStack. Cards had
   their tap target back (bug 1 fix) but taps appended to a discarded
   array → nothing navigated. Fixed by hoisting path as a Binding:
   HomeViewModel.init(path: Binding<[AppRoute]>? = nil); RootView
   passes its own Binding(get/set: RootViewModel.path). Default-nil
   preserves zero-arg call sites in AppComposition factories +
   previews + behavior tests.

4. ResumePill in RootView had the same shape bug as ModeCard
   (Button .plain + Spacer label). Applied the same
   .contentShape(Rectangle()) fix preemptively.

Per AI Collaboration Mode + agent-impl-notes-log skill: subagent
maintained meetings/2026-05-20_homeview-tap-and-mac-sidebar.impl-notes.md
across two rounds (initial Bugs 1+2+4, then Bug 3 scope expansion).
§未決 empty at both checkpoints; Leader review approved Option A
(Binding-hoisted path with optional default) over Options B/C
(callback / hoisted-ownership) for minimal blast radius.

Verified:
- swift build: 0 warnings
- swift test: 340/340 in 65 suites
- xcodebuild iOS scheme: ** BUILD SUCCEEDED ** 0 warnings
- Snapshot delta: 0 PNG re-records needed (pure wiring fix; sidebar
  layout was already visually correct, just non-interactive)

Out of scope (flagged by subagent for future cleanup):
- AppComposition.homeViewModelFactory now dead code (RootView builds
  its own HomeViewModel inline with the path Binding). Karpathy §2:
  don't speculative-refactor; future PR.
- HomeViewModel.path is bimodal (prod uses Binding, tests/previews
  use local). Works correctly but slightly confusing API; future
  cleanup if it becomes load-bearing.

These bugs slipped past the Phase 8 Code Reviewer pipeline because:
(a) snapshot tests render but don't click; (b) ViewModel behavior
tests bypass the View layer; (c) Phase 8 Part 1 explicit TODO never
closed across Part 2 / Phase 9 dispatches; (d) Mac-specific
NavigationSplit interaction not in any test matrix.
methodology improvements queued separately.
@wei18
wei18 merged commit 63d6a9a into main May 20, 2026
@wei18
wei18 deleted the fix/homeview-tap-targets-and-mac-sidebar branch May 20, 2026 06:59
wei18 added a commit that referenced this pull request May 20, 2026
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
wei18 added a commit that referenced this pull request May 20, 2026
…puted (#34 wave) (#35)

After PR #16, HomeViewModel.path was bimodal — externalPath via Binding
for prod, local for tests/previews. Option Clarify chosen: private
`localPath` (fallback) + private `externalPath: Binding` (prod) +
single public computed `var path` that routes between them.

Result: API surface unchanged (callers still read/write `path`), but
the bimodality is now encapsulated as private impl detail with clear
names. `select(_:)` collapsed from branching if/else to single
`path.append(mode.appRoute)` (computed setter owns routing).

Files: only HomeViewModel.swift modified. HomeView / RootView / tests /
previews untouched.

Tests 363/363. 0 warnings.

impl-notes: meetings/2026-05-20_home-vm-path-bimodal-cleanup.impl-notes.md
wei18 added a commit that referenced this pull request May 26, 2026
…rve-out (Stage 2, closes #16) (#161)

* chore(modules): mv Telemetry (+ tests) to new TelemetryKit pkg (Stage 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]>

* refactor(modules): SudokuKit deps on TelemetryKit for Telemetry

* docs(foundations): note TelemetryKit Stage 2 extraction in §2

* chore(modules): carve out TelemetryTesting subdir from SudokuKitTesting/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]>

* chore(modules): add TelemetryTesting library product to TelemetryKit

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]>

* chore(modules): wire TelemetryTesting product into PuzzleStore + Persistence 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]>

* refactor(tests): rewrite SudokuKitTesting -> TelemetryTesting imports 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]>

* docs(foundations): note TelemetryTesting library carve-out in Stage 2

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]>

* docs(meetings): TelemetryKit Stage 2 impl notes

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]>

* docs(telemetry): refresh RecordingSink header to TelemetryTesting (CR #161 nit)

Co-Authored-By: Claude Opus 4.7 <[email protected]>

---------

Co-authored-by: Claude Opus 4.7 <[email protected]>
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.

HomeView mode cards have shrunken tap targets; Mac sidebar items don't respond

1 participant