From 343c341f75e03aec3503470dbd0791664baf22ad Mon Sep 17 00:00:00 2001 From: James Rich Date: Tue, 17 Mar 2026 10:22:01 -0500 Subject: [PATCH] chore(conductor): Add new track 'Extract service/worker/radio files from app to core:service/androidMain and core:network/androidMain' --- conductor/tracks.md | 3 ++ .../tracks/extract_services_20260317/index.md | 5 +++ .../extract_services_20260317/metadata.json | 8 ++++ .../tracks/extract_services_20260317/plan.md | 41 +++++++++++++++++++ .../tracks/extract_services_20260317/spec.md | 32 +++++++++++++++ 5 files changed, 89 insertions(+) create mode 100644 conductor/tracks/extract_services_20260317/index.md create mode 100644 conductor/tracks/extract_services_20260317/metadata.json create mode 100644 conductor/tracks/extract_services_20260317/plan.md create mode 100644 conductor/tracks/extract_services_20260317/spec.md diff --git a/conductor/tracks.md b/conductor/tracks.md index 0b5c54e3d..c8f591d10 100644 --- a/conductor/tracks.md +++ b/conductor/tracks.md @@ -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/)* \ No newline at end of file diff --git a/conductor/tracks/extract_services_20260317/index.md b/conductor/tracks/extract_services_20260317/index.md new file mode 100644 index 000000000..a8c5021ba --- /dev/null +++ b/conductor/tracks/extract_services_20260317/index.md @@ -0,0 +1,5 @@ +# Track extract_services_20260317 Context + +- [Specification](./spec.md) +- [Implementation Plan](./plan.md) +- [Metadata](./metadata.json) \ No newline at end of file diff --git a/conductor/tracks/extract_services_20260317/metadata.json b/conductor/tracks/extract_services_20260317/metadata.json new file mode 100644 index 000000000..d40405670 --- /dev/null +++ b/conductor/tracks/extract_services_20260317/metadata.json @@ -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`" +} \ No newline at end of file diff --git a/conductor/tracks/extract_services_20260317/plan.md b/conductor/tracks/extract_services_20260317/plan.md new file mode 100644 index 000000000..cee09929a --- /dev/null +++ b/conductor/tracks/extract_services_20260317/plan.md @@ -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) \ No newline at end of file diff --git a/conductor/tracks/extract_services_20260317/spec.md b/conductor/tracks/extract_services_20260317/spec.md new file mode 100644 index 000000000..32d1eb803 --- /dev/null +++ b/conductor/tracks/extract_services_20260317/spec.md @@ -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. \ No newline at end of file