story-kit: start 122_story_test_coverage_http_ws_rs
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
---
|
||||
name: "Add test coverage for llm/chat.rs (2.6% -> 60%+)"
|
||||
---
|
||||
|
||||
# Story 120: Add test coverage for llm/chat.rs
|
||||
|
||||
Currently at 2.6% line coverage (343 lines, 334 missed). This is the chat completion orchestration layer — the biggest uncovered module by missed line count.
|
||||
|
||||
## What to test
|
||||
|
||||
- Message construction and formatting
|
||||
- Token counting/estimation logic
|
||||
- Chat session management
|
||||
- Error handling paths (provider errors, timeout, malformed responses)
|
||||
- Any pure functions that don't require a live LLM connection
|
||||
|
||||
## Notes
|
||||
|
||||
- Mock the LLM provider trait/interface rather than making real API calls
|
||||
- Focus on the logic layer, not the provider integration
|
||||
- Target 60%+ line coverage
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
- [ ] Line coverage for `llm/chat.rs` reaches 60%+
|
||||
- [ ] Tests pass with `cargo test`
|
||||
- [ ] `cargo clippy` clean
|
||||
@@ -0,0 +1,27 @@
|
||||
---
|
||||
name: "Add test coverage for io/watcher.rs (40% -> 70%+)"
|
||||
---
|
||||
|
||||
# Story 121: Add test coverage for io/watcher.rs
|
||||
|
||||
Currently at 40% line coverage (238 lines, 142 missed). The file watcher is critical infrastructure — it drives pipeline advancement and auto-commits.
|
||||
|
||||
## What to test
|
||||
|
||||
- Story file detection and classification (which directory, what kind of move)
|
||||
- Debounce/flush logic
|
||||
- Git add/commit message generation
|
||||
- Watcher pause/resume mechanism (added in story 119 for merge safety)
|
||||
- Edge cases: rapid file changes, missing directories, git failures
|
||||
|
||||
## Notes
|
||||
|
||||
- Use temp directories for filesystem tests
|
||||
- Mock git commands where needed
|
||||
- The watcher pause lock is especially important to test given its role in merge safety
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
- [ ] Line coverage for `io/watcher.rs` reaches 70%+
|
||||
- [ ] Tests pass with `cargo test`
|
||||
- [ ] `cargo clippy` clean
|
||||
@@ -0,0 +1,27 @@
|
||||
---
|
||||
name: "Add test coverage for http/ws.rs (0% -> 50%+)"
|
||||
---
|
||||
|
||||
# Story 122: Add test coverage for http/ws.rs
|
||||
|
||||
Currently at 0% line coverage (160 lines). This is the WebSocket handler that powers the real-time UI — pipeline state pushes, chat streaming, permission requests, and reconciliation progress.
|
||||
|
||||
## What to test
|
||||
|
||||
- WebSocket message parsing (incoming WsRequest variants)
|
||||
- Pipeline state serialization to WsResponse
|
||||
- Message routing (chat, cancel, permission_response)
|
||||
- Connection lifecycle (open, close, reconnect handling server-side)
|
||||
- Broadcast channel subscription and message delivery
|
||||
|
||||
## Notes
|
||||
|
||||
- May need to set up a test server context or mock the broadcast channel
|
||||
- Focus on the message handling logic rather than actual WebSocket transport
|
||||
- Test the serialization/deserialization of all WsResponse variants
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
- [ ] Line coverage for `http/ws.rs` reaches 50%+
|
||||
- [ ] Tests pass with `cargo test`
|
||||
- [ ] `cargo clippy` clean
|
||||
@@ -0,0 +1,27 @@
|
||||
---
|
||||
name: "Add test coverage for llm/providers/anthropic.rs (0% -> 50%+)"
|
||||
---
|
||||
|
||||
# Story 123: Add test coverage for llm/providers/anthropic.rs
|
||||
|
||||
Currently at 0% line coverage (204 lines). The Anthropic provider handles API communication for Claude models.
|
||||
|
||||
## What to test
|
||||
|
||||
- Request construction (headers, body format, model selection)
|
||||
- Response parsing (streaming chunks, tool use responses, error responses)
|
||||
- API key validation
|
||||
- Rate limit / error handling
|
||||
- Message format conversion (internal Message -> Anthropic API format)
|
||||
|
||||
## Notes
|
||||
|
||||
- Mock HTTP responses rather than calling the real Anthropic API
|
||||
- Use `mockito` or similar for HTTP mocking, or test the pure functions directly
|
||||
- Focus on serialization/deserialization and error paths
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
- [ ] Line coverage for `llm/providers/anthropic.rs` reaches 50%+
|
||||
- [ ] Tests pass with `cargo test`
|
||||
- [ ] `cargo clippy` clean
|
||||
@@ -0,0 +1,28 @@
|
||||
---
|
||||
name: "Add test coverage for llm/providers/claude_code.rs (54% -> 75%+)"
|
||||
---
|
||||
|
||||
# Story 124: Add test coverage for llm/providers/claude_code.rs
|
||||
|
||||
Currently at 54% line coverage (496 lines, 259 missed). The Claude Code provider spawns `claude` CLI processes and manages their I/O.
|
||||
|
||||
## What to test
|
||||
|
||||
- Command argument construction (model, max-turns, budget, system prompt, append flags)
|
||||
- Output parsing (streaming JSON events from claude CLI)
|
||||
- Session ID extraction
|
||||
- Process lifecycle management
|
||||
- Error handling (process crash, invalid output, timeout)
|
||||
- Permission request/response flow
|
||||
|
||||
## Notes
|
||||
|
||||
- Mock the process spawning rather than running real `claude` commands
|
||||
- Test the output parsing logic with sample JSON event streams
|
||||
- The argument construction logic is especially testable as pure functions
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
- [ ] Line coverage for `llm/providers/claude_code.rs` reaches 75%+
|
||||
- [ ] Tests pass with `cargo test`
|
||||
- [ ] `cargo clippy` clean
|
||||
@@ -0,0 +1,26 @@
|
||||
---
|
||||
name: "Add test coverage for http/io.rs (0% -> 60%+)"
|
||||
---
|
||||
|
||||
# Story 125: Add test coverage for http/io.rs
|
||||
|
||||
Currently at 0% line coverage (76 lines). These are the IO-related HTTP endpoints (absolute path listing, directory creation, home directory).
|
||||
|
||||
## What to test
|
||||
|
||||
- `list_directory_absolute` endpoint — valid path, invalid path, permission errors
|
||||
- `create_directory_absolute` endpoint — new dir, existing dir, nested creation
|
||||
- `get_home_directory` endpoint — returns correct home path
|
||||
- Error responses for invalid inputs
|
||||
|
||||
## Notes
|
||||
|
||||
- Use temp directories for filesystem tests
|
||||
- These are straightforward CRUD-style endpoints, should be quick to cover
|
||||
- Follow the test patterns used in `http/project.rs` and `http/settings.rs`
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
- [ ] Line coverage for `http/io.rs` reaches 60%+
|
||||
- [ ] Tests pass with `cargo test`
|
||||
- [ ] `cargo clippy` clean
|
||||
@@ -0,0 +1,26 @@
|
||||
---
|
||||
name: "Add test coverage for http/anthropic.rs (0% -> 60%+)"
|
||||
---
|
||||
|
||||
# Story 126: Add test coverage for http/anthropic.rs
|
||||
|
||||
Currently at 0% line coverage (66 lines). These are the Anthropic-related HTTP endpoints (key exists check, models list, set API key).
|
||||
|
||||
## What to test
|
||||
|
||||
- `get_anthropic_api_key_exists` — returns true/false based on stored key
|
||||
- `get_anthropic_models` — returns model list
|
||||
- `set_anthropic_api_key` — stores key, validates format
|
||||
- Error handling for missing/invalid keys
|
||||
|
||||
## Notes
|
||||
|
||||
- Follow the test patterns in `http/settings.rs` and `http/model.rs`
|
||||
- Small file, should be quick to get good coverage
|
||||
- Mock any external API calls
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
- [ ] Line coverage for `http/anthropic.rs` reaches 60%+
|
||||
- [ ] Tests pass with `cargo test`
|
||||
- [ ] `cargo clippy` clean
|
||||
@@ -0,0 +1,27 @@
|
||||
---
|
||||
name: "Add test coverage for http/mod.rs (39% -> 70%+)"
|
||||
---
|
||||
|
||||
# Story 127: Add test coverage for http/mod.rs
|
||||
|
||||
Currently at 39% line coverage (77 lines, 47 missed). This is the HTTP route setup and server initialization module.
|
||||
|
||||
## What to test
|
||||
|
||||
- Route registration (all expected paths are mounted)
|
||||
- CORS configuration
|
||||
- Static asset serving setup
|
||||
- Server builder configuration
|
||||
- Any middleware setup
|
||||
|
||||
## Notes
|
||||
|
||||
- May need integration-style tests that start a test server and verify routes exist
|
||||
- Or test the route builder functions in isolation
|
||||
- Follow patterns from existing HTTP module tests
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
- [ ] Line coverage for `http/mod.rs` reaches 70%+
|
||||
- [ ] Tests pass with `cargo test`
|
||||
- [ ] `cargo clippy` clean
|
||||
@@ -0,0 +1,28 @@
|
||||
---
|
||||
name: "Add test coverage for worktree.rs (65% -> 80%+)"
|
||||
---
|
||||
|
||||
# Story 128: Add test coverage for worktree.rs
|
||||
|
||||
Currently at 65% line coverage (330 lines, 124 missed). Worktree management is core infrastructure — creating, removing, and managing git worktrees for agent isolation.
|
||||
|
||||
## What to test
|
||||
|
||||
- `worktree_path` construction
|
||||
- `create_worktree` — branch naming, git worktree add, setup command execution
|
||||
- `remove_worktree_by_story_id` — cleanup, branch deletion
|
||||
- Setup command runner (pnpm install, pnpm build, cargo check)
|
||||
- Error paths: git failures, setup failures, missing directories
|
||||
- Edge cases: worktree already exists, branch already exists
|
||||
|
||||
## Notes
|
||||
|
||||
- Use temp git repos for integration tests
|
||||
- Mock expensive operations (pnpm install, cargo check) where possible
|
||||
- The setup command failure path is especially important (this was the root cause of bug 118)
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
- [ ] Line coverage for `worktree.rs` reaches 80%+
|
||||
- [ ] Tests pass with `cargo test`
|
||||
- [ ] `cargo clippy` clean
|
||||
@@ -0,0 +1,29 @@
|
||||
---
|
||||
name: "Add test coverage for http/mcp.rs (72% -> 85%+)"
|
||||
---
|
||||
|
||||
# Story 129: Add test coverage for http/mcp.rs
|
||||
|
||||
Currently at 72% line coverage (1826 lines, 475 missed). This is the MCP tool server — the largest module and the interface agents use to interact with the system.
|
||||
|
||||
## What to test
|
||||
|
||||
- Uncovered MCP tool handlers (check which tools lack test coverage)
|
||||
- Tool argument validation and error messages
|
||||
- Edge cases in existing tool handlers
|
||||
- The merge-queue and watcher-pause logic (added in story 119)
|
||||
- `resolve_simple_conflicts` edge cases
|
||||
- Tool dispatch routing
|
||||
|
||||
## Notes
|
||||
|
||||
- This is a large file — focus on the uncovered handlers rather than trying to test everything
|
||||
- Run `cargo llvm-cov --html` to identify specific uncovered lines/functions
|
||||
- The merge-related tools are the most critical gaps given recent changes
|
||||
- 475 missed lines is a lot — even covering half would be a big win
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
- [ ] Line coverage for `http/mcp.rs` reaches 85%+
|
||||
- [ ] Tests pass with `cargo test`
|
||||
- [ ] `cargo clippy` clean
|
||||
Reference in New Issue
Block a user