From 2dbf42fce1b368b294abfb5d024ea1a412424efe Mon Sep 17 00:00:00 2001 From: Jeffrey Phillips Freeman Date: Thu, 12 Mar 2026 09:19:03 +0000 Subject: [PATCH] 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. --- features/steps/architecture_steps.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/features/steps/architecture_steps.py b/features/steps/architecture_steps.py index 1ac704f7..c834088c 100644 --- a/features/steps/architecture_steps.py +++ b/features/steps/architecture_steps.py @@ -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: