Skip to content

test(mcp): cover find-opportunities searchQuery, goal-spec, and token-fallback paths - #6112

Closed
jaytbarimbao-collab wants to merge 1 commit into
JSONbored:mainfrom
jaytbarimbao-collab:test-find-opportunities-search-goalspec-token
Closed

test(mcp): cover find-opportunities searchQuery, goal-spec, and token-fallback paths#6112
jaytbarimbao-collab wants to merge 1 commit into
JSONbored:mainfrom
jaytbarimbao-collab:test-find-opportunities-search-goalspec-token

Conversation

@jaytbarimbao-collab

Copy link
Copy Markdown
Contributor

Fixes #5847.

runFindOpportunities (the hosted loopover_find_opportunities MCP tool) had reachable branches its existing test never exercised — every existing case passes targets, never searchQuery. Test-only, adds direct coverage for:

  • the searchQuery path (searchCandidateIssuesWithSummary instead of fetchCandidateIssuesWithSummary) and its post-search canAccessRepo re-filter (kept only the accessible repo of two search results);
  • buildGoalSpecsByRepo lane/languages plus the appliedLane/appliedMinRankScore result fields;
  • resolveDiscoveryGithubToken's installation-token fallback loop — skips a repo with no installationId, calls createInstallationToken for one that has it, and swallows the mint failure to try the next;
  • validated.ok === false rejection through runFindOpportunities itself (not just the direct validator).

Branch coverage of src/mcp/find-opportunities.ts rises 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.

…-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%.
@jaytbarimbao-collab

Copy link
Copy Markdown
Contributor Author

Withdrawing — #5847 was already resolved by #6106 (merged). Duplicate.

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(mcp): find-opportunities.ts's searchQuery + goal-spec + token-fallback paths are untested (79.34% branch coverage)

1 participant