test(harness-search): exercise search() success + failure branches via injected runner#280
Merged
Merged
Conversation
…a injected runner `HarnessSearchService` already accepts a `YNHCommandRunner` and `YNHDetectorProtocol` via init, but the existing tests all fall through the `.missing` detector guard — leaving the entire `search()` body (arg construction, env override, command result decode, error paths) uncovered. Adds a `StubYNHCommandRunner` test double and nine tests covering: - result decoding from canned JSON - empty-query "browse all" arg shape - whitespace-only query treated as browse - non-zero exit code → error - malformed JSON → error - runner throws → error - `ynhHomeOverride` propagates to environment - subsequent search call cancels the previous (debounce) Coverage moves from "init + reset + .missing-guard only" to the full success path. Closes the easy-win line item from `.claude/plans/2026-04-22-test-integration-initial-handover.md` (plan-2 table at line 172). Tests: 1705 → 1713 (+8 net new; the existing 9 still pass). Co-Authored-By: Claude Opus 4.7 (1M context) <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
`HarnessSearchService` already accepts `YNHCommandRunner` and `YNHDetectorProtocol` via init (Phase 9d/9 protocol work landed earlier), but every existing test falls through the `.missing` detector guard — so the entire `search()` body (argument construction, env override, command result decode, error paths) was uncovered. Plan-2 flagged this as the easy win.
This PR adds a `StubYNHCommandRunner` test double and nine tests covering the success and failure branches of `search()`. No production code changes.
What's tested
Numbers
Out of scope
The other items from the plan-2 "needs architecture" table are filed as #273–#279.
Test plan
CI is sufficient — pure-test PR with no production code changes.
🤖 Generated with Claude Code