bacddc8549
TIER-2 READ AGENTS.md conductor/workflow.md conductor/edit_workflow.md conductor/tier2/githooks/forbidden-files.txt conductor/tracks/tier2_leak_prevention_20260620/spec.md conductor/code_styleguides/data_oriented_design.md conductor/code_styleguides/error_handling.md conductor/code_styleguides/type_aliases.md before Phase 0 Tasks 0.1, 0.2, 0.4. Phase 0 of metadata_promotion_20260624. 11 NEW per-aggregate dataclasses added to src/type_aliases.py (CommsLogEntry, HistoryMessage, FileItem, ToolDefinition, SessionInsights, DiscussionSettings, CustomSlice, MMAUsageStats, ProviderPayload, UIPanelConfig, PathInfo) + RAGChunk added to src/rag_engine.py. Metadata: TypeAlias = dict[str, Any] preserved unchanged as the catch-all for collapsed codepaths. Each dataclass has paired to_dict()/from_dict() methods. 11 regression-guard test files created with 5-7 tests each (~70 tests total). All tests PASS. The existing tests/test_type_aliases.py was updated to reflect the NEW design (CommsLogEntry etc. are now classes, not aliases to Metadata). Conventions: 1-space indentation, CRLF preserved, no comments.
51 lines
1.3 KiB
Python
51 lines
1.3 KiB
Python
"""Tests for PathInfo in src/type_aliases.py
|
|
|
|
Per-aggregate dataclass regression-guard for the metadata_promotion_20260624 track.
|
|
|
|
CONVENTION: 1-space indentation. NO COMMENTS.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
from dataclasses import FrozenInstanceError
|
|
|
|
import pytest
|
|
|
|
from src.type_aliases import PathInfo
|
|
|
|
|
|
def test_constructor_with_kwargs() -> None:
|
|
pi = PathInfo(logs_dir={"path": "/logs"}, scripts_dir={"path": "/scripts"}, project_root={"path": "/proj"})
|
|
assert pi.logs_dir == {"path": "/logs"}
|
|
assert pi.scripts_dir == {"path": "/scripts"}
|
|
assert pi.project_root == {"path": "/proj"}
|
|
|
|
|
|
def test_field_access() -> None:
|
|
pi = PathInfo(logs_dir={"src": "default"})
|
|
assert pi.logs_dir == {"src": "default"}
|
|
|
|
|
|
def test_frozen_raises_on_mutation() -> None:
|
|
pi = PathInfo()
|
|
with pytest.raises(FrozenInstanceError):
|
|
pi.logs_dir = {"x": 1}
|
|
|
|
|
|
def test_to_dict_roundtrip() -> None:
|
|
pi = PathInfo(logs_dir={"a": 1}, scripts_dir={"b": 2}, project_root={"c": 3})
|
|
d = pi.to_dict()
|
|
assert d["logs_dir"] == {"a": 1}
|
|
assert d["scripts_dir"] == {"b": 2}
|
|
assert d["project_root"] == {"c": 3}
|
|
|
|
|
|
def test_default_values() -> None:
|
|
pi = PathInfo()
|
|
assert pi.logs_dir == {}
|
|
assert pi.scripts_dir == {}
|
|
assert pi.project_root == {}
|
|
|
|
|
|
def test_hashability_skipped_unhashable_dict_field() -> None:
|
|
pi = PathInfo()
|
|
assert pi.logs_dir == {} |