chore(conductor): Add new track 'Extract service/worker/radio files from app to core:service/androidMain and core:network/androidMain'

This commit is contained in:
James Rich 2026-03-17 10:22:01 -05:00
parent 5eb6e501c0
commit 343c341f75
5 changed files with 89 additions and 0 deletions

View file

@ -3,3 +3,6 @@
This file tracks all major tracks for the project. Each track has its own detailed plan in its respective folder.
---
- [ ] **Track: Extract service/worker/radio files from `app` to `core:service/androidMain` and `core:network/androidMain`**
*Link: [./tracks/extract_services_20260317/](./tracks/extract_services_20260317/)*

View file

@ -0,0 +1,5 @@
# Track extract_services_20260317 Context
- [Specification](./spec.md)
- [Implementation Plan](./plan.md)
- [Metadata](./metadata.json)

View file

@ -0,0 +1,8 @@
{
"track_id": "extract_services_20260317",
"type": "refactor",
"status": "new",
"created_at": "2026-03-17T00:00:00Z",
"updated_at": "2026-03-17T00:00:00Z",
"description": "Extract service/worker/radio files from `app` to `core:service/androidMain` and `core:network/androidMain`"
}

View file

@ -0,0 +1,41 @@
# Implementation Plan: Extract service/worker/radio files from `app`
## Phase 1: Preparation & Analysis
- [ ] Task: Identify all Android-specific classes to be moved (Services, WorkManager workers, Radio connections in `app`)
- [ ] Locate `Service` classes in `app/src/main/java/org/meshtastic/app`
- [ ] Locate WorkManager `Worker` classes
- [ ] Locate Radio connection classes
- [ ] Task: Conductor - User Manual Verification 'Preparation & Analysis' (Protocol in workflow.md)
## Phase 2: Extraction to `core:service`
- [ ] Task: Setup `core:service` module for Android and Common targets (if not already fully configured)
- [ ] Task: Move Android `Service` implementations to `core:service/androidMain`
- [ ] Move the files
- [ ] Update imports and Koin injections
- [ ] Task: Abstract shared service logic into `core:service/commonMain`
- [ ] Write failing tests for abstracted shared logic (TDD Red)
- [ ] Extract interfaces and platform-agnostic logic (TDD Green)
- [ ] Refactor the implementations to use these shared abstractions
- [ ] Task: Conductor - User Manual Verification 'Extraction to core:service' (Protocol in workflow.md)
## Phase 3: Extraction to `core:network`
- [ ] Task: Move Radio connection and networking files from `app` to `core:network/androidMain`
- [ ] Move the files
- [ ] Update imports and Koin injections
- [ ] Task: Abstract shared radio/network logic into `core:network/commonMain`
- [ ] Write failing tests for abstracted radio logic (TDD Red)
- [ ] Extract platform-agnostic business logic (TDD Green)
- [ ] Refactor implementations to use shared abstractions
- [ ] Task: Conductor - User Manual Verification 'Extraction to core:network' (Protocol in workflow.md)
## Phase 4: Desktop Integration
- [ ] Task: Integrate newly extracted shared abstractions into the `desktop` module
- [ ] Implement desktop-specific actuals or Koin bindings for the shared interfaces
- [ ] Wire up abstracted services/radio logic in desktop Koin graph
- [ ] Task: Conductor - User Manual Verification 'Desktop Integration' (Protocol in workflow.md)
## Phase 5: Verification & Cleanup
- [ ] Task: Build project and verify no regressions in background processing or radio connectivity
- [ ] Task: Verify test coverage (>80%) for all extracted and refactored code
- [ ] Task: Remove any lingering unused dependencies or dead code in `app`
- [ ] Task: Conductor - User Manual Verification 'Verification & Cleanup' (Protocol in workflow.md)

View file

@ -0,0 +1,32 @@
# Specification: Extract service/worker/radio files from `app`
## Overview
This track aims to decouple the main `app` module by extracting Android-specific service, WorkManager worker, and radio connection files into `core:service` and `core:network` modules. The goal is to maximize code reuse across Kotlin Multiplatform (KMP) targets, clarify class responsibilities, and improve unit testability by isolating the network and service layers.
## Goals
- **Decouple `app`:** Remove Android-specific service dependencies from the main app module.
- **KMP Preparation:** Migrate as much logic as possible into `commonMain` for reuse across platforms.
- **Desktop Integration:** If logic is successfully abstracted into `commonMain`, integrate and use it within the `desktop` target to ensure reusability.
- **Testability:** Isolate service and network layers to facilitate better unit testing.
- **Simplification:** Refactor logic during the move to clarify and simplify responsibilities.
## Functional Requirements
- Identify all service, worker, and radio-related classes currently residing in the `app` module.
- Move Android-specific implementations (e.g., `Service`, `Worker`) to `core:service/androidMain` and `core:network/androidMain`.
- Extract platform-agnostic business logic and interfaces into `commonMain` within those core modules.
- Refactor existing logic where necessary to establish a clear delineation of responsibility.
- Update all dependency injections (Koin modules) and imports across the project to reflect the new locations.
- Attempt to wire up the newly abstracted shared logic within the `desktop` module if applicable.
## Non-Functional Requirements
- **Architecture Compliance:** Changes must adhere to the MVI / Unidirectional Data Flow and KMP structures defined in `tech-stack.md`.
- **Performance:** Refactoring should not negatively impact app startup time or background processing efficiency.
- **Code Coverage:** Maintain or improve overall test coverage for the extracted components (>80% target).
## Acceptance Criteria
- [ ] No service, worker, or radio connection classes remain in the `app` module.
- [ ] Extracted Android-specific classes compile successfully in `core:service/androidMain` and `core:network/androidMain`.
- [ ] Shared business logic compiles successfully in `core:service/commonMain` and `core:network/commonMain`.
- [ ] If logic is abstracted for reuse, it is integrated and utilized in the `desktop` target where applicable.
- [ ] The app compiles, installs, and runs without regressions in background processing or radio connectivity.
- [ ] Unit tests for the moved and refactored classes pass.