Commit 198724b
feat: add comprehensive integration testing framework (#110)
* feat: add comprehensive integration testing framework
- Add DatabeakServerFixture with stdio transport for MCP server testing
- Create tests/fixtures/ directory with sample CSV files for integration tests
- Implement get_fixture_path() helper using os.path.realpath() for absolute paths
- Add test coverage for server startup, tool listing, and CSV loading operations
- Support multiple tool calls within same test session using direct context manager
- Zero teardown errors with clean asyncio task management
- Include sample datasets: employee data, sales transactions, missing values, empty CSV
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* feat: add mcp dependency and fix integration test
- Add mcp>=1.0.1 to dev dependencies in pyproject.toml
- Fix typo in integration test: os.path.is_abs -> os.path.isabs
- All 9 integration tests now passing
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* refactor: remove redundant session management tools from io_server
- Remove list_sessions and close_session tools (MCP server handles sessions)
- Remove SessionListResult and CloseSessionResult response models
- Update integration tests to use get_session_info instead of list_sessions
- All 9 integration tests still passing
- Ruff automatically fixed unused import
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* docs: update integration test README to reflect current tools
- Remove references to removed list_sessions and close_session tools
- Update code examples to use get_session_info instead
- Add section documenting available MCP tools for testing
- Clarify that session lifecycle is handled by MCP server infrastructure
- Update workflow examples to match current functionality
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: correct integration test fixture usage and cleanup
- Fix tests to use get_server_fixture() instead of abstract DatabeakServerFixture
- Remove duplicate stdio_client creation causing GeneratorExit exceptions
- Clean up conftest.py to avoid resource conflicts
- All 9 integration tests now passing successfully
- Tests properly verify CSV loading and session info functionality
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: resolve path traversal security vulnerability and comprehensive mypy compliance
Security Improvements:
- Fix path traversal vulnerability in get_fixture_path() with comprehensive input validation
- Add security tests preventing directory traversal attacks (../../../etc/passwd, etc.)
- Implement proper path containment verification using os.path.realpath()
Type Safety Enhancements:
- Achieve zero mypy errors across entire staged codebase (down from 1500+ errors)
- Add proper return type annotations (-> None) to all test functions
- Fix MockContext vs Context compatibility with cast() throughout test files
- Create HttpClientContextManager type alias for precise MCP HTTP client typing
- Add comprehensive type annotations for Pydantic models and test parameters
Integration Testing Framework:
- Add DatabeakHttpServerFixture with async subprocess and MCP endpoint liveness checking
- Implement random port selection (10000-65535) to avoid conflicts
- Add comprehensive HTTP transport testing with real MCP protocol communication
- Support both stdio and HTTP transports via unified get_server_fixture() interface
Documentation Updates:
- Remove outdated --directory mypy syntax from all documentation
- Standardize on uv run mypy src/databeak/ command syntax
- Update README, CONTRIBUTING, docs/, and agent documentation
Quality Improvements:
- Follow async best practices with asyncio.create_subprocess_exec
- Add proper exception handling with type-safe patterns
- Maintain security protections while achieving full type compliance
- Preserve all existing test functionality while improving type safety
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 91ae59b commit 198724b
35 files changed
Lines changed: 1512 additions & 783 deletions
File tree
- .claude
- agents
- planning
- docs
- src/databeak
- core
- servers
- tests
- fixtures
- integration
- unit
- models
- servers
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
171 | | - | |
| 171 | + | |
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
| |||
345 | 345 | | |
346 | 346 | | |
347 | 347 | | |
348 | | - | |
| 348 | + | |
349 | 349 | | |
350 | 350 | | |
351 | 351 | | |
| |||
354 | 354 | | |
355 | 355 | | |
356 | 356 | | |
357 | | - | |
| 357 | + | |
358 | 358 | | |
359 | 359 | | |
360 | 360 | | |
| |||
365 | 365 | | |
366 | 366 | | |
367 | 367 | | |
368 | | - | |
| 368 | + | |
369 | 369 | | |
370 | 370 | | |
371 | 371 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
| 68 | + | |
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| |||
268 | 268 | | |
269 | 269 | | |
270 | 270 | | |
271 | | - | |
| 271 | + | |
272 | 272 | | |
273 | 273 | | |
274 | 274 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
154 | | - | |
| 154 | + | |
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
317 | 317 | | |
318 | 318 | | |
319 | 319 | | |
320 | | - | |
321 | | - | |
| 320 | + | |
322 | 321 | | |
323 | 322 | | |
324 | 323 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
41 | 40 | | |
42 | 41 | | |
43 | 42 | | |
| |||
79 | 78 | | |
80 | 79 | | |
81 | 80 | | |
82 | | - | |
83 | | - | |
| 81 | + | |
| 82 | + | |
84 | 83 | | |
85 | 84 | | |
86 | 85 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
| 96 | + | |
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
133 | | - | |
| 133 | + | |
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
127 | | - | |
| 127 | + | |
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
160 | | - | |
| 160 | + | |
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
174 | | - | |
| 174 | + | |
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
| 52 | + | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| |||
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
208 | | - | |
| 208 | + | |
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
| |||
0 commit comments