Private
Public Access
0
0
Files
manual_slop/tests
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-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