Private
Public Access
0
0

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

This commit is contained in:
2026-06-06 17:01:05 -04:00
parent 48c9649951
commit 32edad0a4b
3 changed files with 28 additions and 28 deletions
+1 -1
View File
@@ -149,7 +149,7 @@ User review surfaced five outstanding UI issues, each previously attempted witho
## Remaining Backlog (Phases 3 & 4)
0. [~] **Track: Sloppy.py Startup Speedup** `[track-created: cd4fb045] [phase-3-done: 51c054ec] [phase-4-done: 3849d304]`
0. [~] **Track: Sloppy.py Startup Speedup** `[track-created: cd4fb045] [phase-3-done: 51c054ec] [phase-4-done: 3849d304] [phase-5-abc-done: 78d3a1db+69d098ba+48c96499]`
*Link: [./tracks/startup_speedup_20260606/](./tracks/startup_speedup_20260606/), Spec: [./tracks/startup_speedup_20260606/spec.md](./tracks/startup_speedup_20260606/spec.md), Plan: [./tracks/startup_speedup_20260606/plan.md](./tracks/startup_speedup_20260606/plan.md)*
0c. [~] **Track: Test Batching Refactor** `[track-created: b7a97374]`
@@ -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.
---
@@ -5,7 +5,7 @@
track_id = "startup_speedup_20260606"
name = "Sloppy.py Startup Speedup"
status = "active"
current_phase = 4
current_phase = 5
last_updated = "2026-06-07"
[phases]
@@ -13,7 +13,7 @@ phase_1 = { status = "completed", checkpoint_sha = "f9a01258", name = "Audit + B
phase_2 = { status = "completed", checkpoint_sha = "f9a01258", name = "Job Pool + Warmup Foundation" }
phase_3 = { status = "completed", checkpoint_sha = "51c054ec", name = "Remove top-level SDK imports (ai_client)" }
phase_4 = { status = "completed", checkpoint_sha = "3849d304", name = "Remove top-level FastAPI imports (app_controller)" }
phase_5 = { status = "pending", checkpoint_sha = "", name = "Remove top-level feature-gated GUI imports" }
phase_5 = { status = "in_progress", checkpoint_sha = "", name = "Remove top-level feature-gated GUI imports (5A, 5B, 5C, 5D)" }
phase_6 = { status = "pending", checkpoint_sha = "", name = "Migrate ad-hoc threads to _io_pool" }
phase_7 = { status = "pending", checkpoint_sha = "", name = "Warmup Notification (Hook API + GUI)" }
phase_8 = { status = "pending", checkpoint_sha = "", name = "Enforcement: runtime audit hook" }
@@ -47,18 +47,18 @@ t4_3 = { status = "completed", commit_sha = "3849d304", description = "No new br
t4_4 = { status = "completed", commit_sha = "3849d304", description = "Confirmed T4.1 tests PASS (4/4 green); T3.1 tests still pass (9/9, re-export works)" }
t4_5 = { status = "completed", commit_sha = "3849d304", description = "Committed: refactor(app_controller): remove top-level fastapi imports; lift _require_warmed to shared module" }
# Phase 5: Remove top-level feature-gated GUI imports
t5a_1 = { status = "pending", commit_sha = "", description = "Red: tests/test_command_palette_no_top_level_import.py" }
t5a_2 = { status = "pending", commit_sha = "", description = "Green: remove from src/commands.py; use _require_warmed" }
t5a_3 = { status = "pending", commit_sha = "", description = "Fix existing test_command_palette.py" }
t5a_4 = { status = "pending", commit_sha = "", description = "Commit T5A" }
t5b_1 = { status = "pending", commit_sha = "", description = "Red: tests/test_theme_nerv_no_top_level_import.py" }
t5b_2 = { status = "pending", commit_sha = "", description = "Green: remove from src/theme_2.py; use _require_warmed" }
t5b_3 = { status = "pending", commit_sha = "", description = "Fix existing test_theme_2.py + test_theme_nerv.py" }
t5b_4 = { status = "pending", commit_sha = "", description = "Commit T5B" }
t5c_1 = { status = "pending", commit_sha = "", description = "Red: tests/test_markdown_helper_no_top_level_import.py" }
t5c_2 = { status = "pending", commit_sha = "", description = "Green: remove from src/markdown_helper.py; use _require_warmed" }
t5c_3 = { status = "pending", commit_sha = "", description = "Fix existing test_markdown_helper.py" }
t5c_4 = { status = "pending", commit_sha = "", description = "Commit T5C" }
t5a_1 = { status = "completed", commit_sha = "78d3a1db", description = "Red: tests/test_commands_no_top_level_command_palette.py (4 tests, 3 were FAILING)" }
t5a_2 = { status = "completed", commit_sha = "78d3a1db", description = "Green: refactored src/commands.py with _LazyCommandRegistry proxy that defers src.command_palette instantiation to first attribute access" }
t5a_3 = { status = "completed", commit_sha = "78d3a1db", description = "No fixes needed; 13 unit + 7 live_gui tests pass transparently with lazy proxy" }
t5a_4 = { status = "completed", commit_sha = "78d3a1db", description = "Committed T5A: refactor(commands): use lazy registry proxy" }
t5b_1 = { status = "completed", commit_sha = "69d098ba", description = "Red: tests/test_theme_2_no_top_level_nerv.py (4 tests, all FAILING)" }
t5b_2 = { status = "completed", commit_sha = "69d098ba", description = "Green: removed 3 top-level NERV imports + 3 module-level FX instantiations; added lookups in apply() NERV branch, ai_text_color(), render_post_fx()" }
t5b_3 = { status = "completed", commit_sha = "69d098ba", description = "No fixes needed; 21 theme tests pass" }
t5b_4 = { status = "completed", commit_sha = "69d098ba", description = "Committed T5B: refactor(theme_2): remove top-level NERV theme imports" }
t5c_1 = { status = "completed", commit_sha = "48c96499", description = "Red: tests/test_markdown_helper_no_top_level_table.py (3 tests, all FAILING)" }
t5c_2 = { status = "completed", commit_sha = "48c96499", description = "Green: removed top-level src.markdown_table import; added lookup in MarkdownRenderer.render()" }
t5c_3 = { status = "completed", commit_sha = "48c96499", description = "No fixes needed; 24 markdown tests pass" }
t5c_4 = { status = "completed", commit_sha = "48c96499", description = "Committed T5C: refactor(markdown_helper): remove top-level src.markdown_table import" }
t5d_1 = { status = "pending", commit_sha = "", description = "Run audit_gui2_imports.py and collect feature-gated list" }
t5d_2 = { status = "pending", commit_sha = "", description = "Apply same pattern per feature-gated import in src/gui_2.py; numpy in bg_shader" }
t5d_3 = { status = "pending", commit_sha = "", description = "Run full GUI test suite; fix" }