Private
Public Access
0
0

conductor(plan): Phase 1 complete - baseline + audit infrastructure ready

Phase 1 of startup_speedup_20260606 track is done.

Tasks completed:
  T1.1 baseline benchmark        -> 6f9a3af2 (docs/reports/startup_baseline_20260606.txt)
  T1.2 audit_gui2_imports.py     -> 6f9a3af2 (scripts/ + audit results)
  T1.3 StartupProfiler           -> 5a856536 (src/ + 5 tests)
  T1.4 audit_main_thread_imports -> 6f9a3af2 (scripts/ + 9 tests)
  T1.5 plan update                -> this commit

Baseline numbers (3-run median, from scripts/benchmark_imports.py):
  src.gui_2                1770ms   (main-thread bottleneck)
  simulation.user_agent    1517ms
  google.genai             1001ms
  openai                    482ms
  anthropic                 441ms
  imgui_bundle              255ms   (KEEP - ImGui hot path)
  src.theme_nerv_fx         254ms
  src.theme_nerv            246ms
  src.markdown_table        243ms
  src.command_palette       242ms

Audit violations on current codebase: 67. These are the targets
for Phases 3-5 (remove top-level heavy imports to fix each one).

Next: Phase 2 (Job Pool + Warmup Foundation).
This commit is contained in:
2026-06-06 14:24:20 -04:00
parent 6f9a3af201
commit f9a0125847
2 changed files with 13 additions and 14 deletions
@@ -9,13 +9,13 @@
## Phase 1: Audit + Benchmark + Foundation
- [ ] **T1.1** Capture baseline with `scripts/benchmark_imports.py --runs=3 --color=never > docs/startup_baseline_20260606.txt`
- [ ] **T1.2** Write `scripts/audit_gui2_imports.py` (AST walker): for each `import X` in `src/gui_2.py`, classify as `first-frame` (reachable from `main()` / `render_main_window` etc.) vs `feature-gated` (inside an `if/elif` branch that requires user action). Commit audit results to `docs/startup_audit_20260606.md`.
- [x] **T1.1** Capture baseline with `scripts/benchmark_imports.py --runs=3 --color=never > docs/reports/startup_baseline_20260606.txt` `[T1.1: 6f9a3af2]`
- [x] **T1.2** Write `scripts/audit_gui2_imports.py` (AST walker): for each `import X` in `src/gui_2.py`, classify as `first-frame` (reachable from `main()` / `render_main_window` etc.) vs `feature-gated` (inside an `if/elif` branch that requires user action). Commit audit results to `docs/reports/startup_audit_20260606.txt`. `[T1.2: 6f9a3af2]`
- [x] **T1.3** Add `src/startup_profiler.py` with `StartupProfiler` class (context manager `phase(name)`). Wire into `AppController.__init__` and `App.__init__` at 8 major init points. (No new test; verify via manual run + diagnostics panel.) `[T1.3: 5a856536]`
- [ ] **T1.4** Write `scripts/audit_main_thread_imports.py` (static gate, fails CI). AST-walks the import graph reachable from `sloppy.py`, collects all top-level `import X` / `from X import Y`, compares against an allowlist. Exits non-zero with file:line:module on violation. Allowlist: `sys.stdlib_module_names` + the lean gui_2 skeleton list from `spec.md:2.1` (`imgui_bundle`, `defer`, `src.imgui_scopes`, `src.theme_2` (default theme only), `src.theme_models`, `src.paths`, `src.models`, `src.events`).
- [ ] **T1.5** Commit baseline + audit script: `git add . && git commit -m "conductor(startup): baseline measurements + main thread import audit script"` + git note
- [x] **T1.4** Write `scripts/audit_main_thread_imports.py` (static gate, fails CI). AST-walks the import graph reachable from `sloppy.py`, collects all top-level `import X` / `from X import Y`, compares against an allowlist. Exits non-zero with file:line:module on violation. Allowlist: `sys.stdlib_module_names` + the lean gui_2 skeleton list from `spec.md:2.1` (`imgui_bundle`, `defer`, `src.imgui_scopes`, `src.theme_2` (default theme only), `src.theme_models`, `src.paths`, `src.models`, `src.events`). Walks into if/elif/else and try/except branches (which run at import time); skips function bodies. 9 tests cover all edge cases. `[T1.4: 6f9a3af2]`
- [x] **T1.5** Commit baseline + audit script: `git add . && git commit -m "..." + git note. **DONE**: commits `5a856536` (T1.3 StartupProfiler) and `6f9a3af2` (T1.2+T1.4 audit + baseline). Plan update in progress.
**Phase 1 checkpoint:** Baseline established. Static gate exists. All three import classes (first-frame, feature-gated, background-safe) documented.
**Phase 1 checkpoint:** Baseline established (docs/reports/startup_baseline_20260606.txt: 3-run median, src.gui_2 is 1770ms). Static gate exists (scripts/audit_main_thread_imports.py: currently fails with 67 violations, the list of work for Phases 3-5). All three import classes (first-frame, feature-gated, background-safe) documented.
---
@@ -6,7 +6,7 @@ track_id = "startup_speedup_20260606"
name = "Sloppy.py Startup Speedup"
status = "active"
current_phase = 1
last_updated = "2026-06-06"
last_updated = "2026-06-07"
[phases]
phase_1 = { status = "in_progress", checkpoint_sha = "", name = "Audit + Benchmark + Foundation" }
@@ -21,11 +21,11 @@ phase_9 = { status = "pending", checkpoint_sha = "", name = "Verify + Checkpoint
[tasks]
# Phase 1: Audit + Benchmark + Foundation
t1_1 = { status = "pending", commit_sha = "", description = "Capture baseline benchmark" }
t1_2 = { status = "pending", commit_sha = "", description = "Audit src/gui_2.py imports (first-frame vs feature-gated)" }
t1_3 = { status = "completed", commit_sha = "5a856536", description = "Add StartupProfiler and instrument init" }
t1_4 = { status = "pending", commit_sha = "", description = "Write scripts/audit_main_thread_imports.py (static CI gate)" }
t1_5 = { status = "pending", commit_sha = "", description = "Commit baseline + audit script" }
t1_1 = { status = "completed", commit_sha = "6f9a3af2", description = "Capture baseline benchmark to docs/reports/startup_baseline_20260606.txt" }
t1_2 = { status = "completed", commit_sha = "6f9a3af2", description = "Write scripts/audit_gui2_imports.py + commit results to docs/reports/startup_audit_20260606.txt" }
t1_3 = { status = "completed", commit_sha = "5a856536", description = "Add StartupProfiler (src/startup_profiler.py + 5 tests)" }
t1_4 = { status = "completed", commit_sha = "6f9a3af2", description = "Write scripts/audit_main_thread_imports.py (static CI gate) + 9 tests" }
t1_5 = { status = "in_progress", commit_sha = "", description = "Commit plan update (this commit)" }
# Phase 2: Job Pool + Warmup Foundation
t2_1 = { status = "pending", commit_sha = "", description = "Red: tests/test_app_controller_io_pool.py" }
t2_2 = { status = "pending", commit_sha = "", description = "Green: add _io_pool ThreadPoolExecutor to AppController" }
@@ -93,10 +93,9 @@ t9_7 = { status = "pending", commit_sha = "", description = "Phase checkpoint co
t9_8 = { status = "pending", commit_sha = "", description = "Update tracks.md; archive track" }
[verification]
# To be filled at Phase 9
baseline_ai_client_ms = 0
after_ai_client_ms = 0
baseline_gui_2_ms = 0
baseline_gui_2_ms = 1770
after_gui_2_ms = 0
baseline_app_controller_ms = 0
after_app_controller_ms = 0
@@ -105,7 +104,7 @@ warmup_modules_in_sys_modules = 0
provider_switch_latency_ms_after_warmup = 0
live_gui_passed = 0
live_gui_failed = 0
audit_main_thread_violations = 0
audit_main_thread_violations = 67
io_pool_max_workers = 4
io_pool_thread_name_prefix = "controller-io"
new_threading_thread_calls = 0