Private
Public Access
0
0
Files
manual_slop/docs/reports/startup_audit_20260606.txt
T
ed 6f9a3af201 feat(audit): add main-thread import graph audit + baseline measurements
Phase 1, Tasks T1.2 + T1.4 of the startup_speedup_20260606 track.

NEW: scripts/audit_main_thread_imports.py
  Static CI gate that AST-walks the import graph reachable from
  sloppy.py and fails (exit 1) if any heavy module is imported at the
  top of a main-thread-reachable file. Walks into if/elif/else and
  try/except branches (which run at import time) but skips function
  bodies (which only run when called). Allowlist: stdlib + the lean
  gui_2 skeleton (imgui_bundle, defer, src.imgui_scopes, src.theme_2,
  src.theme_models, src.paths, src.models, src.events).

NEW: scripts/audit_gui2_imports.py
  Read-only analysis tool that lists every top-level and function-level
  import in src/gui_2.py, classified by location. Used in Phase 5D to
  identify which imports to remove.

NEW: tests/test_audit_main_thread_imports.py
  9 tests covering: --help exits 0, clean stdlib-only passes, heavy
  third-party fails, google.genai fails, transitive walks, function-
  body imports ignored, if-branch imports flagged, try-block imports
  flagged, file:line reported. All 9 pass.

NEW: docs/reports/startup_baseline_20260606.txt
  3-run median cold-start benchmark. Worst offenders: src.gui_2
  (1770ms), simulation.user_agent (1517ms), google.genai (1001ms),
  openai (482ms), anthropic (441ms), imgui_bundle (255ms),
  src.theme_nerv* (485ms combined), src.markdown_table (243ms),
  src.command_palette (242ms).

NEW: docs/reports/startup_audit_20260606.txt
  Audit output on the CURRENT codebase. Reports 67 violations across
  the main-thread import graph (incl. numpy in src/gui_2.py:9,
  tomli_w in src/gui_2.py:18, fastapi + requests in src/app_controller,
  tree_sitter_* in src/file_cache, pydantic in src/models, plus all
  the src.* subsystem imports that drag in heavy transitive deps).
  Phase 3-5 of the track will resolve these one by one.

After Phase 3-5, this audit must exit 0 (no violations).

Co-located reports in docs/reports/ per project convention; the other
agent finished their work in docs/superpowers/ and is unrelated.
2026-06-06 14:22:18 -04:00

69 lines
6.3 KiB
Plaintext

FAIL: 67 heavy top-level import(s) in main-thread import graph:
sloppy.py:L29 src.api_hooks from src.api_hooks import HookServer
sloppy.py:L31 src.gui_2 from src.gui_2 import App
sloppy.py:L46 src.app_controller from src.app_controller import AppController
sloppy.py:L50 src.gui_2 from src.gui_2 import main
src\api_hooks.py:L9 websockets import websockets
src\api_hooks.py:L14 websockets.asyncio.server from websockets.asyncio.server import serve
src\api_hooks.py:L16 src from src import cost_tracker
src\api_hooks.py:L17 src from src import session_logger
src\app_controller.py:L6 requests import requests
src\app_controller.py:L10 tomli_w import tomli_w
src\app_controller.py:L17 fastapi from fastapi import FastAPI, Depends, HTTPException
src\app_controller.py:L21 fastapi.security.api_key from fastapi.security.api_key import APIKeyHeader
src\app_controller.py:L23 src from src import aggregate
src\app_controller.py:L24 src from src import models
src\app_controller.py:L25 src from src import ai_client
src\app_controller.py:L26 src from src import conductor_tech_lead
src\app_controller.py:L27 src from src import events
src\app_controller.py:L28 src from src import mcp_client
src\app_controller.py:L29 src from src import multi_agent_conductor
src\app_controller.py:L30 src from src import orchestrator_pm
src\app_controller.py:L31 src from src import paths
src\app_controller.py:L32 src from src import performance_monitor
src\app_controller.py:L33 src from src import project_manager
src\app_controller.py:L34 src from src import session_logger
src\app_controller.py:L35 src from src import workspace_manager
src\app_controller.py:L36 src from src import presets
src\app_controller.py:L37 src from src import shell_runner
src\app_controller.py:L38 src from src import theme_2 as theme
src\app_controller.py:L39 src from src import thinking_parser
src\app_controller.py:L40 src from src import tool_presets
src\app_controller.py:L42 src.context_presets from src.context_presets import ContextPresetManager
src\app_controller.py:L43 src.file_cache from src.file_cache import ASTParser
src\file_cache.py:L38 tree_sitter import tree_sitter
src\file_cache.py:L39 tree_sitter_python import tree_sitter_python
src\file_cache.py:L40 tree_sitter_cpp import tree_sitter_cpp
src\file_cache.py:L41 tree_sitter_c import tree_sitter_c
src\gui_2.py:L9 numpy import numpy as np
src\gui_2.py:L18 tomli_w import tomli_w
src\gui_2.py:L37 src.diff_viewer from src.diff_viewer import apply_patch_to_file
src\gui_2.py:L38 src from src import ai_client
src\gui_2.py:L39 src from src import aggregate
src\gui_2.py:L40 src from src import api_hooks
src\gui_2.py:L41 src from src import app_controller
src\gui_2.py:L42 src from src import bg_shader
src\gui_2.py:L43 src from src import cost_tracker
src\gui_2.py:L44 src from src import history
src\gui_2.py:L45 src from src import imgui_scopes as imscope
src\gui_2.py:L46 src from src import paths
src\gui_2.py:L47 src from src import presets
src\gui_2.py:L48 src from src import project_manager
src\gui_2.py:L49 src from src import session_logger
src\gui_2.py:L50 src from src import log_registry
src\gui_2.py:L51 src from src import log_pruner
src\gui_2.py:L52 src from src import models
src\gui_2.py:L54 src from src import mcp_client
src\gui_2.py:L55 src from src import markdown_helper
src\gui_2.py:L56 src from src import shaders
src\gui_2.py:L57 src from src import synthesis_formatter
src\gui_2.py:L58 src from src import theme_2 as theme
src\gui_2.py:L59 src from src import theme_nerv_fx as theme_fx
src\gui_2.py:L60 src from src import thinking_parser
src\gui_2.py:L61 src from src import workspace_manager
src\gui_2.py:L62 src.hot_reloader from src.hot_reloader import HotReloader
src\gui_2.py:L65 win32gui import win32gui
src\gui_2.py:L66 win32con import win32con
src\models.py:L46 tomli_w import tomli_w
src\models.py:L51 pydantic from pydantic import BaseModel