# Track Debrief: Tech Debt & Test Discipline Cleanup (tech_debt_and_test_cleanup_20260302)

## Status: Botched / Partially Resolved
**CRITICAL NOTE:** This track was initialized with a flawed specification and executed with insufficient validation rigor. While some deduplication goals were achieved, it introduced significant regressions and left the test suite in a fractured state.

### 1. Specification Failures
- **Incorrect "Dead Code" Identification:** The spec incorrectly marked essential FastAPI endpoints (Remote Confirmation Protocol) as "leftovers." Removing them broke `test_headless_service.py` and the application's documented headless features. These had to be re-added mid-track.
- **Underestimated Dependency Complexity:** The spec assumed `app_instance` could be globally centralized without accounting for unique patching requirements in several files (e.g., `test_gui2_events.py`, `test_mma_dashboard_refresh.py`).

### 2. Removed / Modified Tests
- **Deleted:** `tests/test_ast_parser_curated.py` (Confirmed as a duplicate of `tests/test_ast_parser.py`).
- **Fixture Removal:** Local `app_instance` and `mock_app` fixtures were removed from the following files, now resolving from `tests/conftest.py`:
  - `tests/test_gui2_layout.py`
  - `tests/test_gui2_mcp.py`
  - `tests/test_gui_phase3.py`
  - `tests/test_gui_phase4.py`
  - `tests/test_gui_streaming.py`
  - `tests/test_live_gui_integration.py`
  - `tests/test_mma_agent_focus_phase1.py`
  - `tests/test_mma_agent_focus_phase3.py`
  - `tests/test_mma_orchestration_gui.py`
  - `tests/test_mma_ticket_actions.py`
  - `tests/test_token_viz.py`

### 3. Exposed Zero-Assertion Tests (Marked with `pytest.fail`)
The following tests now fail loudly to prevent false-positive coverage:
- `tests/test_agent_capabilities.py`
- `tests/test_agent_tools_wiring.py`
- `tests/test_api_events.py::test_send_emits_events`
- `tests/test_execution_engine.py::test_execution_engine_update_nonexistent_task`
- `tests/test_token_usage.py`
- `tests/test_vlogger_availability.py`

### 4. Known Regressions / Unresolved Issues
- **Simulation Failures:** `test_extended_sims.py::test_context_sim_live` fails with `AssertionError: Expected at least 2 entries, found 0`.
- **Asyncio RuntimeErrors:** Widespread `RuntimeError: Event loop is closed` warnings and potential hangs in `test_spawn_interception.py` (partially addressed but not fully stable).
- **Broken Logic:** The centralization of fixtures may have masked subtle timing issues in UI event processing that were previously "fixed" by local, idiosyncratic patches.

### 5. Guidance for Tier 1 / Next Track
- **Immediate Priority:** The next track MUST focus on "unfucking" the testing suite. Do not attempt further feature implementation until the `Event loop is closed` errors and simulation failures are resolved.
- **Audit Requirement:** Re-audit all files where fixtures were removed to ensure no side-effect-heavy patches were lost.
- **Validation Mandate:** Future Tech Lead agents MUST be forbidden from claiming "passed perfectly" without a verifiable, green `pytest` output for the full suite.
