Skip to content

Commit 4525dfa

Browse files
tbitcsoz-agent
andcommitted
fix: CI lint + type-check failures
- ruff: remove unused imports, fix import sorting, line length in test_agent.py - ruff: SIM105 contextlib.suppress in conftest.py - mypy: add dict[str, Any] return type in reports.py - mypy: str() cast for Any return in improve.py - mypy: add autogen to ignore_missing_imports in pyproject.toml Co-Authored-By: Oz <oz-agent@warp.dev>
1 parent e2213ea commit 4525dfa

5 files changed

Lines changed: 12 additions & 11 deletions

File tree

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ exclude = ["src/specsmith/gui"]
123123
module = [
124124
"anthropic",
125125
"anthropic.*",
126+
"autogen", # AG2 agent shell — optional extra
127+
"autogen.*",
126128
"openai",
127129
"openai.*",
128130
"google",

src/specsmith/agents/reports.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from dataclasses import asdict, dataclass, field
1313
from datetime import datetime, timezone
1414
from pathlib import Path
15+
from typing import Any
1516

1617

1718
@dataclass
@@ -36,7 +37,7 @@ class ChangeReport:
3637
default_factory=lambda: datetime.now(tz=timezone.utc).isoformat()
3738
)
3839

39-
def to_dict(self) -> dict:
40+
def to_dict(self) -> dict[str, Any]:
4041
"""Convert to a JSON-serializable dict (excludes verbose fields)."""
4142
d = asdict(self)
4243
# Truncate verbose fields for the summary view

src/specsmith/agents/workflows/improve.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def _extract_last_assistant_message(messages: list[dict[str, Any]]) -> str:
120120
"""Get the last assistant message content from a conversation."""
121121
for msg in reversed(messages):
122122
if msg.get("role") == "assistant" and msg.get("content"):
123-
return msg["content"]
123+
return str(msg["content"])
124124
return ""
125125

126126

tests/conftest.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
from __future__ import annotations
1111

12+
import contextlib
1213
import sys
1314

1415

@@ -33,10 +34,8 @@ def pytest_configure(config): # type: ignore[no-untyped-def] # noqa: ARG001
3334
_orig = _pytest_pathlib.cleanup_dead_symlinks
3435

3536
def _safe_cleanup(basepath): # type: ignore[no-untyped-def]
36-
try:
37+
with contextlib.suppress(OSError):
3738
_orig(basepath)
38-
except OSError:
39-
pass # Suppress WinError 448
4039

4140
# Patch in both modules — tmpdir imports the function directly
4241
_pytest_pathlib.cleanup_dead_symlinks = _safe_cleanup

tests/test_agent.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,22 @@
1111

1212
from __future__ import annotations
1313

14-
import os
1514
from pathlib import Path
16-
from unittest.mock import patch
1715

1816
import pytest
1917
import yaml
2018

2119
from specsmith.agent.core import (
2220
CompletionResponse,
2321
Message,
24-
ModelTier,
2522
Role,
2623
Tool,
2724
ToolParam,
28-
ToolResult,
2925
)
3026
from specsmith.agent.runner import AgentRunner, SessionState, build_system_prompt
3127
from specsmith.agent.skills import load_skills
3228
from specsmith.agent.tools import build_tool_registry, get_tool_by_name
3329

34-
3530
# ---------------------------------------------------------------------------
3631
# Fixtures
3732
# ---------------------------------------------------------------------------
@@ -114,7 +109,11 @@ def test_write_file_handler(self, governed_project: Path) -> None:
114109
write_file = get_tool_by_name(tools, "write_file")
115110
assert write_file is not None
116111
result = write_file.handler(path="test_output.txt", content="hello world")
117-
assert "wrote" in result.lower() or "created" in result.lower() or "test_output" in result.lower()
112+
assert (
113+
"wrote" in result.lower()
114+
or "created" in result.lower()
115+
or "test_output" in result.lower()
116+
)
118117
assert (governed_project / "test_output.txt").read_text(encoding="utf-8") == "hello world"
119118

120119
def test_run_command_handler(self, governed_project: Path) -> None:

0 commit comments

Comments
 (0)