Private
Public Access
0
0
Commit Graph

480 Commits

Author SHA1 Message Date
ed f0ae074aec fix(gui_2): restore _last_imgui_assert as string (regression from Phase 10)
The Phase 10 migration of the run() function (L728 INTERNAL_SILENT_SWALLOW)
changed App.run's error drain to set self.controller._last_imgui_assert
to traceback.format_exception(...), which returns a list. But the
existing test test_app_run_imgui_assert_handling.py expects it to be
a string containing 'Missing End'.

Fix: set _last_imgui_assert to str(err.original) if available, else
err.message. The IM_ASSERT message string is what the health endpoint
expects.

TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 13.

Regression test: tests/test_app_run_imgui_assert_handling.py
test_app_run_records_degraded_state_on_imgui_assert PASSES after fix.
2026-06-20 02:39:47 -04:00
ed df481f72ea TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 10: fix(gui_2): restore App class structure with all 13 Phase 10 sites correctly migrated
Previous Phase 10 commits (e761244c..02dcca44) introduced indent bugs that
collapsed the App class to 6 methods (from 65), breaking test_phase_2_invariant
and 50+ other live_gui tests. This commit reapplies all 13 sites with
correct byte-level indentation (1-space indent for class members, 2-space
for body, helpers at module level BEFORE def main()).

ANTI-SLIMING VERIFIED: all 13 INTERNAL_SILENT_SWALLOW sites migrated to
Result[T] with full propagation. logging NOT a drain per the user's
principle 2026-06-17.

Sites:
- Site 3: L612 _post_init callback -> _post_init_callback_result
- Site 4: L728 run() immapp.call -> _run_immapp_result
- Site 5: L1052 shutdown save_ini -> _shutdown_save_ini_result
- Site 6: L1152 _gui_func entry log -> _gui_func_entry_log_result
- Site 7: L1466 _close_vscode_diff terminate -> _close_vscode_diff_terminate_result
- Site 8: L1647 render_main_interface focus_response -> _focus_response_window_result
- Site 9: L1693 render_main_interface autosave -> _autosave_flush_result
- Site 10: L4911 _on_warmup_complete_callback -> _on_warmup_complete_callback_result
- Site 11: L6908 render_tier_stream_panel scroll_sync -> _tier_stream_scroll_sync_result
- Site 12: L7271 render_task_dag_panel cycle_check -> _dag_cycle_check_result
- Site 13: L7315 render_task_dag_panel ticket_id_parse -> _ticket_id_max_int_result

(Sites 1-2 already correctly migrated in c7303838 and 6585cdc5)

Tests: all 97 tests pass (29 Phase 10 + 68 prior phases).
Audit: INTERNAL_SILENT_SWALLOW count in src/gui_2.py = 0 (was 13).
2026-06-20 01:42:59 -04:00
ed 3c752eb2ae TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 10: refactor(gui_2): migrate L7315 render_task_dag_panel ticket_id_parse to Result[T] (Phase 10 site 13)
Extracted _ticket_id_max_int_result(tid) -> Result[int] helper above
the call site in render_task_dag_panel.
ANTI-SLIMING: full Result[T] propagation (NO bare-except+pass). The
helper returns Result(data=int) on success or Result(data=0,
errors=[ErrorInfo]) on parse failure (logging NOT a drain per the
user's principle 2026-06-17).

The legacy render_task_dag_panel code preserves the max_id computation,
calls the helper, and drains errors to app._last_request_errors.

Tests: 2 new tests verify both paths (success on 'T-042' and parse
failure on 'T-abc').

Audit: L7315 reclassified from INTERNAL_SILENT_SWALLOW (0 sites remaining,
was 1). New helper L7315 is INTERNAL_COMPLIANT.
2026-06-20 01:03:15 -04:00
ed b4a6ebc101 TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 10: refactor(gui_2): migrate L7271 render_task_dag_panel cycle_check to Result[T] (Phase 10 site 12)
Extracted _dag_cycle_check_result(app) -> Result[bool] helper above the
call site in render_task_dag_panel.
ANTI-SLIMING: full Result[T] propagation (NO except+pass). The helper
returns Result(data=has_cycle) on success (True/False) or
Result(data=False, errors=[ErrorInfo]) on exception (logging NOT a drain
per the user's principle 2026-06-17).

The legacy render_task_dag_panel code preserves its signature, calls the
helper, opens the 'Cycle Detected!' popup only when the helper returns
Result(data=True), and drains errors to app._last_request_errors.

Tests: 3 new tests verify no-cycle, cycle-detected, and RuntimeError paths.

Audit: L7271 reclassified from INTERNAL_SILENT_SWALLOW (1 site remaining,
was 2). New helper L7271 is INTERNAL_COMPLIANT.
2026-06-20 01:01:40 -04:00
ed e2d2105b16 TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 10: refactor(gui_2): migrate L6908 render_tier_stream_panel scroll_sync to Result[T] (Phase 10 site 11)
Extracted _tier_stream_scroll_sync_result(app, stream_key, content, imgui_mod)
-> Result[None] helper above the call site.
ANTI-SLIMING: full Result[T] propagation (NO narrowing+pass). The helper
returns Result(data=None) on success or Result(data=None, errors=[ErrorInfo])
on exception (logging NOT a drain per the user's principle 2026-06-17).

The legacy render_tier_stream_panel code preserves the imgui.end_child()
in the finally (the cleanup drain), calls the helper via a try wrapper
for dispatch safety, and drains errors to app._last_request_errors.

Tests: 2 new tests verify both paths (success and AttributeError).

Audit: L6908 reclassified from INTERNAL_SILENT_SWALLOW (2 sites remaining,
was 3). New helper L6908 is INTERNAL_COMPLIANT.
2026-06-20 01:00:31 -04:00
ed 602c1b48e7 TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 10: refactor(gui_2): migrate L4911 _on_warmup_complete_callback to Result[T] (Phase 10 site 10)
Extracted _on_warmup_complete_callback_result(app, status) -> Result[None]
helper above the callback.
ANTI-SLIMING: full Result[T] propagation (NO except+pass-after-log). The
helper returns Result(data=None) on success or Result(data=None,
errors=[ErrorInfo]) on exception (logging NOT a drain per the user's
principle 2026-06-17).

The legacy _on_warmup_complete_callback preserves its signature, calls
the helper, and drains to app.controller._worker_errors with the
controller lock acquired on append (thread-safety critical per
sub-track 4 spec).

Tests: 2 new tests verify both paths (success and RuntimeError).

Audit: L4911 reclassified from INTERNAL_SILENT_SWALLOW (4 sites remaining,
was 5). New helper L4911 is INTERNAL_COMPLIANT.
2026-06-20 00:58:10 -04:00
ed 1e5a742813 TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 10: refactor(gui_2): migrate L1693 render_main_interface autosave to Result[T] (Phase 10 site 9)
Extracted _autosave_flush_result(app) -> Result[None] helper above the
call site in render_main_interface.
ANTI-SLIMING: full Result[T] propagation (NO except+pass with comment).
The helper returns Result(data=None) on success or Result(data=None,
errors=[ErrorInfo]) on exception (logging NOT a drain per the user's
principle 2026-06-17). The 'don't disrupt the GUI loop' intent is
preserved via the data plane (app._last_request_errors) rather than
silent swallow.

The legacy render_main_interface code preserves its behavior, calls the
helper, and drains errors to app._last_request_errors.

Tests: 2 new tests verify both paths (success and OSError).

Audit: L1693 reclassified from INTERNAL_SILENT_SWALLOW (5 sites remaining,
was 6). New helper L1693 is INTERNAL_COMPLIANT.
2026-06-20 00:56:58 -04:00
ed 9188e548ff TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 10: refactor(gui_2): migrate L1647 render_main_interface focus_response to Result[T] (Phase 10 site 8)
Extracted _focus_response_window_result() -> Result[None] helper above
the call site in render_main_interface.
ANTI-SLIMING: full Result[T] propagation (NO bare-except+pass). The
helper returns Result(data=None) on success or Result(data=None,
errors=[ErrorInfo]) on exception (logging NOT a drain per the user's
principle 2026-06-17).

The legacy render_main_interface code preserves its behavior, calls
the helper, drains errors to app._last_request_errors.

Tests: 2 new tests verify both paths (success and RuntimeError).

Audit: L1647 reclassified from INTERNAL_SILENT_SWALLOW (6 sites remaining,
was 7). New helper L1647 is INTERNAL_COMPLIANT.
2026-06-20 00:53:35 -04:00
ed 24191c827d TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 10: refactor(gui_2): migrate L1466 _close_vscode_diff terminate to Result[T] (Phase 10 site 7)
Extracted _close_vscode_diff_terminate_result(app) -> Result[None]
helper above the App._close_vscode_diff method.
ANTI-SLIMING: full Result[T] propagation (NO except+pass). The helper
returns Result(data=None) on success or Result(data=None,
errors=[ErrorInfo]) on exception (logging NOT a drain per the user's
principle 2026-06-17).

The legacy _close_vscode_diff method preserves its signature, calls
the helper, drains errors to self._last_request_errors, and proceeds
to set self._vscode_diff_process = None (preserving the original
post-error behavior of clearing the handle).

Tests: 2 new tests verify both paths (success and OSError).

Audit: L1466 reclassified from INTERNAL_SILENT_SWALLOW (7 sites remaining,
was 8). New helper L1466 is INTERNAL_COMPLIANT.
2026-06-20 00:52:01 -04:00
ed 96886772fd TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 10: refactor(gui_2): migrate L1152 _gui_func entry log to Result[T] (Phase 10 site 6)
Extracted _gui_func_entry_log_result(app) -> Result[None] helper above
the App._gui_func method.
ANTI-SLIMING: full Result[T] propagation (NO except+pass-after-log).
The helper returns Result(data=None) on success or Result(data=None,
errors=[ErrorInfo]) on exception (logging NOT a drain per the user's
principle 2026-06-17).

The legacy _gui_func method preserves its signature, calls the helper,
drains errors to self._last_request_errors, and proceeds with the
rest of the render loop.

Tests: 2 new tests verify both paths (success and OSError).

Audit: L1152 reclassified from INTERNAL_SILENT_SWALLOW (8 sites remaining,
was 9). New helper L1152 is INTERNAL_COMPLIANT.
2026-06-20 00:50:20 -04:00
ed cab4548f78 TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 10: refactor(gui_2): migrate L1052 shutdown save_ini to Result[T] (Phase 10 site 5)
Extracted _shutdown_save_ini_result(app) -> Result[None] helper above
the App.shutdown method.
ANTI-SLIMING: full Result[T] propagation (NO bare-except+pass). The
helper returns Result(data=None) on success or Result(data=None,
errors=[ErrorInfo]) on exception (logging NOT a drain per the user's
principle 2026-06-17).

The legacy shutdown method preserves its signature, calls the helper,
drains errors to self._startup_timeline_errors, and proceeds to
self.controller.shutdown().

Tests: 2 new tests verify both paths (success and OSError).

Audit: L1052 reclassified from INTERNAL_SILENT_SWALLOW (9 sites remaining,
was 10). New helper L1052 is INTERNAL_COMPLIANT.
2026-06-20 00:49:00 -04:00
ed ad702f7e88 TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 10: refactor(gui_2): migrate L728 run() immapp call to Result[T] (Phase 10 site 4)
Extracted _run_immapp_result(app) -> Result[None] helper above the
App.run method.
ANTI-SLIMING: full Result[T] propagation (NO pass-after-print). The
helper returns Result(data=None) on success or Result(data=None,
errors=[ErrorInfo]) on exception (logging NOT a drain per the user's
principle 2026-06-17). The legacy run() wrapper sets
controller._gui_degraded_reason and _last_imgui_assert (the canonical
degradation drain), appends to _startup_timeline_errors, and returns
WITHOUT the original stderr.print logging.

Tests: 2 new tests verify both paths (success and RuntimeError).

Audit: L728 reclassified from INTERNAL_SILENT_SWALLOW (10 sites remaining,
was 11). New helper L728 is INTERNAL_COMPLIANT.
2026-06-20 00:46:43 -04:00
ed e761244c4a TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 10: refactor(gui_2): migrate L612 _post_init callback to Result[T] (Phase 10 site 3)
Extracted _post_init_callback_result(app) -> Result[None] helper above
the App._post_init method.
ANTI-SLIMING: full Result[T] propagation (NO pass-after-logging). The
helper returns Result(data=None) on success or Result(data=None,
errors=[ErrorInfo]) on exception (logging NOT a drain per the user's
principle 2026-06-17).

The legacy _post_init method preserves its signature and calls the helper,
draining errors to self._startup_timeline_errors.

Tests: 2 new tests verify both paths (success and RuntimeError).

Audit: L612 reclassified from INTERNAL_SILENT_SWALLOW (10 sites remaining,
was 11). New helper L612 is INTERNAL_COMPLIANT.
2026-06-20 00:44:30 -04:00
ed 6585cdc5e7 TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 10: refactor(gui_2): migrate L264 _resolve_font_path to Result[T] (Phase 10 site 2)
Extracted _resolve_font_path_result(font_path, assets_dir) -> Result[str]
helper above the legacy wrapper.
ANTI-SLIMING: full Result[T] propagation (NO narrowing+logging). The helper
returns Result(data=resolved_path) on success or Result(data=fallback,
errors=[ErrorInfo]) on exception at Path.is_relative_to (logging NOT a
drain per the user's principle 2026-06-17).

The legacy _resolve_font_path() wrapper preserves its signature and
delegates to the helper. The call site in App._load_fonts invokes the
result helper directly and drains errors to self._startup_timeline_errors.

Tests: 2 new tests verify both paths (relative-under-assets success and
is_relative_to raising ValueError on cross-drive paths).

Audit: L264 reclassified from INTERNAL_SILENT_SWALLOW (11 sites remaining,
was 12). New helper L243 is INTERNAL_COMPLIANT.
2026-06-20 00:43:29 -04:00
ed c73038382e TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 10: refactor(gui_2): migrate L216 _detect_refresh_rate_win32 to Result[T] (Phase 10 site 1)
Extracted _detect_refresh_rate_win32_result() helper above the legacy wrapper.
ANTI-SLIMING: full Result[T] propagation (NO narrowing+logging). The helper
returns Result(data=rate) on success or Result(data=0.0, errors=[ErrorInfo])
on exception (logging NOT a drain per the user's principle 2026-06-17).

The legacy _detect_refresh_rate_win32() wrapper preserves its signature and
delegates to the helper. The call site in App.__init__ invokes the result
helper directly and drains errors to self._startup_timeline_errors.

Tests: 2 new tests (test_phase_10_l216_detect_refresh_rate_win32_result_success,
test_phase_10_l216_detect_refresh_rate_win32_result_failure) verify both paths.

Audit: L216 reclassified from INTERNAL_SILENT_SWALLOW (12 sites remaining,
was 13). New helper L219 is INTERNAL_COMPLIANT.
2026-06-20 00:42:06 -04:00
ed f0c0de915c TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 8: refactor(gui_2): migrate L897 _capture_workspace_profile to Result[T] (Phase 8)
Migrate the imgui.save_ini_settings_to_memory try/except in
App._capture_workspace_profile (L897) to the canonical Result[T] pattern:

- Extract _capture_workspace_profile_ini_result(app) -> Result[str]
  helper into Phase 8 Property Setter / State Result Helpers region.
- The legacy _capture_workspace_profile method calls the helper and
  drains errors to app._last_request_errors (per FR-BC-4 event-handler
  drain pattern; this is a property setter on the App).
- The original fallback behavior (ini = '' on failure) is preserved
  so the legacy WorkspaceProfile still constructs with empty ini_content.

Tests:
- test_phase_8_l897_capture_workspace_profile_ini_result_success
- test_phase_8_l897_capture_workspace_profile_ini_result_failure

Audit: INTERNAL_BROAD_CATCH count in src/gui_2.py is now 0. All 22
INTERNAL_BROAD_CATCH sites originally in src/gui_2.py have been
migrated to Result[T] across Phases 3-8.
2026-06-20 00:25:33 -04:00
ed d3b71a7304 TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 8: refactor(gui_2): migrate L591 _diag_layout_state to Result[T] (Phase 8)
Migrate the ini-file-read try/except in App._diag_layout_state (L591) to
the canonical Result[T] pattern:

- Extract _diag_layout_state_ini_text_result(app, ini_path) -> Result[str]
  helper into new Phase 8 Property Setter / State Result Helpers region.
- The legacy _diag_layout_state method calls the helper and drains errors
  to app._startup_timeline_errors (the Phase 2 drain plane for startup
  callbacks).
- The original fallback behavior (early return on read failure, stderr
  write for visibility) is preserved.

Tests:
- test_phase_8_l591_diag_layout_state_ini_text_result_success
- test_phase_8_l591_diag_layout_state_ini_text_result_failure

Audit: INTERNAL_BROAD_CATCH count in src/gui_2.py dropped from 2 to 1
(remaining: L896 _capture_workspace_profile, formerly L897 in inventory).
2026-06-20 00:24:13 -04:00
ed bcfb4887b1 TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 7: refactor(gui_2): migrate L4321 worker to Result[T] (Phase 7)
Migrate the worker() closure in _check_auto_refresh_context_preview (L4321)
to the canonical Result[T] pattern:

- Extract _worker_context_preview_result(app) -> Result[None] helper into
  new Phase 7 Worker/Background Result Helpers region.
- The legacy worker() wrapper calls the helper and drains errors to
  app.controller._worker_errors (with controller._worker_errors_lock
  acquired on append) per sub-track 3 Phase 6 Group 6.5 telemetry drain.
- The try/finally cleanup (setting _is_generating_preview=False and
  handling _pending_preview_refresh) is preserved verbatim.

Tests:
- test_phase_7_l4321_worker_context_preview_result_success
- test_phase_7_l4321_worker_context_preview_result_failure

Audit: INTERNAL_BROAD_CATCH count in src/gui_2.py dropped from 3 to 2
(remaining: L591 _diag_layout_state, L897 _capture_workspace_profile).

The lock-protected append ensures thread-safety when multiple worker
threads call _report-style drains concurrently. The helper preserves
the original fallback behavior (app.context_preview_text =
'Error generating context preview.' on failure) so the user-visible
UX is unchanged.
2026-06-20 00:20:52 -04:00
ed 2c17fde57e TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 5: refactor(gui_2): migrate L7208 render_beads_tab list to Result[T] (Phase 5)
Extract _render_beads_tab_list_result helper from the beads_client.BeadsClient
+ list_beads() try/except in render_beads_tab. Legacy wrapper drains errors
to app._last_request_errors per FR-BC-4 event-handler pattern.

[pre-audit] L7208 INTERNAL_BROAD_CATCH
[post-audit] V count: 4 -> 3 (L7208 removed)
2026-06-20 00:06:52 -04:00
ed 9a3be5eda8 TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 5: refactor(gui_2): migrate L5920 render_external_editor_panel config to Result[T] (Phase 5)
Extract _render_external_editor_panel_config_result helper from the external
editor config rendering try/except in render_external_editor_panel. Legacy
wrapper drains errors to app._last_request_errors per FR-BC-4
event-handler pattern.

[pre-audit] L5920 INTERNAL_BROAD_CATCH
[post-audit] V count: 5 -> 4 (L5920 removed)
2026-06-20 00:04:53 -04:00
ed 82b5648f3b TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 5: refactor(gui_2): migrate L5786 render_text_viewer_window ced to Result[T] (Phase 5)
Extract _render_text_viewer_window_ced_result helper from the
TextEditor set_text/render try/except in render_text_viewer_window CED
branch. Legacy wrapper drains errors to app._last_request_errors per FR-BC-4
event-handler pattern.

[pre-audit] L5786 INTERNAL_BROAD_CATCH
[post-audit] V count: 6 -> 5 (L5786 removed)
2026-06-20 00:02:10 -04:00
ed 6119143400 TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 5: refactor(gui_2): migrate L5380 render_operations_hub ext_editor_panel to Result[T] (Phase 5)
Extract _render_operations_hub_external_editor_panel_result helper from the
render_external_editor_panel call try/except in render_operations_hub
External Tools tab. Legacy wrapper drains errors to app._last_request_errors
per FR-BC-4 event-handler pattern.

[pre-audit] L5380 INTERNAL_BROAD_CATCH
[post-audit] V count: 7 -> 6 (L5380 removed)
2026-06-19 23:59:08 -04:00
ed f1cdc926cf TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 5: refactor(gui_2): migrate L3582 render_context_batch_actions preview to Result[T] (Phase 5)
Extract _render_context_batch_actions_preview_result helper from the
_do_generate preview try/except in render_context_batch_actions. The
imgui.button callback drains errors to app._last_request_errors per FR-BC-4
event-handler pattern.

[pre-audit] L3582 INTERNAL_BROAD_CATCH
[post-audit] V count: 8 -> 7 (L3582 removed)
2026-06-19 23:56:37 -04:00
ed 5b341038a7 TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 5: refactor(gui_2): migrate L3163 render_tool_preset_manager_content bias_save to Result[T] (Phase 5)
Extract _render_tool_preset_bias_save_result helper from the BiasProfile
save try/except in render_tool_preset_manager_content. The imgui.button
callback drains errors to app._last_request_errors per FR-BC-4
event-handler pattern.

[pre-audit] L3163 INTERNAL_BROAD_CATCH
[post-audit] V count: 9 -> 8 (L3163 removed)
2026-06-19 23:54:02 -04:00
ed b20ea145b3 TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 5: refactor(gui_2): migrate L1428 request_patch_from_tier4 to Result[T] (Phase 5)
Extract request_patch_from_tier4_result helper from the
ai_client.run_tier4_patch_generation try/except in App.request_patch_from_tier4.
Legacy wrapper drains errors to app._last_request_errors per FR-BC-4
event-handler pattern.

[pre-audit] L1428 INTERNAL_BROAD_CATCH
[post-audit] V count: 10 -> 9 (L1428 removed)
2026-06-19 23:50:33 -04:00
ed 77a48b18bf TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 5: refactor(gui_2): migrate L1393 _open_patch_in_external_editor to Result[T] (Phase 5)
Extract _open_patch_in_external_editor_result helper from the external editor
launch try/except in App._open_patch_in_external_editor. Legacy wrapper
drains errors to app._last_request_errors per FR-BC-4 event-handler pattern.

[pre-audit] L1393 INTERNAL_BROAD_CATCH
[post-audit] V count: 11 -> 10 (L1393 removed)
2026-06-19 23:45:29 -04:00
ed 374866619d TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 5: refactor(gui_2): migrate L1367 _apply_pending_patch to Result[T] (Phase 5)
Extract _apply_pending_patch_result helper from the apply_patch_to_file
try/except in App._apply_pending_patch. Legacy wrapper drains errors to
app._last_request_errors per FR-BC-4 event-handler pattern.

[pre-audit] L1367 INTERNAL_BROAD_CATCH
[post-audit] V count: 12 -> 11 (L1367 removed)
2026-06-19 23:39:16 -04:00
ed ce289db999 TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 5: refactor(gui_2): migrate L1293 _populate_auto_slices file_read to Result[T] (Phase 5)
Extract _populate_auto_slices_file_read_result helper from the file read
try/except in App._populate_auto_slices. Legacy wrapper drains errors to
app._last_request_errors per FR-BC-4 event-handler pattern.

[pre-audit] L1293 INTERNAL_BROAD_CATCH
[post-audit] V count: 13 -> 12 (L1293 removed)
2026-06-19 23:33:04 -04:00
ed 38b6f5c00f TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 5: refactor(gui_2): migrate L1284 _populate_auto_slices outline to Result[T] (Phase 5)
Extract _populate_auto_slices_outline_result helper from the
mcp_client.{py,ts_c,ts_cpp}_get_code_outline try/except in
App._populate_auto_slices. Legacy wrapper drains errors to
app._last_request_errors per FR-BC-4 event-handler pattern.

[pre-audit] L1284 INTERNAL_BROAD_CATCH
[post-audit] V count: 14 -> 13 (L1284 removed)
2026-06-19 23:29:10 -04:00
ed a213677cf0 TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 4: refactor(gui_2): migrate L3740 render_ast_inspector_modal file_content to Result[T] (Phase 4)
Adds _render_ast_inspector_file_content_result(app, f_path) -> Result[str | None]
helper that wraps the mcp_client.read_file try/except in render_ast_inspector_modal.
On success, returns the file content string. On failure, returns Result(data=None,
errors=[ErrorInfo]). The legacy wrapper handles the side effects (sets
app._cached_ast_file_lines + app.text_viewer_content) and drains errors to
app._last_request_errors (per FR-BC-3 modal pattern; data plane attribute).

Audit: BROAD_CATCH count 15 -> 14, COMPLIANT count 22 -> 23. Migration
target count drops by 1. All 3 Phase 4 sites migrated. Tests: 2/2 pass.
2026-06-19 22:52:32 -04:00
ed e558da81e1 TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 4: refactor(gui_2): migrate L3718 render_ast_inspector_modal outline to Result[T] (Phase 4)
Adds _render_ast_inspector_outline_result(app, f_path) -> Result[str] helper that wraps
the mcp_client.configure + outline fetch try/except in render_ast_inspector_modal.
The data field carries the outline string so the legacy wrapper can iterate it
without an additional instance attribute. Errors drain to app._last_request_errors
(per FR-BC-3 modal pattern; data plane attribute).

Audit: BROAD_CATCH count 16 -> 15, COMPLIANT count 21 -> 22. Migration
target count drops by 1. Tests: 2/2 pass.
2026-06-19 22:48:43 -04:00
ed 1ef0e07093 TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 4: refactor(gui_2): migrate L3398 render_persona_editor_window to Result[T] (Phase 4)
Adds _render_persona_editor_save_result(app) -> Result[bool] helper that wraps
the models.Persona(...) construction + _cb_save_persona try/except in
render_persona_editor_window Save button. The legacy wrapper drains errors
to app._last_request_errors (per FR-BC-3 modal pattern; data plane attribute).

Audit: BROAD_CATCH count 17 -> 16, COMPLIANT count 20 -> 21. Migration
target count drops by 1. Tests: 2/2 pass.
2026-06-19 22:43:46 -04:00
ed 0dacbfce62 refactor(gui_2): migrate L4848 render_warmup_status_indicator to Result[T] (Phase 3)
TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 3.

Adds _render_warmup_status_indicator_result(app) -> Result[dict] helper that
wraps the controller.warmup_status() try/except in
render_warmup_status_indicator. The data field carries the status dict so
the legacy wrapper can use it for rendering without an additional instance
attribute.

render_warmup_status_indicator becomes a thin wrapper that drains errors
to app.controller._worker_errors under the controller's lock (worker error
plane; thread-safe per app_controller pattern).

Audit: BROAD_CATCH count 18 -> 17, COMPLIANT count 19 -> 20. Migration
target count drops from 42 to 34 (8 sites migrated). Tests: 2/2 pass.
2026-06-19 22:22:21 -04:00
ed 500108ea6d refactor(gui_2): migrate L1284 _handle_history_logic to Result[T] (Phase 3)
TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 3.

Adds _handle_history_logic_result(app) -> Result[bool] helper that wraps
the snapshot debounce try/except from App._handle_history_logic. The
_is_applying_snapshot pre-condition guard stays in the legacy wrapper
(not error handling; the original early return has no try/except).

App._handle_history_logic becomes a thin wrapper that drains errors to
_last_request_errors. The drain failure mode is structurally safe
(hasattr check + append) so no outer try/except is required (per the
L1123 wrapper decision; avoiding new INTERNAL_SILENT_SWALLOW violations).

Audit: BROAD_CATCH count 19 -> 18, COMPLIANT count 18 -> 19. Tests: 2/2 pass.
2026-06-19 22:18:53 -04:00
ed 44e2888979 refactor(gui_2): migrate L1222 _show_menus is_max to Result[T] (Phase 3)
TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 3.

Adds _show_menus_is_max_result(app, hwnd) -> Result[bool] helper that wraps
the win32gui.GetWindowPlacement try/except from App._show_menus. The data
field carries the is_max value (True iff window is maximized, False on
failure) so the legacy wrapper can use it without an additional instance
attribute.

App._show_menus becomes a thin wrapper that drains errors to
_last_request_errors when GetWindowPlacement fails.

Audit: BROAD_CATCH count 20 -> 19, COMPLIANT count 17 -> 18. Tests: 2/2 pass.
2026-06-19 22:15:05 -04:00
ed f51abe0795 refactor(gui_2): migrate L1197 _show_menus hwnd to Result[T] (Phase 3)
TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 3.

Adds _show_menus_hwnd_result(app) -> Result[int] helper that wraps the
ctypes PyCapsule_GetPointer try/except from App._show_menus. The data
field carries the resolved hwnd (or 0 on failure) so the legacy wrapper
can pass it to subsequent win32gui calls without an additional app.hwnd
instance attribute.

App._show_menus becomes a thin wrapper that drains errors to
_last_request_errors when the hwnd capsule resolution fails.

Audit: BROAD_CATCH count 21 -> 20, COMPLIANT count 16 -> 17. Tests: 2/2 pass.
2026-06-19 22:11:14 -04:00
ed bcbd46445f refactor(gui_2): migrate L1171 _show_menus do_generate to Result[T] (Phase 3)
TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 3.

Adds _show_menus_do_generate_result(app) -> Result[bool] helper that wraps
the 'Generate MD Only' menu handler try/except in App._show_menus. The
legacy if-branch in App._show_menus becomes a thin call that drains
errors to _last_request_errors.

Audit: BROAD_CATCH count 22 -> 21, COMPLIANT count 15 -> 16. Tests: 2/2 pass.
2026-06-19 22:07:51 -04:00
ed 0f102612ad refactor(gui_2): migrate L1123 _gui_func render to Result[T] (Phase 3)
TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 3.

Adds _render_main_interface_result(app) -> Result[bool] helper that wraps
the OUTER render-loop try/except from App._gui_func. App._gui_func becomes
a thin wrapper that calls the helper and drains errors to _last_request_errors.

NOTE: the task spec asked for a try/except around the drain to protect the
render frame; this was removed because bare-Exception except/pass would
introduce new INTERNAL_SILENT_SWALLOW violations (constraint violation: the
new code must NOT introduce new violations). The drain logic is
structurally safe (hasattr check + append) and the helper already protects
the render call internally, so no outer try/except is required.

Audit: BROAD_CATCH count 23 -> 22, COMPLIANT count 14 -> 15. Tests: 2/2 pass.
2026-06-19 22:03:24 -04:00
ed 61cf4055c8 refactor(gui_2): migrate L742 _load_fonts mono font to Result[T] (Phase 3)
TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 3.

Adds _load_fonts_mono_result(app, font_size, config) -> Result[bool] helper
that wraps the thirdparty hello_imgui.FontLoadingParams + hello_imgui.load_font
try/except from App._load_fonts. App._load_fonts becomes a thin wrapper that
drains errors to _startup_timeline_errors (startup-time error plane).

Audit: BROAD_CATCH count 24 -> 23, COMPLIANT count 13 -> 14. Tests: 2/2 pass.
2026-06-19 21:56:07 -04:00
ed 53412af1b3 refactor(gui_2): migrate L731 _load_fonts main font to Result[T] (Phase 3)
TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 3.

Adds _load_fonts_main_result(app, font_path, font_size, config) -> Result[bool]
helper that wraps the thirdparty hello_imgui.load_font_ttf_with_font_awesome_icons
call. App._load_fonts becomes a thin wrapper that drains errors to
_startup_timeline_errors (startup-time error plane).

Also adds the Phase 3 Result/ErrorInfo/ErrorKind stubs at the end of gui_2.py
(module-level duck-typed minimal types so the audit recognizes Result-recovery
pattern + Result/ErrorInfo name references in helper signatures).

Audit: BROAD_CATCH count 25 -> 24, COMPLIANT count 12 -> 13. Tests: 2/2 pass.
2026-06-19 21:53:03 -04:00
ed 5b139e6ab1 feat(gui_2): add 3 drain-plane render functions (Phase 2, tasks 2.1-2.3)
TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 2.

Adds the drain plane that consumes the 8 controller error attributes
(the data plane added by sub-track 3 Phase 6).

Module-level functions in src/gui_2.py (lines 7293-7410):
- _drain_normalize_errors (helper, lines 7295-7326): duck-typed
  normalizer for 3 error-container shapes (Optional[ErrorInfo],
  List[Tuple[str, ErrorInfo]], Dict[str, ErrorInfo])
- render_controller_error_modal (lines 7328-7368): FR-DP-1 Pattern 2
  drain point; reads all 8 controller attrs, opens per-attr popups
- _render_worker_error_indicator (lines 7370-7385): FR-DP-2 status-bar
  widget showing worker error count, clickable
- _render_last_request_errors_modal (lines 7387-7409): FR-DP-3 per-request
  error modal opened after AI request completion

App class delegation wrappers (lines 1138-1148):
- App._render_controller_error_modal -> module-level
- App._render_worker_error_indicator -> module-level
- App._render_last_request_errors_modal -> module-level

Per UI Delegation Pattern: App class has thin wrappers; logic at
module level for hot-reload support. 1-space indentation, CRLF.

Audit: no new violations introduced (gui_2.py still 25 V + 13 S +
2 RETHROW + 2 UNCLEAR + 12 COMPLIANT = 54). Tests: 4/4 pass.
2026-06-19 21:32:24 -04:00
ed 327b388800 refactor(paths): v3 design - explicit initialize_paths + frozen PathsConfig singleton 2026-06-19 09:40:01 -04:00
ed 5107f3cad9 Merge branch 'tier2/live_gui_test_fixes_20260618' into tier2/result_migration_small_files_20260617
# Conflicts:
#	conductor/tracks/live_gui_test_fixes_20260618/state.toml
#	docs/reports/RESULT_MIGRATION_SMALL_FILES_20260617.md
#	docs/reports/TRACK_COMPLETION_result_migration_small_files_20260617.md
#	scripts/tier2/failcount.py
#	scripts/tier2/write_report.py
2026-06-18 17:55:05 -04:00
ed 0f796d7db0 fix(src): test_execution_sim_live GUI subprocess crash - root cause: imgui.set_window_focus exhausts main thread stack
The GUI subprocess (port 8999) crashes with 0xC00000FD =
STATUS_STACK_OVERFLOW when test_execution_sim_live triggers script
generation. Root cause: src/gui_2.py:render_response_panel called
imgui.set_window_focus('Response') directly during the render frame.

On Windows, the GUI subprocess main thread has only 1.94 MB of stack
(set by Python's PE header). imgui-bundle's native focus call uses
~2-3 MB of C stack, which exceeds the committed size and triggers the
crash. Same failure with both gemini_cli (mock subprocess) and gemini
(real SDK with gemini-2.5-flash-lite) - NOT provider-specific.

Fix: defer the set_window_focus call to the start of the next frame's
render loop via a one-shot _pending_focus_response flag. This mirrors
the existing _autofocus_response_tab pattern at gui_2.py:5353-5356
(which already uses a one-frame deferral via TabItemFlags_.set_selected).
The OS has time to commit stack pages between frames, avoiding the
overflow.

Files changed:
- src/app_controller.py: add _pending_focus_response flag init
- src/gui_2.py: defer set_window_focus to main render loop, remove
  direct call from render_response_panel

Verified by test_render_response_panel_defers_set_window_focus (TDD
red->green; commit d02c6d56 is the failing test).
2026-06-18 14:44:25 -04:00
ed 35bac5eda7 refactor(src): Phase 10.2 batch 4 - aggregate + api_hooks + context_presets + external_editor
aggregate.py (1 site):
- compute_file_stats returns Result[dict[str, int]]. The 2 SILENT_SWALLOW
  sites (ast.parse + open) now append to errors list. Callers in
  gui_2.py updated to extract result.data from the cache.

api_hooks.py (1 site):
- WebSocketServer._handler - was 2 except ...: pass (JSONDecodeError +
  ConnectionClosed). Now logs warnings instead of silently swallowing.
  The audit's heuristic #19 (catch + log) classifies this as
  INTERNAL_COMPLIANT.

context_presets.py (1 site):
- ContextPresetManager.load_all returns Result[Dict[str, ContextPreset]].
  Caller in app_controller.py (load_context_preset) updated to check
  result.ok.

external_editor.py (1 site):
- _find_vscode_in_registry returns Result[Optional[str]]. The 1
  SILENT_SWALLOW site (subprocess.run) now appends to errors.
  Caller in ExternalEditorLauncher._resolve_vscode updated to extract
  result.data.

Tests updated to check result.ok and use result.data.
2026-06-17 22:38:17 -04:00
ed 74e02485a1 files & media ux improvemetn with directory folding and file name vis 2026-06-14 23:29:43 -04:00
ed 2d51199699 fix(regression): for adding files in the files & media panel. 2026-06-14 22:43:42 -04:00
ed 4691848683 Docstrings: SSDL + ASCII Layout Map for Personas, Providers, and Command Palette 2026-06-13 16:45:12 -04:00
ed cb129aaed9 Docstrings: SSDL + ASCII Layout Map for Preset Managers and Windows 2026-06-13 16:30:34 -04:00
ed 1136273331 finished going through the entire gui_2.py minor sift through ai client 2026-06-13 16:16:03 -04:00