Skip to content

Arch: split HomeViewModel (14 deps, 200-LOC init, god-object) #40

Description

@Yokomoko

From: review-reports/architect.md finding #1, SUMMARY.md Theme A (all 4 reviewers)

Where: ui/home/HomeViewModel.kt:1-50 (constructor), :85-155 (init block)

Issue: HomeViewModel injects 14 dependencies spanning bootstrap, sync, dedup, two enrichment services, a progress tracker, and 7 DAOs. Its init block runs the full startup pipeline: bootstrap, conditional sync, dedup, enrichment, three timed rail-rebuild passes. It is untestable without mocking 14 collaborators and every new Home feature routes through it.

Fix (multi-file refactor):

  1. Extract StartupOrchestrator that owns bootstrap → sync → dedup → enrichment pipeline and exposes a completion signal.
  2. Extract HomeRailBuilder utility that reacts to the enrichment tracker's state flow instead of the 5s/30s/90s delay schedule.
  3. Leave HomeViewModel as pure UI state observation — 3-4 deps, no init block side effects.

User impact: unblocks testability + makes future Home features safe to add. Directly supports the reactive-rail-building fix (separate issue).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesttop-priorityMust have — daily use, everyone benefits

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions