test: comprehensive test coverage across all 11 crates#63
Merged
RyderFreeman4Logos merged 14 commits intomainfrom Feb 13, 2026
Merged
test: comprehensive test coverage across all 11 crates#63RyderFreeman4Logos merged 14 commits intomainfrom
RyderFreeman4Logos merged 14 commits intomainfrom
Conversation
Expand csa-core test coverage with: - ToolName::as_str and Display for all 4 variants - ToolArg Display/FromStr roundtrip for all variants - ToolArg::from_str for opencode and claude-code - ToolArg::into_strategy for all specific tools - Case sensitivity and empty string boundary tests - AppError Display formatting for all 13 variants - Boundary value tests (zero PID, u32::MAX, empty strings) - Send+Sync trait verification for AppError Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extend csa-lock test suite with 15 new unit tests covering:
- Slot path construction and index padding verification
- slot_usage when all slots free returns zero occupied
- SlotStatus::free() saturating subtraction with bad data
- acquire_slot_blocking timeout and immediate success paths
- format_slot_diagnostic boundary cases (0 slots, all tools full)
- try_acquire_slot with session_id=None
- Exhausted variant returns correct status fields
- Lock path convention ({session}/locks/{tool}.lock)
- Automatic locks/ directory creation
- Nested non-existent parent directory handling
- Invalid path (/dev/null) error propagation
- SessionLock Debug format
- Second lock error diagnostic content verification
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
[MOTIVATION] Expand test coverage for csa-hooks crate as part of comprehensive testing initiative. The hooks subsystem lacked tests for config loading, event key mapping, and runner error paths. [IMPLEMENTATION DETAILS] - config.rs: 7 tests — load from tempdir, get_for_event mapping, missing config fallback, malformed TOML handling, default timeout, merge priority, empty file - event.rs: 7 tests — config_key uniqueness, snake_case validation, builtin_commands template vars, required vars coverage, trait derives - runner.rs: 9 tests — empty config handling, builtin command detection, missing script error, tempdir script execution, nonzero exit handling, substitute_variables edge cases Total: 45 tests passing (21 new + 24 existing). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add comprehensive tests for csa-process crate: - check_tool_installed: verify echo/true found, nonexistent tool errors - failure_summary priority chain: exhaustive stdout > stderr > exit code - Error/boundary paths: nonexistent binary spawn, empty output, false command - Boundary: truncation at max+1, whitespace-only lines Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add comprehensive tests across 5 modules in the csa-session crate: - git.rs: ensure_git_init idempotency, commit_session hash/no-changes error, history output format and empty/missing repo edge cases - manager.rs: save_session_in with explicit base, list empty sessions, delete/load non-existent session, update_last_accessed timestamp advancement, empty artifacts, invalid session ID operations - metadata.rs: TOML round-trip, file I/O round-trip, tool_locked default, missing required field error - result.rs: TOML round-trip, empty artifacts skip_serializing, status_from_exit_code for all categories, file I/O round-trip - state.rs: SessionPhase serde round-trip via wrapper struct, snake_case serialization, error message content, default phase, MetaSessionState TOML round-trip, Retired terminal state Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add comprehensive tests for the csa-resource crate covering: stats.rs (6 new tests): - P95 estimate with two records (boundary case) - P95 estimate with unsorted input (descending order) - P95 estimate across independent tools - Load from non-existent file returns default - Load from corrupt TOML file returns error - Save creates nested parent directories guard.rs (5 new tests): - check_availability fails with impossible memory limits - check_availability uses P95 estimates from recorded history - check_availability uses initial_estimates as fallback - check_availability uses default 500 MB when no estimates exist - record_usage persists multiple independent tools - Guard loads pre-existing stats from disk on construction monitor.rs (3 new tests — first test coverage for this module): - start/stop lifecycle with a real short-lived process - Non-existent PID returns 0 MB (error/boundary path) - Peak tracking completes without panic for memory-intensive process Total: 25 tests pass (14 new + 11 existing), 0 clippy warnings. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add comprehensive tests for the csa-executor crate: logging.rs (4 tests): - create_session_log_writer creates file in tempdir - Nested directory creation works - Error on invalid path (/dev/null/impossible) - Log file name contains correct timestamp format executor_build_cmd_tests.rs (27 new tests): - build_command: CSA env vars (SESSION_ID, DEPTH, PROJECT_ROOT, TOOL) - build_command: depth increments correctly (parent+1) - build_command: parent session env propagation - build_command: no CSA_PARENT_SESSION for root sessions - build_command: extra env injection (API keys) - build_command: args structure for all 4 tools - build_command: session resume flags per tool - build_command: no resume when provider_session_id is None - inject_env: sets all vars from HashMap - inject_env: empty map is no-op - codex_effort: all ThinkingBudget variants - token_count: all variants including Custom(0) and Custom(u32::MAX) - Boundary: empty prompt, special chars, empty provider, no model All tests inspect Command args/env without spawning processes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…e tests Add comprehensive tests for all four modules in csa-scheduler: - failover.rs: cooldown error, quota error, normal error, disabled tool skip, missing tier, valuable session with occupied slot, no valuable context fallback, and needs_edit=None boundary - rate_limit.rs: per-tool pattern matching (gemini quota, RESOURCE_EXHAUSTED, codex RateLimitError, claude 529, opencode too many requests), empty output, stdout-only match, split pattern boundary, first-pattern-wins, and tool name preservation - rotation.rs: full round-robin cycle via resolve_tier_tool_rotated, disabled tool skip, all-disabled returns None, empty models, single tool always selected, full spec returned, missing tier returns None, and default state is empty - session_reuse.rs: related task match scoring, no task match, old session recency decay, bidirectional related pairs, unrelated pairs boundary, and candidate sorting by score Total: 52 tests, 0 failures, 0 clippy warnings. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…e, run-helpers, todo cmds Add comprehensive unit tests for previously untested pure functions in the cli-sub-agent crate: - skill_cmds: parse_github_source (HTTPS/shorthand/error), find_skills_directory, determine_target_directory, read_skill_title - self_update: get_target_triple, ReleaseInfo/GitHubError deserialization, version string parsing, asset name formatting - batch: validate_tasks (duplicates, missing deps, cycles), build_execution_plan (single/parallel/diamond/linear), parse_tool_name, detect_cycle, BatchConfig deser - mcp_server: parse_tool_name, get_tools schema validation, JSON-RPC protocol parsing/serialization (request, response, error, notification) - pipeline: determine_project_root, load_and_validate depth checking - run_helpers: is_compress_command, parse_tool_name, parse_token_usage, extract_number, extract_cost - todo_cmd: truncate (short/exact/long/multibyte/edge) Uses separate test files (batch_tests.rs, mcp_server_tests.rs) for large modules following the existing gc_tests.rs pattern. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
… execution Extract `detect_installed_tools_in_paths(paths: &OsStr)` so tests pass a custom search path via `which::which_in` instead of mutating the process-global PATH env var. Eliminates race condition when tests run with `--test-threads=2`. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The generic "tokens:" pattern was matching "output_tokens:" and "input_tokens:" lines, causing total_tokens to be incorrectly set to the output_tokens value instead of the sum of input + output. Added a word-boundary check so "tokens:" only matches standalone occurrences (not preceded by letters or underscores). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Owner
Author
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add comprehensive regression test coverage across all 11 crates in the CSA workspace. This brings the test count from 394 to 774 (+380 tests, 96% increase).
Sprint 1 (Leaf crates + E2E)
Sprint 2 (Middle layer)
Sprint 3 (Upper layer)
Sprint 4 (CLI orchestration)
Design decisions
build_commandtests inspect args without.spawn()tempfile::tempdir()for isolationTest plan
just pre-commit— 766 unit + 8 e2e = 774 tests passingcargo clippy -- -D warnings— zero warningsjust fmt— clean🤖 Generated with Claude Code