From 592d0e0c0492428a2dd2af3af8322ebabee3b3e9 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Fri, 26 Jun 2026 10:26:35 -0400 Subject: [PATCH] fix(models): restore legacy Metadata = TrackMetadata alias for backward compat tests/test_track_state_schema.py imports 'from src.models import Metadata' and uses it as a dataclass (e.g. 'Metadata(id=..., created_at=...)'). After Phase 5, models.Metadata was undefined and __getattr__ returned the type alias from src.type_aliases (which is dict[str, Any]). The test then failed with 'TypeError: dict.__init__() got an unexpected keyword argument created_at'. This commit restores the legacy 'Metadata = TrackMetadata' alias at the top of models.py so 'from src.models import Metadata' resolves to the TrackMetadata dataclass (the original behavior). New code should import directly: 'from src.mma import TrackMetadata'. Also removes the now-redundant __getattr__ entry for Metadata (it's eager now). Tests verified: tests/test_track_state_schema.py (5/5 PASS; was 2/5 before this fix) --- src/models.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/models.py b/src/models.py index df196923..a5b9d00a 100644 --- a/src/models.py +++ b/src/models.py @@ -35,6 +35,17 @@ import sys from typing import Any, Dict, List +from src.mma import TrackMetadata + +# Legacy alias: the original models.py had a TrackMetadata dataclass named +# 'Metadata' (before Phase 3a moved it to src.mma.py). Existing tests + +# consumers use 'from src.models import Metadata' expecting the dataclass. +# We re-export the dataclass here so the legacy import path resolves to +# the same object. The Metadata TYPE ALIAS (from src.type_aliases) is the +# boundary wire type; legacy consumers wanting the dataclass should +# migrate to 'from src.mma import TrackMetadata'. +Metadata = TrackMetadata # noqa: F401 — legacy class name re-export + DEFAULT_TOOL_CATEGORIES: Dict[str, List[str]] = { "General": ["read_file", "list_directory", "search_files", "get_tree", "get_file_summary"],