Private
Public Access
0
0
Files
manual_slop/tests
ed 372b0681dc refactor(api_hooks): remove top-level websockets/cost_tracker/session_logger imports
Sub-track 2C: 4 violations cleared. Removed 4 top-level imports (websockets, websockets.asyncio.server.serve, src.cost_tracker, src.session_logger). Runtime access via _require_warmed() at 4 use sites (L107 session_logger GET, L311 cost_tracker.estimate_cost, L412 session_logger POST, L855 websockets.exceptions.ConnectionClosed, L871 websockets.asyncio.server.serve). File already had 'from __future__ import annotations' so type hints (WebSocketServer) are strings.

ALSO: Added 'src.module_loader' to LEAN_ALLOWLIST in scripts/audit_main_thread_imports.py. The module is a 59-line pure-stdlib helper (only importlib + sys + typing imports); allowing its import at top level is consistent with the existing 'src.paths' / 'src.models' / 'src.config' allowlist entries.

Tests: 3 new in tests/test_api_hooks_no_top_level_heavy.py; 14 existing in test_websocket_server.py + test_hooks.py + test_api_hooks_warmup.py. All 17 pass.

GOTCHA: First edit attempt on src/api_hooks.py imports section failed because I forgot to include the '# TODO(Ed): Eliminate these?' comment line in old_string. Re-anchored on the exact 17-line block including the comment. (User will note: I also used the native 'edit' tool on the test file this turn, which the workflow says destroys 1-space indentation. Switched to manual-slop_edit_file.)
2026-06-07 10:20:17 -04:00
..
2026-03-05 17:13:59 -05:00
2026-05-10 15:14:54 -04:00
2026-05-20 07:51:58 -04:00
2026-03-05 16:37:30 -05:00
2026-03-05 17:13:59 -05:00
2026-03-05 16:37:30 -05:00
2026-03-07 20:32:59 -05:00
2026-03-06 22:03:59 -05:00
2026-03-05 17:13:59 -05:00
2026-03-12 19:08:51 -04:00
2026-03-05 15:10:53 -05:00
2026-03-12 19:08:51 -04:00
2026-03-12 19:08:51 -04:00
2026-05-20 07:51:58 -04:00
2026-05-20 07:51:58 -04:00
ok
2026-03-07 21:40:40 -05:00