diff --git a/conductor/tracks.md b/conductor/tracks.md index a915ef38..0000daa0 100644 --- a/conductor/tracks.md +++ b/conductor/tracks.md @@ -74,11 +74,17 @@ This file tracks all major tracks for the project. Each track has its own detail ## Hot Reload Feature 1. [ ] **Track: Hot Reload Python Codebase** - *Link: [./tracks/hot_reload_python_20260510/](./tracks/hot_reload_python_20260510/)* + *Link: [./tracks/hot_reload_python_20260516/](./tracks/hot_reload_python_20260516/)* *Goal: Add file system watching capability to automatically invalidate cached AST parse trees and summaries when source files change on disk.* --- +2. [ ] **Track: Hot Reload Python Codebase (Phase 2)** + *Link: [./tracks/hot_reload_python_20260516/](./tracks/hot_reload_python_20260516/)* + *Goal: Implement selective, state-preserving hot-reload for src/gui_2.py with delegation pattern refactor, manual trigger via Ctrl+Alt+R and GUI button, and visual error tint feedback on failure.* + +--- + ## Phase 5: Codebase Curation *Initialized: 2026-05-07* @@ -124,6 +130,13 @@ This file tracks all major tracks for the project. Each track has its own detail *Link: [./tracks/app_controller_curation_20260513/](./tracks/app_controller_curation_20260513/)* *Goal: Curate src/app_controller.py to match gui_2.py organization and enforce Python style conventions.* +- [x] **Track: Fix 45 failing test files across 12 batches** +*Link: [./tracks/fix_test_suite_failures_20260514/](./tracks/fix_test_suite_failures_20260514/)* + +- [x] **Track: Fix Indentation 1-Space Convention** +*Link: [./tracks/fix_indentation_1space_20260516/](./tracks/fix_indentation_1space_20260516/)* +*Goal: Standardize all Python files to 1-space indentation per AI-Optimized Python Style Guide. Audit and correct indentation in src/, tests/, scripts/, and conductor/ directories.* + --- ## Remaining Backlog (Phases 3 & 4) @@ -263,15 +276,4 @@ This file tracks all major tracks for the project. Each track has its own detail - [x] **Track: Robust Live Simulation Verification** ---- - ---- - -- [x] **Track: Fix 45 failing test files across 12 batches** -*Link: [./tracks/fix_test_suite_failures_20260514/](./tracks/fix_test_suite_failures_20260514/)* - ---- - -- [ ] **Track: Fix Indentation 1-Space Convention** -*Link: [./tracks/fix_indentation_1space_20260516/](./tracks/fix_indentation_1space_20260516/)* -*Goal: Standardize all Python files to 1-space indentation per AI-Optimized Python Style Guide. Audit and correct indentation in src/, tests/, scripts/, and conductor/ directories.* +--- \ No newline at end of file diff --git a/conductor/tracks/hot_reload_python_20260516/metadata.json b/conductor/tracks/hot_reload_python_20260516/metadata.json new file mode 100644 index 00000000..a0e58e39 --- /dev/null +++ b/conductor/tracks/hot_reload_python_20260516/metadata.json @@ -0,0 +1,10 @@ +{ + "id": "hot_reload_python_20260516", + "title": "Hot Reload Python Codebase", + "type": "feature", + "status": "planned", + "priority": "high", + "created": "2026-05-16", + "depends_on": [], + "blocks": [] +} \ No newline at end of file diff --git a/conductor/tracks/hot_reload_python_20260516/plan.md b/conductor/tracks/hot_reload_python_20260516/plan.md new file mode 100644 index 00000000..246e651a --- /dev/null +++ b/conductor/tracks/hot_reload_python_20260516/plan.md @@ -0,0 +1,43 @@ +# Implementation Plan: Hot Reload Python Codebase + +## Phase 1: Registration & Trigger Integration +Focus: Register src.gui_2 module, add keyboard and GUI triggers + +- [~] Task 1.1: Add `_hot_reload_error` state to `App.__init__` (gui_2.py:101-251) +- [ ] Task 1.2: Add `_trigger_hot_reload()` method to `App` (gui_2.py) +- [ ] Task 1.3: Add `Ctrl+Alt+R` capture in `App.run()` main loop (gui_2.py:268-332) +- [ ] Task 1.4: Register `src.gui_2` in `AppController.__init__` with full state_keys and delegation_targets +- [ ] Task 1.5: Add "Hot Reload" button in `_render_mma_dashboard` (gui_2.py:4664-4695) +- [ ] Task 1.N: Write tests for trigger integration +- [ ] Task 1.X: Conductor - User Manual Verification + +## Phase 2: Delegation Pattern Refactor +Focus: Extract App._render_xxx methods to module-level functions in gui_2.py + +- [ ] Task 2.1: Refactor `_render_main_interface` — extract to module-level `render_main_interface(app: App)` and convert App method to thin delegation wrapper +- [ ] Task 2.2: Refactor `_render_discussion_hub` and discussion panel methods +- [ ] Task 2.3: Refactor `_render_files_and_media`, `_render_files_panel`, `_render_screenshots_panel` +- [ ] Task 2.4: Refactor `_render_ai_settings_hub`, `_render_provider_panel`, `_render_persona_selector_panel` +- [ ] Task 2.5: Refactor `_render_agent_tools_panel`, `_render_rag_panel`, `_render_system_prompts_panel` +- [ ] Task 2.6: Refactor `_render_preset_manager_content`, `_render_persona_editor_window`, `_render_tool_preset_manager_content` +- [ ] Task 2.7: Refactor `_render_operations_hub`, `_render_tool_calls_panel`, `_render_comms_history_panel` +- [ ] Task 2.8: Refactor `_render_mma_dashboard`, `_render_mma_modals`, `_render_ticket_queue`, `_render_task_dag_panel` +- [ ] Task 2.9: Refactor `_render_approve_script_modal`, `_render_patch_modal` +- [ ] Task 2.10: Write tests verifying module-level functions exist and accept `app: App` as first parameter +- [ ] Task 2.X: Conductor - User Manual Verification + +## Phase 3: Visual Error Tint +Focus: Render error overlay when HotReloader.is_error_state is True + +- [ ] Task 3.1: Add `_render_error_tint(app: App)` module-level function in gui_2.py +- [ ] Task 3.2: Call `_render_error_tint(app)` at start of `render_main_interface` +- [ ] Task 3.3: Write test for error tint rendering +- [ ] Task 3.X: Conductor - User Manual Verification + +## Phase 4: Integration & Verification +Focus: End-to-end tests via live_gui fixture + +- [ ] Task 4.1: Write e2e test — trigger hot reload, verify GUI still renders +- [ ] Task 4.2: Write e2e test — hot reload preserves state (active_discussion, show_windows, etc.) +- [ ] Task 4.3: Run full batch test suite +- [ ] Task 4.X: Conductor - User Manual Verification \ No newline at end of file diff --git a/conductor/tracks/hot_reload_python_20260516/spec.md b/conductor/tracks/hot_reload_python_20260516/spec.md new file mode 100644 index 00000000..bb979e2d --- /dev/null +++ b/conductor/tracks/hot_reload_python_20260516/spec.md @@ -0,0 +1,60 @@ +# Track Specification: Hot Reload Python Codebase + +## Overview + +Implement selective, state-preserving hot-reload for the Manual Slop `./src` Python codebase. This follows the "data in stable memory, code in reloadable modules" pattern. The initial target is `src/gui_2.py`, with a delegation pattern that decouples render logic from the stable `App` class. + +## Current State Audit (as of 3414625) + +### Already Implemented (DO NOT re-implement) + +- **HotModule dataclass** (`src/hot_reloader.py:8-12`) — Fields: `name`, `file_path`, `state_keys`, `delegation_targets` +- **HotReloader core** (`src/hot_reloader.py:14-67`) — Registry (`HOT_MODULES`), `register()`, `capture_state()`, `restore_state()`, `reload()`, `reload_all()` +- **Delegation pattern design** (`docs/superpowers/specs/2026-05-14-hot-reloader-design.md`) — Full architecture documented + +### Gaps to Fill (This Track's Scope) + +1. **No GUI trigger** — No `Ctrl+Alt+R` keyboard handler in `App.run()` (gui_2.py:268-332) and no "Hot Reload" button in MMA dashboard (gui_2.py:4664-4695) +2. **No src.gui_2 registration** — `HotReloader.HOT_MODULES` is empty; no module is registered +3. **No delegation wrappers** — All `_render_xxx` methods are bound to `App` class; must be refactored to module-level functions with thin App wrappers +4. **No visual error tint** — No overlay on `HotReloader.is_error_state == True` +5. **No state_keys inventory** — The full list of App attrs to preserve hasn't been cataloged + +## Goals + +- Manual trigger via `Ctrl+Alt+R` keyboard shortcut and GUI "Hot Reload" button +- State preservation across reloads using `copy.deepcopy` capture/restore +- Silent fallback on failure with visual error tint overlay +- Delegation pattern: module-level render functions, thin App delegation wrappers +- Extensible registry for future hot modules (ai_client.py, etc.) + +## Functional Requirements + +1. `HotReloader.register()` registers modules with state_keys and delegation_targets +2. `Ctrl+Alt+R` captured in main loop triggers `HotReloader.reload_all(app)` +3. MMA dashboard contains a "Hot Reload" button calling same +4. Failed reload renders red-tint overlay on viewport and restores pre-reload state +5. `src.gui_2` registered as first hot module with complete state_keys and delegation_targets list +6. All `App._render_xxx` methods refactored to module-level `render_xxx(app)` functions + +## Non-Functional Requirements + +- <1ms overhead per frame when not reloading +- Error tint uses ImGui draw list (no GPU shaders) +- State capture uses `copy.deepcopy` for isolation +- All errors logged to `HotReloader.last_error` with full traceback + +## Architecture Reference + +- `docs/superpowers/specs/2026-05-14-hot-reloader-design.md` — Full architecture +- `docs/guide_architecture.md` — Thread domains, event system +- `src/hot_reloader.py` — Existing core implementation +- `src/gui_2.py:App.run` (lines 268-332) — Main loop, keyboard capture target +- `src/gui_2.py:_render_mma_dashboard` (lines 4664-4695) — Button placement + +## Out of Scope + +- Automatic file watching (manual trigger only) +- Hot-reloading of C extensions or native code +- Cross-platform reload support (Windows focus) +- Adding ai_client.py as hot module (future extensibility) \ No newline at end of file