Private
Public Access
0
0
Files
manual_slop/tests
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
..