Private
Public Access
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:
+4
-2
@@ -1374,7 +1374,8 @@ class App:
|
||||
cache_key = f"{f_path}_{mtime}"
|
||||
if cache_key not in self._file_stats_cache: missing_keys.append((f_path, cache_key))
|
||||
else:
|
||||
stats = self._file_stats_cache[cache_key]
|
||||
cached = self._file_stats_cache[cache_key]
|
||||
stats = cached.data if hasattr(cached, "data") else cached
|
||||
total_lines += stats.get("lines", 0)
|
||||
total_ast += stats.get("ast_elements", 0)
|
||||
|
||||
@@ -4084,7 +4085,8 @@ def render_context_files_table(app: App) -> None:
|
||||
_exists = os.path.exists(_abs_p)
|
||||
mtime = os.path.getmtime(_abs_p) if _exists else 0
|
||||
cache_key = f"{f_path}_{mtime}"
|
||||
stats = app._file_stats_cache.get(cache_key, {"lines": 0, "ast_elements": 0})
|
||||
stats_raw = app._file_stats_cache.get(cache_key, {"lines": 0, "ast_elements": 0})
|
||||
stats = stats_raw.data if hasattr(stats_raw, "data") else stats_raw
|
||||
f_name = os.path.basename(f_path)
|
||||
imgui.text(f"{f_name} (L: {stats.get('lines', 0)}, AST: {stats.get('ast_elements', 0)})")
|
||||
if not _exists:
|
||||
|
||||
Reference in New Issue
Block a user