refactor(models): remove __getattr__ shim entries for moved classes (Phase 2.3)

Per post_module_taxonomy_de_cruft_20260627 Phase 2.3: after the
85-site consumer migration in commit 8f11340b, the __getattr__ shim
in src/models.py is no longer needed for the moved classes.

The shim had 10 lazy-load branches (one per destination module). All
10 are removed in this commit. The remaining __getattr__ handles:
 - 'PROVIDERS' (lazy load from src.ai_client; moved in Phase 3)
 - 'GenerateRequest' + 'ConfirmRequest' (Pydantic proxies; moved in
   Phase 4)

Also fixed: ai_client.py had a top-level
'from src.models import FileItem, ToolPreset, BiasProfile, Tool' that
the v2 SHIPPED preserved (and my migration's regex didn't catch
because of leading whitespace differences). The top-level import is
now split into:
  from src.project_files import FileItem
  from src.tool_presets  import ToolPreset, Tool
  from src.tool_bias     import BiasProfile

After this commit, models.py has:
 - The 'Metadata = TrackMetadata' legacy alias
 - The Pydantic proxy factories (_create_generate_request,
   _create_confirm_request, _PYDANTIC_CLASS_FACTORIES)
 - The reduced __getattr__ (PROVIDERS + 2 Pydantic proxies)
 - The module docstring

Models.py is now ~85 lines (down from 139). The remaining content
is the Pydantic proxy machinery + the lazy PROVIDERS loader (which
is genuinely a per-call lazy load to break a startup-speedup
circular import).

Verification:
 - 'from src.models import Metadata' returns TrackMetadata dataclass
 - 'from src.models import PROVIDERS' returns ai_client.PROVIDERS
 - 'from src.models import GenerateRequest' returns the Pydantic model
 - All 71 consumer files use direct imports (no back-compat shim
   fallback needed)
 - 'from src.models import <moved class>' now raises AttributeError
   (as expected; the class lives in the destination module)
This commit is contained in:
ed
2026-06-26 13:52:43 -04:00
parent 91a612887c
commit 426ba343dd
2 changed files with 23 additions and 99 deletions
+3 -1
View File
@@ -47,7 +47,9 @@ from src import project_manager
from src import provider_state
from src.events import EventEmitter
from src.gemini_cli_adapter import GeminiCliAdapter
from src.models import FileItem, ToolPreset, BiasProfile, Tool
from src.project_files import FileItem
from src.tool_presets import ToolPreset, Tool
from src.tool_bias import BiasProfile
from src.paths import get_credentials_path
from src.tool_bias import ToolBiasEngine
from src.tool_presets import ToolPresetManager