chore(conductor): Enhance all 6 backlog tracks to Surgical Spec Protocol
This commit is contained in:
@@ -1,18 +1,49 @@
|
||||
# Implementation Plan: GUI Decoupling
|
||||
# Implementation Plan: GUI Decoupling & Controller Architecture (gui_decoupling_controller_20260302)
|
||||
|
||||
## Phase 1: Controller Skeleton
|
||||
## Phase 1: Controller Skeleton & State Migration
|
||||
- [ ] Task: Initialize MMA Environment `activate_skill mma-orchestrator`
|
||||
- [ ] Task: Create `app_controller.py`.
|
||||
- [ ] Task: Conductor - User Manual Verification 'Phase 1'
|
||||
- [ ] Task: Create `app_controller.py` Skeleton
|
||||
- [ ] WHERE: `app_controller.py` (New file)
|
||||
- [ ] WHAT: Create the `AppController` class. Initialize basic state structures (logs, metrics, flags).
|
||||
- [ ] HOW: Standard class definition.
|
||||
- [ ] SAFETY: Do not break existing GUI yet.
|
||||
- [ ] Task: Migrate Data State from GUI
|
||||
- [ ] WHERE: `gui_2.py:__init__` and `app_controller.py`
|
||||
- [ ] WHAT: Move variables like `_comms_log`, `_tool_log`, `mma_streams`, `active_tickets` to the controller.
|
||||
- [ ] HOW: Update GUI to reference `self.controller.mma_streams` instead of `self.mma_streams`.
|
||||
- [ ] SAFETY: Search and replace carefully; use `py_check_syntax`.
|
||||
- [ ] Task: Conductor - User Manual Verification 'Phase 1: State Migration' (Protocol in workflow.md)
|
||||
|
||||
## Phase 2: State Migration
|
||||
- [ ] Task: Move App state from `gui_2.py` to controller.
|
||||
- [ ] Task: Conductor - User Manual Verification 'Phase 2'
|
||||
## Phase 2: Logic & Background Thread Migration
|
||||
- [ ] Task: Extract Background Threads & Event Queue
|
||||
- [ ] WHERE: `gui_2.py` (e.g., `_init_ai_and_hooks`, `_process_event_queue`)
|
||||
- [ ] WHAT: Move the `AsyncEventQueue`, asyncio worker thread, and HookServer initialization to the controller.
|
||||
- [ ] HOW: The GUI should just call `self.controller.start_services()` and read the `_pending_gui_tasks` queue.
|
||||
- [ ] SAFETY: Thread lifecycle management is critical. Ensure shutdown hooks are migrated.
|
||||
- [ ] Task: Extract I/O and AI Methods
|
||||
- [ ] WHERE: `gui_2.py` (`_cb_plan_epic`, `_flush_to_project`, `_cb_create_track`)
|
||||
- [ ] WHAT: Move business logic methods to the controller.
|
||||
- [ ] HOW: GUI callbacks simply become `lambda: self.controller.plan_epic(input)`.
|
||||
- [ ] SAFETY: Verify Hook API endpoints still work.
|
||||
- [ ] Task: Conductor - User Manual Verification 'Phase 2: Logic Migration' (Protocol in workflow.md)
|
||||
|
||||
## Phase 3: Logic Migration
|
||||
- [ ] Task: Move non-rendering methods to controller.
|
||||
- [ ] Task: Conductor - User Manual Verification 'Phase 3'
|
||||
## Phase 3: Test Suite Refactoring
|
||||
- [ ] Task: Update `conftest.py` Fixtures
|
||||
- [ ] WHERE: `tests/conftest.py`
|
||||
- [ ] WHAT: Update `app_instance` fixture to mock/initialize the `AppController` instead of just `App`.
|
||||
- [ ] HOW: Adjust `patch` targets to hit `app_controller.py` where appropriate.
|
||||
- [ ] SAFETY: Run subset of tests continuously to fix import breaks.
|
||||
- [ ] Task: Resolve Broken GUI Tests
|
||||
- [ ] WHERE: `tests/test_gui_*.py`
|
||||
- [ ] WHAT: Update test assertions that look for state on `app_instance` to look at `app_instance.controller`.
|
||||
- [ ] HOW: Surgical string replacements.
|
||||
- [ ] SAFETY: Ensure no false-positives.
|
||||
- [ ] Task: Conductor - User Manual Verification 'Phase 3: Test Suite Refactoring' (Protocol in workflow.md)
|
||||
|
||||
## Phase 4: Validation
|
||||
- [ ] Task: Update all tests to mock/use the controller.
|
||||
- [ ] Task: Conductor - User Manual Verification 'Phase 4'
|
||||
## Phase 4: Final Validation
|
||||
- [ ] Task: Full Suite Validation & Warning Cleanup
|
||||
- [ ] WHERE: Project root
|
||||
- [ ] WHAT: `uv run pytest`
|
||||
- [ ] HOW: Ensure 100% pass rate.
|
||||
- [ ] SAFETY: Watch out for lingering thread closure issues.
|
||||
- [ ] Task: Conductor - User Manual Verification 'Phase 4: Final Validation' (Protocol in workflow.md)
|
||||
@@ -1,9 +1,21 @@
|
||||
# Track Specification: GUI Decoupling & Controller Architecture
|
||||
# Track Specification: GUI Decoupling & Controller Architecture (gui_decoupling_controller_20260302)
|
||||
|
||||
## Overview
|
||||
`gui_2.py` is a monolithic God Object. This track extracts its business logic and state machine into `app_controller.py`, leaving the GUI as a pure immediate-mode view adhering to Data-Oriented Design.
|
||||
`gui_2.py` currently operates as a Monolithic God Object (3,500+ lines). It violates the Data-Oriented Design heuristic by owning complex business logic, orchestrator hooks, and markdown file building. This track extracts the core state machine and lifecycle into a headless `app_controller.py`, turning the GUI into a pure immediate-mode view.
|
||||
|
||||
## Architectural Constraints: The "Immediate Mode View" Contract
|
||||
- **No Business Logic in View**: `gui_2.py` MUST NOT perform file I/O, AI API calls, or subprocess management directly.
|
||||
- **State Ownership**: `app_controller.py` (or equivalent) owns the "Source of Truth" state.
|
||||
- **Event-Driven Mutations**: The GUI must mutate state exclusively by dispatching events or calling controller methods, never by directly manipulating backend objects in the render loop.
|
||||
|
||||
## Functional Requirements
|
||||
- Create `app_controller.py`.
|
||||
- Migrate state variables and lifecycle methods from `gui_2.py` to the controller.
|
||||
- Ensure `gui_2.py` only reads state and dispatches events.
|
||||
- **Controller Extraction**: Create `app_controller.py` to handle all non-rendering logic.
|
||||
- **State Migration**: Move state variables (`_tool_log`, `_comms_log`, `active_tickets`, etc.) out of `App.__init__` into the controller.
|
||||
- **Logic Migration**: Move background threads, file reading/writing (`_flush_to_project`), and AI orchestrator invocations to the controller.
|
||||
- **View Refactoring**: Refactor `gui_2.py` to accept the controller as a dependency and merely render its current state.
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] `app_controller.py` exists and owns the application state.
|
||||
- [ ] `gui_2.py` has been reduced in size and complexity (no file I/O or AI calls).
|
||||
- [ ] All existing features (chat, tools, tracks) function identically.
|
||||
- [ ] The full test suite runs and passes against the new decoupled architecture.
|
||||
Reference in New Issue
Block a user