Skip to content

feat(desktop): implement DI auto-wiring and validation#4782

Merged
jamesarich merged 1 commit intomainfrom
feat/koin-k2
Mar 13, 2026
Merged

feat(desktop): implement DI auto-wiring and validation#4782
jamesarich merged 1 commit intomainfrom
feat/koin-k2

Conversation

@jamesarich
Copy link
Copy Markdown
Collaborator

This commit migrates the Desktop (JVM) target to use the Koin K2 compiler plugin for dependency injection and introduces automated graph validation. Manual ViewModel wiring in DesktopKoinModule has been replaced by auto-generated modules from commonMain, ensuring parity with the Android implementation.

Specific changes include:

  • DI Automation: Switched from manual viewModel { ... } blocks to Koin K2 compiler plugin auto-wiring for the Desktop target.
  • Graph Validation: Added DesktopKoinTest.kt using Koin's verify() API to validate the entire Desktop DI graph (repositories, use cases, ViewModels, and stubs) at test-time.
  • New Stubs: Implemented NoopCompassHeadingProvider, NoopPhoneLocationProvider, and NoopMagneticFieldProvider in desktop/src/main/kotlin/org/meshtastic/desktop/stub/ to resolve missing dependencies identified during DI validation.
  • Module Refactoring: Updated DesktopKoinModule.kt to include the generated Koin modules and registered the new compass-related stubs.
  • Documentation: Updated roadmap.md, kmp-migration.md, and architecture-review-2026-03.md to reflect the completion of Desktop DI auto-wiring and the shift from KSP to the K2 compiler plugin for Koin annotations.

This commit migrates the Desktop (JVM) target to use the Koin K2 compiler plugin for dependency injection and introduces automated graph validation. Manual ViewModel wiring in `DesktopKoinModule` has been replaced by auto-generated modules from `commonMain`, ensuring parity with the Android implementation.

Specific changes include:
- **DI Automation**: Switched from manual `viewModel { ... }` blocks to Koin K2 compiler plugin auto-wiring for the Desktop target.
- **Graph Validation**: Added `DesktopKoinTest.kt` using Koin's `verify()` API to validate the entire Desktop DI graph (repositories, use cases, ViewModels, and stubs) at test-time.
- **New Stubs**: Implemented `NoopCompassHeadingProvider`, `NoopPhoneLocationProvider`, and `NoopMagneticFieldProvider` in `desktop/src/main/kotlin/org/meshtastic/desktop/stub/` to resolve missing dependencies identified during DI validation.
- **Module Refactoring**: Updated `DesktopKoinModule.kt` to include the generated Koin modules and registered the new compass-related stubs.
- **Documentation**: Updated `roadmap.md`, `kmp-migration.md`, and `architecture-review-2026-03.md` to reflect the completion of Desktop DI auto-wiring and the shift from KSP to the K2 compiler plugin for Koin annotations.

Signed-off-by: James Rich <[email protected]>
@github-actions github-actions bot added the enhancement New feature or request label Mar 13, 2026
@jamesarich jamesarich enabled auto-merge March 13, 2026 18:08
@jamesarich jamesarich added this pull request to the merge queue Mar 13, 2026
Merged via the queue into main with commit f45993e Mar 13, 2026
6 checks passed
@jamesarich jamesarich deleted the feat/koin-k2 branch March 13, 2026 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant