Skip to content

[#121] Add DoctorRunner integration test harness#258

Merged
bguidolim merged 6 commits intomainfrom
bruno/121-doctor-runner-harness
Mar 21, 2026
Merged

[#121] Add DoctorRunner integration test harness#258
bguidolim merged 6 commits intomainfrom
bruno/121-doctor-runner-harness

Conversation

@bguidolim
Copy link
Owner

Summary

Add a test harness that exercises DoctorRunner.run() end-to-end in a fully sandboxed environment. This verifies the runner correctly resolves scopes, loads project state, filters by pack, and handles excluded components — all without touching real ~/ paths.

Stacked on #257 (PR 2 of the #121 series).

Changes

  • Add DoctorRunnerIntegrationTests.swift with 6 tests:
    • Empty registry completes without error
    • globalOnly flag restricts to global scope
    • packFilter restricts to specified packs
    • Missing artifacts from state file are detected
    • Excluded components are skipped
    • Project packs are resolved from .mcs-project state

Test plan

  • swift test passes locally (764 tests, 0 failures)
  • swiftformat --lint . and swiftlint pass without violations
  • Affected commands verified with a real pack (e.g. mcs sync, mcs doctor)

@bguidolim bguidolim force-pushed the bruno/121-doctor-check-sandbox-tests branch from 502603f to cd19612 Compare March 21, 2026 15:40
@bguidolim bguidolim force-pushed the bruno/121-doctor-runner-harness branch from d2bd9dc to cf04342 Compare March 21, 2026 15:40
@bguidolim bguidolim force-pushed the bruno/121-doctor-check-sandbox-tests branch from cd19612 to be4bbe6 Compare March 21, 2026 15:44
@bguidolim bguidolim force-pushed the bruno/121-doctor-runner-harness branch 2 times, most recently from 39bbae3 to 0fd9d16 Compare March 21, 2026 15:56
Base automatically changed from bruno/121-doctor-check-sandbox-tests to main March 21, 2026 15:59
- Add `environment` property to DoctorRunner and 10 check structs
  (CommandCheck, MCPServerCheck, PluginCheck, HookCheck, GitignoreCheck,
  ProjectIndexCheck, PackGitignoreCheck, ExternalCommandExistsCheck,
  ExternalHookEventExistsCheck, ExternalSettingsKeyEqualsCheck),
  replacing all hardcoded `Environment()` calls
- Add `projectRootOverride` to DoctorRunner to bypass
  ProjectDetector.findProjectRoot() in tests
- Flow environment through DerivedDoctorChecks and standaloneDoctorChecks
- Thread environment from DoctorCommand to DoctorRunner
- Pass environment to PackGitignoreCheck in artifactChecks()
- Remove redundant environment parameter from private standaloneDoctorChecks()
- Add `environment` property to DoctorRunner and 10 check structs
  (CommandCheck, MCPServerCheck, PluginCheck, HookCheck, GitignoreCheck,
  ProjectIndexCheck, PackGitignoreCheck, ExternalCommandExistsCheck,
  ExternalHookEventExistsCheck, ExternalSettingsKeyEqualsCheck),
  replacing all hardcoded `Environment()` calls
- Add `projectRootOverride` to DoctorRunner to bypass
  ProjectDetector.findProjectRoot() in tests
- Flow environment through DerivedDoctorChecks and standaloneDoctorChecks
- Thread environment from DoctorCommand to DoctorRunner
- Pass environment to PackGitignoreCheck in artifactChecks()
- Remove redundant environment parameter from private standaloneDoctorChecks()
- Add 6 tests exercising DoctorRunner.run() end-to-end in sandbox
- Test empty registry, globalOnly, pack filter, missing artifacts,
  excluded components, and project state resolution
- All tests use Environment(home: tmpDir) + projectRootOverride
@bguidolim bguidolim force-pushed the bruno/121-doctor-runner-harness branch from 0fd9d16 to 43538aa Compare March 21, 2026 16:00
- Add shared makeSandboxProject(label:) to TestHelpers.swift,
  built on top of makeGlobalTmpDir
- Remove duplicated private helper from DoctorRunnerIntegrationTests
@bguidolim bguidolim merged commit 89fd320 into main Mar 21, 2026
4 checks passed
@bguidolim bguidolim deleted the bruno/121-doctor-runner-harness branch March 21, 2026 16:13
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