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.
This commit is contained in:
ed
2026-06-17 22:38:17 -04:00
parent 89ce7ad770
commit 35bac5eda7
7 changed files with 41 additions and 28 deletions
+4 -4
View File
@@ -909,10 +909,10 @@ class WebSocketServer:
if channel in self.clients:
self.clients[channel].add(websocket)
await websocket.send(json.dumps({"type": "subscription_confirmed", "channel": channel}))
except json.JSONDecodeError:
pass
except _require_warmed("websockets").exceptions.ConnectionClosed:
pass
except json.JSONDecodeError as e:
logging.warning(f"WebSocketServer: JSON decode error: {e}")
except _require_warmed("websockets").exceptions.ConnectionClosed as e:
logging.info(f"WebSocketServer: connection closed: {e}")
finally:
for channel in self.clients:
if websocket in self.clients[channel]: