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)
This commit is contained in:
@@ -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"],
|
||||
|
||||
Reference in New Issue
Block a user