# Implementation Plan: Tech Debt & Test Discipline Cleanup

Architecture reference: [docs/guide_architecture.md](../../../docs/guide_architecture.md)

---

## Phase 1: Test Suite Deduplication and Centralization
Focus: Move `app_instance` and `mock_app` to `tests/conftest.py` and remove them from individual test files.

- [ ] Task 1.1: Add `app_instance` and `mock_app` fixtures to `tests/conftest.py`. Ensure they properly yield the App instance and tear down.
- [ ] Task 1.2: Remove local `app_instance` and `mock_app` fixtures from all 13 identified test files. (Tier 3 Worker string replacement / rewrite).
- [ ] Task 1.3: Delete `tests/test_ast_parser_curated.py` if its contents are fully duplicated in `test_ast_parser.py`, or merge any missing tests.
- [ ] Task 1.4: Run the test suite (`pytest`) to ensure no fixture resolution errors.

## Phase 2: False-Positive Test Exposure
Focus: Make zero-assertion tests fail loudly so they can be properly tracked.

- [ ] Task 2.1: Add `pytest.fail("TODO: Implement assertions")` to `test_workflow_sim.py`, `test_sim_ai_settings.py`, `test_sim_tools.py`, `test_api_events.py` and any other tests identified as having zero assertions or just a `pass`.
- [ ] Task 2.2: Add `@pytest.mark.skip(reason="TODO: Implement assertions")` to the visual simulation tests that only have a `pass` block.

## Phase 3: Dead Code Excision in `gui_2.py`
Focus: Remove unused state variables and dead HTTP/background methods.

- [ ] Task 3.1: In `gui_2.py` `__init__`, remove the initialization of `_role`, `_ticket_id`, `_uid`, `_base_dir`, `last_md_path`, `_scroll_tool_calls_to_bottom`, `_token_budget_limit`, `_token_budget_pct`, `_token_budget_current`.
- [ ] Task 3.2: Delete the following unused method definitions from `gui_2.py`: `do_fetch`, `do_post`, `fetch_stats`, `health`, `get_session`, `list_sessions`, `delete_session`, `status`, `get_context`, `_bg_task`, `_push_t1_usage`, `_load_fonts`, `run_prune`, `_parse_history_entries`, `confirm_action`, `pending_actions`, `token_stats`.
- [ ] Task 3.3: Run `gui_2.py --headless` to verify the application still initializes properly without these variables/methods.