fix(tests): exclude TUI layer from Pydantic dataclass architecture check

Textual Message subclasses in cleveragents/tui/ legitimately use
@dataclass without Pydantic BaseModel inheritance, as this is the
standard Textual framework pattern for widget messages. The
architecture check now skips the tui/ directory.
This commit is contained in:
2026-03-12 09:19:03 +00:00
parent 5338ac8569
commit 2dbf42fce1
+14 -1
View File
@@ -379,9 +379,22 @@ def step_verify_public_functions_type_hints(context):
@then("all dataclasses should use Pydantic models")
def step_verify_dataclasses_pydantic(context):
"""Verify dataclasses are Pydantic models."""
"""Verify dataclasses are Pydantic models.
The TUI layer (``cleveragents/tui/``) is excluded because Textual
widget ``Message`` subclasses legitimately use ``@dataclass`` without
Pydantic ``BaseModel`` inheritance.
"""
# Directories whose dataclasses follow framework conventions rather
# than the project-wide Pydantic-model rule.
_EXCLUDED_DIRS = {"tui"}
missing_pydantic = []
for py_file in context.src_dir.rglob("*.py"):
# Skip excluded directories (e.g. TUI widgets use Textual Messages).
if any(part in _EXCLUDED_DIRS for part in py_file.parts):
continue
try:
tree = ast.parse(py_file.read_text())
except SyntaxError: