ac24b2f615
Sub-track 4 of the 5-sub-track result_migration_20260616 umbrella.
Migrates src/gui_2.py (the largest source file at 260KB / 7282 lines;
the immediate-mode ImGui rendering layer) to the data-oriented
Result[T] convention.
Scope: 42 migration-target sites (38 V + 2 S + 2 UNCLEAR) + 6 infra
sites for the drain plane. Per the user's directive (2026-06-19),
the phase structure is EXTRA LONG (13 phases instead of the umbrella's
1-2) to give Tier 2 well-defined narrow scope per phase. No phase has
more than 10 migration sites. This is the anti-sliming protocol:
previous sub-tracks slimed when scope felt tight (sub-track 2 Phase 10
slimed 21/26 sites via 5 laundering heuristics; sub-track 3 Phase 3
slimed 8 sites via logging.debug bodies). The 13-phase structure with
per-phase audit gates prevents sliming.
The 13 phases:
0. Setup + styleguide re-read (Tier 2 reads error_handling.md)
1. Site inventory + classification (42 sites in PHASE1_SITE_INVENTORY.md)
2. Drain plane wiring (3 new render functions: render_controller_error_modal,
_render_worker_error_indicator, _render_last_request_errors_modal)
3. INTERNAL_BROAD_CATCH Batch A (render-loop, <=10 sites)
4. INTERNAL_BROAD_CATCH Batch B (modal/dialog, <=10 sites)
5. INTERNAL_BROAD_CATCH Batch C (event handlers, <=10 sites)
6. Signal handler sites (<=5 sites; Pattern 3 drain: sys.exit)
7. Worker/background sites (<=5 sites; thread-safety via app._worker_errors_lock)
8. Property setter/state sites (<=5 sites)
9. Helper/utility sites (<=5 sites)
10. INTERNAL_SILENT_SWALLOW (<=13 sites; CRITICAL anti-sliming phase;
per user principle 'logging is NOT a drain')
11. INTERNAL_RETHROW classification (<=2 sites; Pattern 1/2/3)
12. UNCLEAR classification (<=2 sites)
13. Audit gate + end-of-track report (--strict exits 0; 11/11 tiers PASS)
Anti-sliming protocol per phase:
- Styleguide re-read at start of each phase (commit msg acknowledgment)
- Per-site audit pre/post check (capture before + after in commit body)
- Per-phase invariant test (test_phase_N_invariant_count_dropped)
- Per-file atomic commits (1 site = 1 commit)
- 'If a site resists migration: DO NOT invent a heuristic. Report.'
The data plane (8 controller state attributes added by sub-track 3
Phase 6: _last_request_errors, _worker_errors + lock,
_startup_timeline_errors, _signal_handler_error, _inject_preview_error,
_mcp_config_parse_error, _save_project_error, _model_fetch_errors) is
the source of truth. Sub-track 4 adds the drain plane (3 new render
functions in Phase 2) and migrates the 42 sites to feed their errors
into the data plane.
Files:
- spec.md (323 lines, 11 sections)
- plan.md (938 lines, 13 phases, 60+ atomic commits, anti-sliming protocol)
- metadata.json (14 VCs, 8 risks, scope)
- state.toml (14 phases, 102 tasks, 22 verification entries)
- tracks.md (new row 6d-4 in Active Tracks table)
Total: 5 files, 1327 lines added (excluding tracks.md).
Next: Tier 2 picks up Phase 0 (setup + styleguide re-read).