conductor(plan): Mark Phase 5A-5C complete (commands, theme_2, markdown_helper lazy imports)

This commit is contained in:
ed
2026-06-06 17:01:05 -04:00
parent 48c9649951
commit 32edad0a4b
3 changed files with 28 additions and 28 deletions
@@ -91,24 +91,24 @@ Same pattern as Phase 3, for the FastAPI imports.
### 5A: Command Palette
- [ ] **T5A.1 (Red)** `tests/test_command_palette_no_top_level_import.py`: `from src.commands import COMMANDS` does not import `src.command_palette`. Confirm FAIL.
- [ ] **T5A.2 (Green)** In `src/commands.py`: remove `from src.command_palette import ...` from top. The command functions (`_open_command_palette`, `_toggle_command_palette`) call `_require_warmed("src.command_palette")` to access the module.
- [ ] **T5A.3** Run `tests/test_command_palette.py`; fix.
- [ ] **T5A.4** Commit: `refactor(commands): remove top-level command_palette import; use _require_warmed`
- [x] **T5A.1 (Red)** `tests/test_command_palette_no_top_level_import.py` (4 tests, 3 were FAILING). Commit 78d3a1db. `[T5A.1: 78d3a1db]`
- [x] **T5A.2 (Green)** In `src/commands.py`: removed `from src.command_palette import CommandRegistry`. Replaced `registry = CommandRegistry()` with a lazy proxy `_LazyCommandRegistry` that defers instantiation to first attribute access. The 32 `@registry.register` decorators are unchanged (the proxy's `register()` is a no-op that just queues). The real `CommandRegistry` is built via `_get_real_registry()` which calls `_require_warmed("src.command_palette")`. Commit 78d3a1db. `[T5A.2: 78d3a1db]`
- [x] **T5A.3** Run `tests/test_command_palette.py` + `tests/test_command_palette_sim.py`; no fixes needed. Lazy proxy is transparent to consumers. 13/13 + 7/7 pass. `[T5A.3: 78d3a1db]`
- [x] **T5A.4** Commit: `refactor(commands): use lazy registry proxy to defer src.command_palette import` (78d3a1db) + git note. `[T5A.4: 78d3a1db]`
### 5B: NERV Theme
- [ ] **T5B.1 (Red)** `tests/test_theme_nerv_no_top_level_import.py`: `from src.theme_2 import *` does not import `src.theme_nerv` or `src.theme_nerv_fx`. Confirm FAIL.
- [ ] **T5B.2 (Green)** In `src/theme_2.py`: remove `from src.theme_nerv import ...` and `from src.theme_nerv_fx import ...` from top. `apply_nerv_theme()` (or whichever function activates the theme) calls `_require_warmed("src.theme_nerv")` and `_require_warmed("src.theme_nerv_fx")`.
- [ ] **T5B.3** Run `tests/test_theme_2.py` and `tests/test_theme_nerv.py`; fix.
- [ ] **T5B.4** Commit: `refactor(theme): remove top-level nerv theme imports; use _require_warmed`
- [x] **T5B.1 (Red)** `tests/test_theme_2_no_top_level_nerv.py` (4 tests, all FAILING). Commit 69d098ba. `[T5B.1: 69d098ba]`
- [x] **T5B.2 (Green)** In `src/theme_2.py`: removed 3 top-level NERV imports (`from src import theme_nerv`, `from src.theme_nerv import DATA_GREEN`, `from src.theme_nerv_fx import CRTFilter, AlertPulsing, StatusFlicker`). Removed 3 module-level FX instantiations (`_crt_filter = CRTFilter()` etc). Added `_require_warmed("src.theme_nerv")` in `apply()` NERV branch and `ai_text_color()`. Added `_require_warmed("src.theme_nerv_fx")` in `render_post_fx()` with FX objects created locally per call. Commit 69d098ba. `[T5B.2: 69d098ba]`
- [x] **T5B.3** Run `tests/test_theme.py` + `tests/test_theme_nerv.py` + `tests/test_theme_nerv_fx.py` + `tests/test_theme_models.py`; no fixes needed. 21/21 pass. `[T5B.3: 69d098ba]`
- [x] **T5B.4** Commit: `refactor(theme_2): remove top-level NERV theme imports; use _require_warmed` (69d098ba) + git note. `[T5B.4: 69d098ba]`
### 5C: Markdown Table
- [ ] **T5C.1 (Red)** `tests/test_markdown_helper_no_top_level_import.py`: `from src.markdown_helper import MarkdownRenderer` does not import `src.markdown_table`. Confirm FAIL.
- [ ] **T5C.2 (Green)** In `src/markdown_helper.py`: remove `from src.markdown_table import ...` from top. The table-detection branch of `render()` calls `_require_warmed("src.markdown_table")`.
- [ ] **T5C.3** Run `tests/test_markdown_helper.py`; fix.
- [ ] **T5C.4** Commit: `refactor(markdown): remove top-level markdown_table import; use _require_warmed`
- [x] **T5C.1 (Red)** `tests/test_markdown_helper_no_top_level_table.py` (3 tests, all FAILING). Commit 48c96499. `[T5C.1: 48c96499]`
- [x] **T5C.2 (Green)** In `src/markdown_helper.py`: removed `from src.markdown_table import parse_tables, render_table`. Added `_require_warmed("src.markdown_table")` at the top of `MarkdownRenderer.render()` body; `parse_tables` and `render_table` are now local aliases to the warmed module's functions. Commit 48c96499. `[T5C.2: 48c96499]`
- [x] **T5C.3** Run all `test_markdown_table*.py` + `test_markdown_helper_bullets.py` + `test_markdown_render_robust.py`; no fixes needed. 24/24 pass. `[T5C.3: 48c96499]`
- [x] **T5C.4** Commit: `refactor(markdown_helper): remove top-level src.markdown_table import; use _require_warmed` (48c96499) + git note. `[T5C.4: 48c96499]`
### 5D: GUI module feature-gated imports
@@ -117,7 +117,7 @@ Same pattern as Phase 3, for the FastAPI imports.
- [ ] **T5D.3** Run full GUI test suite; fix.
- [ ] **T5D.4** Commit per feature group
**Phase 5 checkpoint:** All heavy imports removed from main-thread-reachable source files. Default-theme / non-palette / non-table path is lean. Warmup pre-loads all of them in the background.
**Phase 5 checkpoint (target):** All heavy imports removed from main-thread-reachable source files. Default-theme / non-palette / non-table path is lean. Warmup pre-loads all of them in the background.
---