[#121] Add sandbox tests for core doctor checks#257
Closed
bguidolim wants to merge 2 commits intobruno/121-doctor-environment-injectionfrom
Closed
[#121] Add sandbox tests for core doctor checks#257bguidolim wants to merge 2 commits intobruno/121-doctor-environment-injectionfrom
bguidolim wants to merge 2 commits intobruno/121-doctor-environment-injectionfrom
Conversation
1cc449f to
502603f
Compare
This was referenced Mar 21, 2026
- Add 23 tests across 5 suites verifying doctor checks work correctly with injected Environment(home: tmpDir) - Cover MCPServerCheck, PluginCheck, HookCheck, ProjectIndexCheck, and DerivedDoctorChecks with full sandbox isolation - Verify check/fix behavior for pass, fail, warn, skip, and fix paths
- Add `commit.gpgsign=false` to test repo config in PackFetcherTests and PackUpdaterTests to prevent 1Password SSH agent interference - Fix ambiguous #require assertion in CoreDoctorCheckSandboxTests
502603f to
cd19612
Compare
3 tasks
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 sandbox tests for all core doctor check structs that were made injectable in PR #256. Each test creates a temp directory, constructs
Environment(home: tmpDir), and verifies check behavior against controlled file fixtures — no real~/paths are touched.Stacked on #256 (PR 1 of the #121 series).
Changes
CoreDoctorCheckSandboxTests.swiftwith 23 tests across 5 suites:MCPServerCheckSandboxTests(5 tests): global/project-scoped servers, missing server, missing file, invalid JSONPluginCheckSandboxTests(3 tests): enabled/not-enabled plugin, missing settingsHookCheckSandboxTests(6 tests): present+executable, missing, optional skip, not-executable, fix makes executable, fix when missingProjectIndexCheckSandboxTests(5 tests): all paths valid, stale paths, empty index, fix prunes stale, global sentinelDerivedDoctorCheckSandboxTests(4 tests): copyPackFile global URL, copyPackFile with project root + fallback, mcpServer uses env, allDoctorChecks forwards envTest plan
swift testpasses locally (758 tests, only pre-existing 1Password SSH agent failures in PackFetcher/PackUpdater)swiftformat --lint .andswiftlintpass without violationsmcs sync,mcs doctor)