Skip to content

Extract status and doctor coverage from the monolithic CLI integration target #197

Description

@errfld

Summary

Extract the status and doctor end-to-end coverage from the monolithic CLI integration test target into a focused diagnostics integration test module, while preserving all existing behavior and platform coverage.

Concrete file/function evidence

  • crates/git-smee-cli/tests/cli_integration.rs is 2,226 lines and contains coverage for every CLI command plus Unix/Windows hook execution and config-path edge cases.
  • Diagnostics alone form a cohesive block around cli_integration.rs:210-532: healthy doctor text/JSON, status coverage/drift text/JSON, malformed/missing config, unmanaged hooks, marker placement, custom hooks paths, and stale managed hooks.
  • The production code now has focused crates/git-smee-cli/src/status.rs, doctor.rs, and diagnostics.rs modules, but their end-to-end tests remain interleaved with install, run, init, migrate-hooks, and platform wrapper scenarios.
  • crates/git-smee-cli/tests/common.rs is only 68 lines and already provides the shared TestRepo fixture, leaving a clear seam for multiple integration test targets.

Architectural concern

Production diagnostics have cohesive ownership after issue #164, but the integration-test extension path does not mirror it. Adding a status or doctor contract case requires navigating a 2,000+ line all-commands target, and unrelated command scenarios share one compilation/test unit. This makes diagnostics contract changes harder for a human reviewer to locate and increases collision risk as command coverage grows.

Proposed direction

Move only the status/doctor endpoint-style CLI tests into a focused target such as crates/git-smee-cli/tests/diagnostics_integration.rs. Keep reusable repository/config/hook setup in tests/common.rs; move diagnostics-only helpers with the new target. Preserve test bodies and assertions mechanically before considering any cleanup.

This is a test-ownership refactor, not a production behavior change or a request to reorganize every integration test in one PR.

Acceptance criteria

  • Existing status and doctor text/JSON, drift, config-error, hooks-path, unmanaged-hook, and stale-wrapper scenarios run from a focused diagnostics integration test target.
  • cli_integration.rs no longer contains those diagnostics scenarios.
  • Shared fixtures live in tests/common.rs without command-specific assertions leaking into the common module.
  • No test is deleted, weakened, ignored, or loses its existing cfg platform behavior.
  • Production source and public CLI output remain unchanged.

Validation expectations

  • cargo fmt --all -- --check
  • cargo clippy -p git-smee-cli --all-targets --all-features -- -D warnings
  • Run the new diagnostics target directly (for example cargo test -p git-smee-cli --test diagnostics_integration).
  • Run cargo test -p git-smee-cli --all-targets --all-features to prove the split did not drop or duplicate coverage.

Metadata

Metadata

Assignees

Labels

architectural-reviewFollow-up from scheduled architectural reviewenhancementNew feature or requestrustPull requests that update rust codestatus:doneCompletedtype:taskTask

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions