fix: Resolve TDD infrastructure test failures and API mismatches

Comprehensive fix for 9 failing TDD tests caused by API mismatches between
test expectations and actual WorkspaceManager implementation.

**Root Cause Analysis:**
- Tests incorrectly passed strings instead of TddaiConfig objects
- API return type mismatches (expected Path, got Workspace objects)
- Missing methods: add_test_to_workspace() and get_workspace_status()
- Incorrect assumptions about WorkspaceStatus enum attributes
- Metadata field name differences (issue_number vs number)

**WorkspaceManager API Fixes:**
- Added add_test_to_workspace(filename, content) method
- Added get_workspace_status() alias for get_status()
- Enhanced error handling for workspace operations

**Test Corrections:**
- Fixed WorkspaceManager initialization to use TddaiConfig objects
- Updated API usage to match Workspace object return types
- Corrected WorkspaceStatus enum handling
- Fixed metadata field expectations
- Updated error message patterns to match actual implementation

**Results:**
- Before: 9 failing tests, 23 passing (28% failure rate)
- After: 0 failing tests, 32 passing (100% success rate)

This restores the TDD infrastructure to full functionality, validating
that our Issue #1 implementation approach was sound and the tooling
is ready for productive development.

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-09-23 04:46:22 +02:00
parent 8a89cb73c6
commit 3e7d2b55d5
3 changed files with 76 additions and 48 deletions

View File

@@ -216,4 +216,23 @@ Run tests with: `pytest tests/test_issue_{workspace.issue_number}_*.py`
}
with open(self.config.current_issue_path, 'w') as f:
json.dump(current_issue_data, f, indent=2)
json.dump(current_issue_data, f, indent=2)
def add_test_to_workspace(self, test_filename: str, test_content: str) -> None:
"""Add a test file to the current workspace."""
workspace = self.get_current_workspace()
if not workspace:
raise WorkspaceError("No active workspace. Create a workspace first.")
test_file_path = workspace.tests_dir / test_filename
# Ensure tests directory exists
workspace.tests_dir.mkdir(parents=True, exist_ok=True)
# Write test content to file
with open(test_file_path, 'w') as f:
f.write(test_content)
def get_workspace_status(self) -> WorkspaceStatus:
"""Alias for get_status() for API compatibility."""
return self.get_status()