Skip to content

test: comprehensive test coverage across all 11 crates#63

Merged
RyderFreeman4Logos merged 14 commits intomainfrom
test/comprehensive-coverage
Feb 13, 2026
Merged

test: comprehensive test coverage across all 11 crates#63
RyderFreeman4Logos merged 14 commits intomainfrom
test/comprehensive-coverage

Conversation

@RyderFreeman4Logos
Copy link
Owner

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)

  • csa-core: 35 new tests — ToolName/ToolArg conversions, AppError display, Send+Sync
  • csa-lock: 16 new tests — slot diagnostics, path formatting, blocking timeout, concurrent locks
  • csa-hooks: 21 new tests — config loading, event dispatch, runner error paths
  • e2e: 5 new smoke tests — config show, gc --dry-run, tiers, skill list, session list

Sprint 2 (Middle layer)

  • csa-config: 42 new tests — global config, init detection, validation boundaries
  • csa-process: 11 new tests — tool check, failure summary priority chain
  • csa-session: 31 new tests — git ops, metadata roundtrip, state transitions, session CRUD
  • csa-resource: 15 new tests — P95 stats, guard availability, monitor lifecycle

Sprint 3 (Upper layer)

  • csa-executor: 31 new tests — build_command args (no spawn!), env injection, effort mapping
  • csa-scheduler: 34 new tests — failover, rate limit detection, rotation, session reuse
  • csa-todo: 39 new tests — git scoped commits, version diff, plan lifecycle, find/filter

Sprint 4 (CLI orchestration)

  • cli-sub-agent: 91 new unit tests — skill_cmds, self_update, batch, mcp_server, pipeline, run_helpers, todo_cmd
  • e2e: 5 new smoke tests (included in Sprint 1)

Design decisions

  • Decision 7: No real LLM tool spawning — all build_command tests inspect args without .spawn()
  • Decision 8: Git = hard dependency — tests call git directly, fail if missing (no skip/ignore)
  • All filesystem tests use tempfile::tempdir() for isolation

Test plan

  • just pre-commit — 766 unit + 8 e2e = 774 tests passing
  • cargo clippy -- -D warnings — zero warnings
  • just fmt — clean

🤖 Generated with Claude Code

RyderFreeman4Logos and others added 12 commits February 12, 2026 10:11
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>
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

RyderFreeman4Logos and others added 2 commits February 12, 2026 19:54
… 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>
@RyderFreeman4Logos
Copy link
Owner Author

@codex review

@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@RyderFreeman4Logos RyderFreeman4Logos merged commit 816bea0 into main Feb 13, 2026
5 checks passed
@RyderFreeman4Logos RyderFreeman4Logos deleted the test/comprehensive-coverage branch February 13, 2026 04:08
@RyderFreeman4Logos RyderFreeman4Logos restored the test/comprehensive-coverage branch February 18, 2026 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments