-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Context
PackFetcherOperationTests creates real local git repos as test fixtures, running actual git init, git commit, git clone etc. via ShellRunner. This causes flaky failures when environment tools (e.g. 1Password SSH agent) intercept git signing:
error: 1Password: agent returned an error
fatal: failed to write commit object
The root cause is that ShellRunner is a concrete struct with no protocol abstraction, making it impossible to inject a mock in tests.
Prior art
ClaudeCLI was already extracted into a protocol (ClaudeIntegration: ClaudeCLI) with MockClaudeCLI in TestHelpers.swift (PR #239). The same pattern should be applied to ShellRunner.
Proposed approach
- Extract a
ShellRunningprotocol fromShellRunnerwith the key methods (run,commandExists) - Change all injection sites to accept
any ShellRunning:PackFetcher,LockfileOperations,Configurator,ComponentExecutorScriptRunner,PromptExecutor,GitignoreManager,Homebrew
- Create
MockShellRunnerinTestHelpers.swiftthat records calls and returns cannedShellResultvalues - Rewrite
PackFetcherOperationTeststo useMockShellRunnerinstead of real git repos - Enable testing of
LockfileOperationsgit checkout/fetch retry logic (currently untestable — guard-path tests only)
Scope
~15+ files inject ShellRunner as a stored property. The protocol extraction itself is mechanical but touches many files.
Related
- LockedCommand creates Environment twice (once for lock file, once in perform) #207 — Injectable ShellRunner for LockfileOperations test coverage
- PR [#100] Add GlobalSyncStrategy test coverage through Configurator #239 — ClaudeCLI protocol extraction (prior art pattern)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request