3.0 KiB
3.0 KiB
Implementation Plan: GUI Decoupling & Controller Architecture (gui_decoupling_controller_20260302)
Phase 1: Controller Skeleton & State Migration
- Task: Initialize MMA Environment
activate_skill mma-orchestrator - Task: Create
app_controller.pySkeleton- WHERE:
app_controller.py(New file) - WHAT: Create the
AppControllerclass. Initialize basic state structures (logs, metrics, flags). - HOW: Standard class definition.
- SAFETY: Do not break existing GUI yet.
- WHERE:
- Task: Migrate Data State from GUI
- WHERE:
gui_2.py:__init__andapp_controller.py - WHAT: Move variables like
_comms_log,_tool_log,mma_streams,active_ticketsto the controller. - HOW: Update GUI to reference
self.controller.mma_streamsinstead ofself.mma_streams. - SAFETY: Search and replace carefully; use
py_check_syntax.
- WHERE:
- Task: Conductor - User Manual Verification 'Phase 1: State Migration' (Protocol in workflow.md)
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_tasksqueue. - SAFETY: Thread lifecycle management is critical. Ensure shutdown hooks are migrated.
- WHERE:
- 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.
- WHERE:
- Task: Conductor - User Manual Verification 'Phase 2: Logic Migration' (Protocol in workflow.md)
Phase 3: Test Suite Refactoring
- Task: Update
conftest.pyFixtures- WHERE:
tests/conftest.py - WHAT: Update
app_instancefixture to mock/initialize theAppControllerinstead of justApp. - HOW: Adjust
patchtargets to hitapp_controller.pywhere appropriate. - SAFETY: Run subset of tests continuously to fix import breaks.
- WHERE:
- Task: Resolve Broken GUI Tests
- WHERE:
tests/test_gui_*.py - WHAT: Update test assertions that look for state on
app_instanceto look atapp_instance.controller. - HOW: Surgical string replacements.
- SAFETY: Ensure no false-positives.
- WHERE:
- Task: Conductor - User Manual Verification 'Phase 3: Test Suite Refactoring' (Protocol in workflow.md)
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)