docs: Reorder track queue and initialize final stabilization tracks

- Initialize asyncio_decoupling_refactor_20260306 track

- Initialize mock_provider_hardening_20260305 track

- Initialize simulation_fidelity_enhancement_20260305 track

- Update TASKS.md and tracks.md to reflect new strict execution queue

- Archive completed tracks and remove deprecated test performance track
This commit is contained in:
2026-03-05 09:43:42 -05:00
parent e21cd64833
commit c295db1630
11 changed files with 222 additions and 50 deletions

View File

@@ -0,0 +1,8 @@
{
"id": "asyncio_decoupling_refactor_20260306",
"title": "Asyncio Decoupling & Queue Refactor",
"description": "Rip out asyncio from AppController to eliminate test deadlocks.",
"status": "planned",
"created_at": "2026-03-05T00:00:00Z",
"updated_at": "2026-03-05T00:00:00Z"
}

View File

@@ -0,0 +1,33 @@
# Implementation Plan: Asyncio Decoupling Refactor (asyncio_decoupling_refactor_20260306)
> **TEST DEBT FIX:** This track is responsible for permanently eliminating the `RuntimeError: Event loop is closed` test suite crashes by ripping out the conflict-prone asyncio loops from the AppController.
## Phase 1: Event System Migration
- [ ] Task: Initialize MMA Environment `activate_skill mma-orchestrator`
- [ ] Task: Refactor `events.py`
- [ ] WHERE: `src/events.py`
- [ ] WHAT: Replace `AsyncEventQueue` with `SyncEventQueue` using `import queue`.
- [ ] HOW: Change `async def get()` to a blocking `def get()`. Remove `asyncio` imports.
- [ ] SAFETY: Ensure thread-safety.
- [ ] Task: Conductor - User Manual Verification 'Phase 1: Event System'
## Phase 2: AppController Decoupling
- [ ] Task: Refactor `AppController` Event Loop
- [ ] WHERE: `src/app_controller.py`
- [ ] WHAT: Remove `self._loop` and `asyncio.new_event_loop()`.
- [ ] HOW: Change `_run_event_loop` to just call `_process_event_queue` directly (which will now block on queue gets).
- [ ] SAFETY: Ensure `shutdown()` properly signals the queue to unblock and join the thread.
- [ ] Task: Thread Task Dispatching
- [ ] WHERE: `src/app_controller.py`
- [ ] WHAT: Replace `asyncio.run_coroutine_threadsafe(self.event_queue.put(...))` with direct synchronous `.put()`. Replace `self._loop.run_in_executor` with `threading.Thread(target=self._handle_request_event)`.
- [ ] HOW: Mechanical replacement of async primitives.
- [ ] SAFETY: None.
- [ ] Task: Conductor - User Manual Verification 'Phase 2: Decoupling'
## Phase 3: Final Validation
- [ ] Task: Full Suite Validation
- [ ] WHERE: Project root
- [ ] WHAT: `uv run pytest`
- [ ] HOW: Ensure 100% pass rate with no hanging threads or event loop errors.
- [ ] SAFETY: None.
- [ ] Task: Conductor - User Manual Verification 'Phase 3: Final Validation'

View File

@@ -0,0 +1,14 @@
# Specification: Asyncio Decoupling & Refactor
## Background
The `AppController` currently utilizes an internal `asyncio.Queue` and a dedicated `_loop_thread` to manage background tasks and GUI updates. As identified in the `test_architecture_integrity_audit_20260304`, this architecture leads to severe event loop exhaustion and `RuntimeError: Event loop is closed` deadlocks during full test suite runs due to conflicts with `pytest-asyncio`'s loop management.
## Objective
Remove all `asyncio` dependencies from `AppController` and `events.py`. Replace the asynchronous event queue with a standard, thread-safe `queue.Queue` from Python's standard library.
## Requirements
1. **Remove Asyncio:** Strip `import asyncio` from `app_controller.py` and `events.py`.
2. **Synchronous Queues:** Convert `events.AsyncEventQueue` to a standard synchronous wrapper around `queue.Queue`.
3. **Daemon Thread Processing:** Convert `AppController._process_event_queue` from an `async def` to a standard synchronous `def` that blocks on `self.event_queue.get()`.
4. **Thread Offloading:** Use `threading.Thread` or `concurrent.futures.ThreadPoolExecutor` to handle AI request dispatching (instead of `self._loop.run_in_executor`).
5. **No Regressions:** The application must remain responsive (60 FPS) and all unit/integration tests must pass cleanly.