test(mcp): cover find-opportunities searchQuery, goal-spec, and token-fallback paths - #6112
Closed
jaytbarimbao-collab wants to merge 1 commit into
Conversation
…-fallback paths Fixes JSONbored#5847. runFindOpportunities had reachable branches its existing test never exercised (all existing cases pass `targets`, never `searchQuery`). Adds direct tests for: the searchQuery path (searchCandidateIssuesWithSummary) + its post-search canAccessRepo re-filter; buildGoalSpecsByRepo lane/languages and the appliedLane/appliedMinRankScore result fields; the resolveDiscoveryGithubToken installation-token fallback loop (skip a repo with no installationId, call createInstallationToken for one that has it, swallow the mint failure); and the validated.ok===false rejection through runFindOpportunities itself. Test-only; branch coverage of the file rises 79.34% -> 97.52%.
Contributor
Author
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.
Fixes #5847.
runFindOpportunities(the hostedloopover_find_opportunitiesMCP tool) had reachable branches its existing test never exercised — every existing case passestargets, neversearchQuery. Test-only, adds direct coverage for:searchQuerypath (searchCandidateIssuesWithSummaryinstead offetchCandidateIssuesWithSummary) and its post-searchcanAccessRepore-filter (kept only the accessible repo of two search results);buildGoalSpecsByRepolane/languages plus theappliedLane/appliedMinRankScoreresult fields;resolveDiscoveryGithubToken's installation-token fallback loop — skips a repo with noinstallationId, callscreateInstallationTokenfor one that has it, and swallows the mint failure to try the next;validated.ok === falserejection throughrunFindOpportunitiesitself (not just the direct validator).Branch coverage of
src/mcp/find-opportunities.tsrises 79.34% → 97.52% (the remaining arms are the App-token-mint success path, which needs live GitHub-App JWT infra). 19 tests pass; typecheck clean.