ed
2e3a638505
refactor(audit+gui_2): add 'src' to allowlist; lazy-load win32gui/win32con
...
Sub-tracks 2E + 2F combined: clears 49 violations (47 in app_controller.py + gui_2.py + sloppy.py, plus 2 win32 imports in gui_2.py).
SUB-TRACK 2E: Added 'src' to LEAN_ALLOWLIST in scripts/audit_main_thread_imports.py.
The audit was flagging every 'from src import X' statement in app_controller.py (23) and gui_2.py (24) because its _resolve_local only walks the PACKAGE name (src/__init__.py) — it does NOT walk the IMPORTED sub-module (src.aggregate, src.events, etc.). Of all 20+ src.* modules, only src.api_hook_client has a heavy top-level import (requests), and it's NOT reachable from sloppy.py.
Adding 'src' to the allowlist makes 'from src import X' acceptable at the import site. The audit then walks into each src.X and reports heavy imports at the SOURCE, which is the correct behavior.
Audit: 49 -> 2 (only the 2 win32 imports in gui_2.py remain).
SUB-TRACK 2F: Lazy-import win32gui/win32con in App._show_menus.
Removed top-level 'import win32gui; import win32con' from src/gui_2.py. Replaced with module-level None placeholders and lazy imports at the top of App._show_menus:
win32gui: Any = None
win32con: Any = None
def _show_menus(self) -> None:
global win32gui, win32con
if win32gui is None:
import win32con, win32gui
win32con = win32con
win32gui = win32gui
The None placeholders allow tests to patch 'src.gui_2.win32gui' / 'src.gui_2.win32con' via unittest.mock.patch — verified by tests/test_gui_window_controls.py (1/1 pass).
Audit: 2 -> 0. ALL 67 BASELINE VIOLATIONS CLEARED.
TESTS: 5 new in tests/test_audit_allowlist_2e_2f.py:
- test_audit_script_exits_zero: audit returns 0
- test_src_package_in_lean_allowlist: 'src' is in LEAN_ALLOWLIST
- test_from_src_import_x_not_flagged_in_main_thread_graph: no violations for 'src' module
- test_gui_2_win32_modules_loaded_lazily: win32gui not in sys.modules after 'import src.gui_2'
- test_gui_window_controls_passes_with_lazy_win32: stub (verified manually outside pytest)
GOTCHA: Native 'edit' tool on .py files destroys 1-space indentation. Used manual-slop_edit_file throughout this commit. Confirmed: 'import win32con, win32gui' uses 'from collections.abc import Set' style (multiple names in one statement) — the inline assignment 'win32con = win32con' is needed to rebind the module-level names from the function-local imports.
2026-06-07 10:54:51 -04:00
..
2026-03-02 22:56:32 -05:00
2026-05-10 15:38:16 -04:00
2026-06-04 22:31:22 -04:00
2026-03-02 22:56:32 -05:00
2026-06-07 10:02:07 -04:00
2026-05-07 15:02:00 -04:00
2026-05-04 21:52:39 -04:00
2026-05-14 22:23:48 -04:00
2026-05-13 22:35:52 -04:00
2026-03-05 17:13:59 -05:00
2026-03-05 14:04:17 -05:00
2026-05-06 13:48:47 -04:00
2026-05-09 17:44:15 -04:00
2026-03-07 12:13:08 -05:00
2026-05-16 03:00:20 -04:00
2026-03-06 12:59:18 -05:00
2026-05-13 22:35:52 -04:00
2026-06-06 15:11:13 -04:00
2026-05-09 15:00:35 -04:00
2026-03-11 23:14:09 -04:00
2026-03-05 19:21:57 -05:00
2026-05-12 19:06:54 -04:00
2026-03-12 19:28:21 -04:00
2026-06-07 10:20:17 -04:00
2026-06-06 22:02:35 -04:00
2026-03-11 23:04:42 -04:00
2026-03-12 15:33:37 -04:00
2026-06-06 16:34:46 -04:00
2026-05-13 22:35:52 -04:00
2026-06-07 02:00:56 -04:00
2026-06-02 21:34:56 -04:00
2026-05-16 03:00:20 -04:00
2026-05-16 03:00:20 -04:00
2026-06-02 17:30:46 -04:00
2026-05-10 15:14:54 -04:00
2026-05-20 07:51:58 -04:00
2026-05-13 22:35:52 -04:00
2026-06-07 10:23:45 -04:00
2026-06-07 10:54:51 -04:00
2026-06-06 14:22:18 -04:00
2026-05-16 11:22:41 -04:00
2026-05-08 22:01:15 -04:00
2026-03-06 12:48:02 -05:00
2026-05-06 13:48:47 -04:00
2026-03-10 10:25:09 -04:00
2026-03-10 09:53:59 -04:00
2026-03-10 09:27:12 -04:00
2026-06-03 00:52:08 -04:00
2026-05-13 22:35:52 -04:00
2026-03-04 10:01:55 -05:00
2026-06-02 22:41:59 -04:00
2026-06-02 22:54:52 -04:00
2026-06-06 16:48:04 -04:00
2026-06-03 14:25:59 -04:00
2026-06-03 14:53:05 -04:00
2026-05-13 22:35:52 -04:00
2026-05-13 22:35:52 -04:00
2026-05-13 22:35:52 -04:00
2026-06-06 13:30:18 -04:00
2026-05-06 20:37:48 -04:00
2026-06-07 10:02:07 -04:00
2026-05-16 03:00:20 -04:00
2026-05-16 11:22:41 -04:00
2026-05-16 03:00:20 -04:00
2026-05-16 03:00:20 -04:00
2026-05-11 20:03:01 -04:00
2026-05-20 07:51:58 -04:00
2026-05-20 07:51:58 -04:00
2026-03-22 12:59:10 -04:00
2026-05-16 11:22:41 -04:00
2026-05-16 17:58:19 -04:00
2026-03-06 17:05:48 -05:00
2026-03-05 16:37:30 -05:00
2026-05-11 17:15:04 -04:00
2026-05-13 22:35:52 -04:00
2026-05-13 22:35:52 -04:00
2026-05-13 22:35:52 -04:00
2026-05-16 03:00:20 -04:00
2026-06-06 18:30:44 -04:00
2026-06-02 01:42:41 -04:00
2026-06-03 11:27:04 -04:00
2026-05-09 15:00:35 -04:00
2026-06-03 11:27:04 -04:00
2026-06-03 08:33:10 -04:00
2026-05-09 12:35:58 -04:00
2026-03-06 12:48:02 -05:00
2026-05-13 22:35:52 -04:00
2026-05-07 21:21:05 -04:00
2026-05-16 03:00:20 -04:00
2026-03-12 15:58:36 -04:00
2026-05-16 03:00:20 -04:00
2026-03-12 15:41:01 -04:00
2026-06-07 10:10:53 -04:00
2026-05-13 22:35:52 -04:00
2026-06-03 12:24:51 -04:00
2026-05-20 07:51:58 -04:00
2026-05-16 03:00:20 -04:00
2026-03-06 12:48:02 -05:00
2026-05-16 03:00:20 -04:00
2026-03-06 12:48:02 -05:00
2026-03-06 12:48:02 -05:00
2026-05-10 11:43:50 -04:00
2026-05-13 22:35:52 -04:00
2026-06-03 12:41:13 -04:00
2026-05-10 15:38:16 -04:00
2026-05-13 22:35:52 -04:00
2026-05-13 22:35:52 -04:00
2026-05-13 22:35:52 -04:00
2026-05-13 22:35:52 -04:00
2026-05-13 22:35:52 -04:00
2026-06-06 17:16:53 -04:00
2026-05-16 14:32:38 -04:00
2026-03-13 12:05:49 -04:00
2026-05-06 13:48:47 -04:00
2026-05-13 22:35:52 -04:00
2026-06-03 11:27:04 -04:00
2026-03-12 19:28:21 -04:00
2026-06-03 11:27:04 -04:00
2026-05-16 15:59:40 -04:00
2026-05-13 22:35:52 -04:00
2026-05-13 22:35:52 -04:00
2026-05-13 22:35:52 -04:00
2026-06-05 10:33:38 -04:00
2026-06-05 10:25:25 -04:00
2026-05-13 22:35:52 -04:00
2026-05-16 03:00:20 -04:00
2026-06-03 11:27:04 -04:00
2026-05-16 14:45:06 -04:00
2026-06-02 17:30:46 -04:00
2026-06-02 02:20:07 -04:00
2026-05-13 22:35:52 -04:00
2026-06-02 17:30:46 -04:00
2026-06-06 21:29:03 -04:00
2026-05-16 01:21:27 -04:00
2026-03-12 19:28:21 -04:00
2026-05-13 22:35:52 -04:00
2026-05-13 22:35:52 -04:00
2026-06-02 01:27:32 -04:00
2026-05-16 03:00:20 -04:00
2026-05-05 17:50:55 -04:00
2026-05-09 15:00:35 -04:00
2026-06-01 17:56:24 -04:00
2026-05-16 03:00:20 -04:00
2026-05-12 19:02:30 -04:00
2026-06-07 02:00:56 -04:00
2026-05-13 22:35:52 -04:00
2026-06-07 01:34:48 -04:00
2026-06-07 02:02:41 -04:00
2026-05-16 01:21:27 -04:00
2026-06-03 17:37:44 -04:00
2026-05-13 22:35:52 -04:00
2026-06-03 13:47:08 -04:00
2026-06-03 11:28:36 -04:00
2026-05-16 14:45:06 -04:00
2026-03-06 12:48:02 -05:00
2026-03-07 12:43:29 -05:00
2026-05-09 15:00:35 -04:00
2026-03-06 16:43:11 -05:00
2026-06-06 18:01:39 -04:00
2026-03-07 16:25:44 -05:00
2026-06-03 21:48:12 -04:00
2026-06-06 16:58:32 -04:00
2026-06-04 23:13:33 -04:00
2026-06-03 21:14:16 -04:00
2026-06-03 11:08:58 -04:00
2026-06-03 21:33:47 -04:00
2026-06-03 10:59:57 -04:00
2026-05-06 13:48:47 -04:00
2026-03-12 15:31:10 -04:00
2026-03-05 17:13:59 -05:00
2026-05-05 19:48:38 -04:00
2026-05-10 14:58:29 -04:00
2026-05-09 15:00:35 -04:00
2026-05-09 15:00:35 -04:00
2026-05-16 14:45:06 -04:00
2026-05-13 22:35:52 -04:00
2026-05-13 22:35:52 -04:00
2026-05-16 03:00:20 -04:00
2026-05-16 14:45:06 -04:00
2026-06-06 13:30:18 -04:00
2026-05-16 03:00:20 -04:00
2026-05-16 03:00:20 -04:00
2026-03-05 16:37:30 -05:00
2026-03-07 20:32:59 -05:00
2026-05-13 22:35:52 -04:00
2026-03-06 12:48:02 -05:00
2026-03-02 13:26:20 -05:00
2026-06-07 10:01:40 -04:00
2026-06-06 21:42:08 -04:00
2026-03-06 22:03:59 -05:00
2026-03-06 16:43:11 -05:00
2026-03-05 17:13:59 -05:00
2026-05-13 17:22:34 -04:00
2026-03-06 16:55:45 -05:00
2026-05-13 22:35:52 -04:00
2026-03-07 00:15:06 -05:00
2026-03-12 19:08:51 -04:00
2026-03-07 16:41:47 -05:00
2026-05-06 14:59:34 -04:00
2026-05-06 14:59:34 -04:00
2026-05-06 14:30:22 -04:00
2026-03-10 11:09:11 -04:00
2026-03-10 23:21:14 -04:00
2026-03-10 23:21:14 -04:00
2026-03-12 19:28:21 -04:00
2026-05-10 15:46:53 -04:00
2026-05-04 18:49:18 -04:00
2026-03-07 16:36:04 -05:00
2026-05-09 15:00:35 -04:00
2026-05-09 15:00:35 -04:00
2026-05-09 15:00:35 -04:00
2026-06-03 15:18:18 -04:00
2026-06-06 01:12:29 -04:00
2026-05-13 22:35:52 -04:00
2026-03-07 11:24:05 -05:00
2026-05-06 13:48:47 -04:00
2026-03-05 15:10:53 -05:00
2026-03-12 19:08:51 -04:00
2026-05-09 15:00:35 -04:00
2026-05-16 15:59:40 -04:00
2026-06-06 20:19:50 -04:00
2026-05-09 15:00:35 -04:00
2026-05-16 15:59:40 -04:00
2026-06-06 13:21:43 -04:00
2026-05-16 15:59:40 -04:00
2026-05-16 01:21:27 -04:00
2026-06-05 12:38:47 -04:00
2026-05-20 07:51:58 -04:00
2026-05-14 23:38:23 -04:00
2026-05-13 22:35:52 -04:00
2026-05-09 17:36:07 -04:00
2026-05-16 15:59:40 -04:00
2026-05-16 14:45:06 -04:00
2026-03-08 20:51:27 -04:00
2026-03-12 19:08:51 -04:00
2026-03-06 16:43:11 -05:00
2026-05-16 14:45:06 -04:00
2026-05-13 22:35:52 -04:00
2026-05-13 22:35:52 -04:00
2026-05-13 22:35:52 -04:00
2026-05-13 22:35:52 -04:00
2026-05-13 22:35:52 -04:00
2026-03-07 11:54:11 -05:00
2026-05-11 18:19:50 -04:00
2026-03-06 12:48:02 -05:00
2026-06-06 13:57:26 -04:00
2026-05-15 17:17:05 -04:00
2026-05-04 04:52:40 -04:00
2026-05-04 05:20:03 -04:00
2026-03-07 15:20:39 -05:00
2026-05-15 17:17:05 -04:00
2026-05-09 15:00:35 -04:00
2026-05-09 15:00:35 -04:00
2026-03-19 19:53:09 -04:00
2026-05-02 18:31:36 -04:00
2026-05-13 22:35:52 -04:00
2026-05-16 14:45:06 -04:00
2026-03-09 23:16:02 -04:00
2026-06-06 16:55:20 -04:00
2026-06-04 22:31:22 -04:00
2026-03-09 00:55:09 -04:00
2026-03-11 23:49:23 -04:00
2026-03-09 01:13:23 -04:00
2026-06-04 23:16:21 -04:00
2026-05-16 15:59:40 -04:00
2026-05-16 03:00:20 -04:00
2026-03-13 21:55:29 -04:00
2026-05-06 20:37:48 -04:00
2026-05-16 03:00:20 -04:00
2026-06-06 16:09:16 -04:00
2026-05-16 03:00:20 -04:00
2026-05-10 10:13:56 -04:00
2026-03-06 12:59:18 -05:00
2026-05-16 15:59:40 -04:00
2026-05-02 13:23:00 -04:00
2026-03-10 09:53:59 -04:00
2026-03-11 20:30:09 -04:00
2026-05-09 15:00:35 -04:00
2026-03-10 09:27:12 -04:00
2026-03-10 09:27:12 -04:00
2026-03-10 01:23:57 -04:00
2026-05-13 22:35:52 -04:00
2026-05-09 15:00:35 -04:00
2026-05-13 22:35:52 -04:00
2026-05-20 07:51:58 -04:00
2026-05-20 07:51:58 -04:00
2026-05-04 05:18:04 -04:00
2026-05-16 11:22:41 -04:00
2026-05-09 16:55:45 -04:00
2026-03-09 23:25:06 -04:00
2026-03-07 21:40:40 -05:00
2026-06-03 11:31:29 -04:00
2026-06-05 11:52:49 -04:00
2026-05-09 16:55:45 -04:00
2026-05-16 03:00:20 -04:00
2026-06-02 02:20:07 -04:00
2026-05-13 22:35:52 -04:00
2026-03-04 09:46:02 -05:00
2026-06-06 22:48:50 -04:00
2026-06-06 14:47:02 -04:00
2026-05-20 07:51:58 -04:00
2026-03-04 10:01:55 -05:00
2026-05-05 20:51:03 -04:00
2026-06-05 20:14:39 -04:00
2026-05-13 22:35:52 -04:00
2026-05-14 23:13:17 -04:00