Raise traverse-mcp line coverage from 86% to 98.55%#623
Open
enricopiovesan wants to merge 1 commit into
Open
Conversation
#594 added traverse-mcp to the coverage gate with a measured phased floor (86.07%) so it couldn't regress while a larger test tranche was completed. This closes most of that gap: - lib.rs 74.6%->99.9%: not_found/map_runtime_error/lifecycle_name exercised directly and exhaustively (every RuntimeErrorCode and Lifecycle variant), McpToolRegistry Default/Debug, observe_execution, and get_capability/get_event/get_workflow's not-found paths. - stdio_server.rs 74.6%->94.2%: StdioAuthConfig's Debug impl and from_env (refactored into an injectable from_env_var core, since mutating env vars from a test is unsafe and this workspace forbids unsafe entirely); describe_entrypoint/describe_content_group/ entrypoint_artifacts/validate_runtime_request's validation branches driven directly or via crafted stdio commands; run_stdio_server's own body via simulate_startup_failure (which returns before ever reading real stdin, so it's safe to call directly); every write_json_line call site's io_error branch, exercised with a writer that fails on the Nth `\n`-terminated envelope so each branch can be targeted individually without depending on how many raw write() calls the JSON body itself takes; malformed-JSON and invalid-UTF8 command lines; unsupported commands; and the handful of free helper functions (derive_composability_metadata, parse_workflow_ref, load_runtime_request, provenance_source_label, execute_validate_team_readiness's branches) called directly. - main.rs 0%->75%: extracted a testable `run(args)` core from `main`, covering the usage/unsupported-command/simulated-failure branches. Also converted several test-only "Err(e) => panic!(...)" match arms into single-line `.expect()`/`.expect_err()` calls across lib.rs and stdio_server.rs: those error arms are unreachable in a passing test, and llvm-cov's line coverage counts the never-taken arm as a separate missed line since it spans its own source line(s), unlike a single `.expect()` call. ci/coverage-targets.txt's traverse-mcp threshold moves from 86 to 98 (kept a small margin below the measured 98.55% for tooling variance, following the same convention as the original phased floors). Remaining gap (98.55% -> 100%) is registry-bundle-load failure paths (McpDiscoveryCatalog::load_canonical, CanonicalExecutionContext:: load_canonical, build_capability_registration all read from a fixed repo-relative canonical bundle path with no injection point for testing failure), one genuinely unreachable executor match arm given the current canonical bundle's capability set, and a get_capability double-lookup branch in tools/capabilities.rs whose failure mode isn't reachable through the public registry API. Filed as a follow-up issue per #617's Definition of Done. Closes #617 Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
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
traverse-mcpto the coverage gate with a measured phased floor (86.07%) so it couldn't regress while a larger test tranche was completed. This closes most of that gap.lib.rs74.6%→99.9%:not_found/map_runtime_error/lifecycle_nameexercised directly and exhaustively (everyRuntimeErrorCodeandLifecyclevariant),McpToolRegistryDefault/Debug,observe_execution, andget_capability/get_event/get_workflow's not-found paths.stdio_server.rs74.6%→94.2%:StdioAuthConfig'sDebugimpl andfrom_env(refactored into an injectablefrom_env_varcore, since mutating env vars from a test isunsafeand this workspace forbidsunsafeentirely);describe_entrypoint/describe_content_group/entrypoint_artifacts/validate_runtime_request's validation branches driven directly or via crafted stdio commands;run_stdio_server's own body viasimulate_startup_failure(which returns before ever reading real stdin, so it's safe to call directly); everywrite_json_linecall site'sio_errorbranch, exercised with a writer that fails on the Nth\n-terminated envelope so each branch can be targeted individually; malformed-JSON and invalid-UTF8 command lines; unsupported commands; and several free helper functions called directly.main.rs0%→75%: extracted a testablerun(args)core frommain, covering the usage/unsupported-command/simulated-failure branches.Err(e) => panic!(...)match arms into single-line.expect()/.expect_err()calls: those arms are unreachable in a passing test and llvm-cov's line coverage counts the never-taken arm as a separate missed line.ci/coverage-targets.txt'straverse-mcpthreshold moves from 86 to 98 (measured 98.55%, kept a small margin for tooling variance, matching the convention of the original phased floors).get_capabilitydouble-lookup branch that doesn't appear reachable through the public registry API — filed as #622 per the Definition of Done.Governing Spec
Project Item
Closes #617
Validation
cargo test --workspace— all tests pass (47 new/updatedtraverse-mcptests).cargo clippy --workspace --all-targets -- -D warnings— clean.cargo fmt --check— clean.bash scripts/ci/coverage_gate.sh(withLLVM_COV/LLVM_PROFDATApointed at brew llvm) — passes;traverse-mcpmeasured at 98.55%, threshold set to 98.bash scripts/ci/spec_alignment_check.sh— passes locally against this branch.