Private
Public Access
0
0
Files
manual_slop/src
ed 61d21c70bb refactor(app_controller): remove requests + tomli_w top-level imports; add main thread purity test
Phase 8 of startup_speedup_20260606 track.

Part 1: app_controller.py cleanup
- Removed 'import requests' (was used in 2 places - lazy import added inside)
- Removed 'import tomli_w' (dead import; never referenced in app_controller)
- Migrated 2 threading.Thread spawns to use self.submit_io (the do_post
  closures in _handle_approve_ask and _handle_reject_ask)

Part 2: Main thread purity enforcement test
- tests/test_main_thread_purity.py: 7 tests verify that the 6 refactored
  files (ai_client, app_controller, commands, theme_2, markdown_helper,
  gui_2) have ZERO top-level imports from the heavy denylist:
    {google.genai, anthropic, openai, requests, google.genai.types,
     fastapi, fastapi.security.api_key, src.command_palette,
     src.theme_nerv, src.theme_nerv_fx, src.markdown_table, numpy,
     tkinter, tomli_w}

This is the static enforcement (the runtime audit-hook test using
sys.addaudithook is a follow-up).

The test is RED before each refactor phase, GREEN after. If a future
commit re-introduces a heavy import in one of these files, the test
fails immediately in CI.

TESTS:
- 7/7 main thread purity tests PASS
- 15/15 log + app controller tests still PASS (no breakage from
  removing requests/tomli_w imports)
2026-06-06 18:01:39 -04:00
..
2026-06-05 22:34:26 -04:00
2026-06-06 10:24:22 -04:00
2026-06-06 10:24:22 -04:00
2026-06-06 10:24:22 -04:00
2026-06-06 10:24:22 -04:00
2026-06-06 10:24:22 -04:00
2026-06-06 00:40:07 -04:00
2026-06-06 00:40:07 -04:00
2026-06-06 10:24:22 -04:00
2026-06-06 10:24:22 -04:00
2026-06-06 10:24:22 -04:00
2026-06-06 10:24:22 -04:00
2026-06-06 10:24:22 -04:00
2026-06-06 10:24:22 -04:00
2026-06-06 10:24:22 -04:00
2026-06-06 10:24:22 -04:00
2026-06-06 10:24:22 -04:00
2026-06-06 10:24:22 -04:00
2026-06-06 11:08:07 -04:00
2026-06-06 11:08:07 -04:00
2026-06-06 11:08:07 -04:00
2026-06-06 11:08:07 -04:00
2026-06-06 11:08:07 -04:00
2026-06-06 11:08:07 -04:00
2026-06-06 11:08:07 -04:00
2026-06-06 11:08:07 -04:00