Private
Public Access
0
0
Files
manual_slop/scripts
ed 6333e0e6c8 refactor(app_controller): migrate 5 callback sites to Result (batch 1)
Migrated 5 INTERNAL_BROAD_CATCH sites to the data-oriented Result[T] pattern:

1. _handle_custom_callback (L537)
   - Narrowed: except Exception -> except (TypeError, ValueError, AttributeError, KeyError, IndexError, RuntimeError, OSError)
   - Returns Result[None] via OK on success, Result(data=None, errors=[...]) on failure
   - logging.debug added per Heuristic #19

2. _handle_click (L579)
   - Narrowed: except Exception -> except (TypeError, ValueError, AttributeError, KeyError, IndexError, RuntimeError)
   - Preserves the no-arg fallback (func()) behavior
   - Returns Result[None] on success/failure

3. cb_load_prior_log inner (L2046) - bare except in json.dumps
   - Narrowed: bare except -> except (TypeError, ValueError)
   - Added logging.debug for tool_calls serialization failure
   - Preserves the [TOOL CALLS PRESENT] fallback

4. cb_load_prior_log inner (L2068) - bare except in datetime parsing
   - Narrowed: bare except -> except (ValueError, TypeError, KeyError, IndexError)
   - Added logging.debug for first_ts parse failure
   - Preserves the time.time() fallback

5. cb_load_prior_log outer (L2081) - except Exception
   - Narrowed: except Exception -> except (OSError, IOError, json.JSONDecodeError, ValueError, TypeError, KeyError, AttributeError)
   - Returns Result[None] with ErrorInfo; preserves the ai_status set + early return
   - State mutations after the try block are still skipped on error (same as before)

Test impact: 5 new test_app_controller_result tests verify the contract.
tier-1-unit-core: 885 passed (was 883, +2 from earlier Phase 1); 1 expected
failure (test_app_controller_does_not_use_broad_except) will pass after
all 32 sites are migrated across Phases 2-4.

Refs: spec.md FR1, plan.md Task 2.2
Refs: 26e57577 (Phase 1 regression fix on the same file)
2026-06-18 19:52:28 -04:00
..
2026-06-07 11:51:36 -04:00
2026-06-07 11:51:36 -04:00