Files
my-pal-mcp-server/tests/test_debug.py
Beehive Innovations 69a3121452 🚀 Major Enhancement: Workflow-Based Tool Architecture v5.5.0 (#95)
* WIP: new workflow architecture

* WIP: further improvements and cleanup

* WIP: cleanup and docks, replace old tool with new

* WIP: cleanup and docks, replace old tool with new

* WIP: new planner implementation using workflow

* WIP: precommit tool working as a workflow instead of a basic tool
Support for passing False to use_assistant_model to skip external models completely and use Claude only

* WIP: precommit workflow version swapped with old

* WIP: codereview

* WIP: replaced codereview

* WIP: replaced codereview

* WIP: replaced refactor

* WIP: workflow for thinkdeep

* WIP: ensure files get embedded correctly

* WIP: thinkdeep replaced with workflow version

* WIP: improved messaging when an external model's response is received

* WIP: analyze tool swapped

* WIP: updated tests
* Extract only the content when building history
* Use "relevant_files" for workflow tools only

* WIP: updated tests
* Extract only the content when building history
* Use "relevant_files" for workflow tools only

* WIP: fixed get_completion_next_steps_message missing param

* Fixed tests
Request for files consistently

* Fixed tests
Request for files consistently

* Fixed tests

* New testgen workflow tool
Updated docs

* Swap testgen workflow

* Fix CI test failures by excluding API-dependent tests

- Update GitHub Actions workflow to exclude simulation tests that require API keys
- Fix collaboration tests to properly mock workflow tool expert analysis calls
- Update test assertions to handle new workflow tool response format
- Ensure unit tests run without external API dependencies in CI

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* WIP - Update tests to match new tools

* WIP - Update tests to match new tools

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-06-21 00:08:11 +04:00

87 lines
3.6 KiB
Python

"""
Tests for the debug tool using new WorkflowTool architecture.
"""
from tools.debug import DebugInvestigationRequest, DebugIssueTool
from tools.models import ToolModelCategory
class TestDebugTool:
"""Test suite for DebugIssueTool using new WorkflowTool architecture."""
def test_tool_metadata(self):
"""Test basic tool metadata and configuration."""
tool = DebugIssueTool()
assert tool.get_name() == "debug"
assert "DEBUG & ROOT CAUSE ANALYSIS" in tool.get_description()
assert tool.get_default_temperature() == 0.2 # TEMPERATURE_ANALYTICAL
assert tool.get_model_category() == ToolModelCategory.EXTENDED_REASONING
assert tool.requires_model() is True
def test_request_validation(self):
"""Test Pydantic request model validation."""
# Valid investigation step request
step_request = DebugInvestigationRequest(
step="Investigating null pointer exception in UserService",
step_number=1,
total_steps=3,
next_step_required=True,
findings="Found potential null reference in user authentication flow",
files_checked=["/src/UserService.java"],
relevant_files=["/src/UserService.java"],
relevant_methods=["authenticate", "validateUser"],
confidence="medium",
hypothesis="Null pointer occurs when user object is not properly validated",
)
assert step_request.step_number == 1
assert step_request.confidence == "medium"
assert len(step_request.relevant_methods) == 2
assert len(step_request.relevant_context) == 2 # Should be mapped from relevant_methods
def test_input_schema_generation(self):
"""Test that input schema is generated correctly."""
tool = DebugIssueTool()
schema = tool.get_input_schema()
# Verify required investigation fields are present
assert "step" in schema["properties"]
assert "step_number" in schema["properties"]
assert "total_steps" in schema["properties"]
assert "next_step_required" in schema["properties"]
assert "findings" in schema["properties"]
assert "relevant_methods" in schema["properties"]
# Verify field types
assert schema["properties"]["step"]["type"] == "string"
assert schema["properties"]["step_number"]["type"] == "integer"
assert schema["properties"]["next_step_required"]["type"] == "boolean"
assert schema["properties"]["relevant_methods"]["type"] == "array"
def test_model_category_for_debugging(self):
"""Test that debug tool correctly identifies as extended reasoning category."""
tool = DebugIssueTool()
assert tool.get_model_category() == ToolModelCategory.EXTENDED_REASONING
def test_field_mapping_relevant_methods_to_context(self):
"""Test that relevant_methods maps to relevant_context internally."""
request = DebugInvestigationRequest(
step="Test investigation",
step_number=1,
total_steps=2,
next_step_required=True,
findings="Test findings",
relevant_methods=["method1", "method2"],
)
# External API should have relevant_methods
assert request.relevant_methods == ["method1", "method2"]
# Internal processing should map to relevant_context
assert request.relevant_context == ["method1", "method2"]
# Test step data preparation
tool = DebugIssueTool()
step_data = tool.prepare_step_data(request)
assert step_data["relevant_context"] == ["method1", "method2"]