Skip to content

fix(openapi): document /v1/opportunities/find + /v1/issue-rag/retrieve - #9452

Merged
loopover-orb[bot] merged 7 commits into
JSONbored:mainfrom
andriypolanski:fix/9310-openapi-opportunities-issue-rag-v3
Jul 27, 2026
Merged

fix(openapi): document /v1/opportunities/find + /v1/issue-rag/retrieve#9452
loopover-orb[bot] merged 7 commits into
JSONbored:mainfrom
andriypolanski:fix/9310-openapi-opportunities-issue-rag-v3

Conversation

@andriypolanski

@andriypolanski andriypolanski commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Closes openapi: /v1/opportunities/find + /v1/issue-rag/retrieve missing from spec (MCP tools + schemas already exist) #9310
  • Adds FindOpportunitiesRequest/FindOpportunitiesResponse and IssueRagRetrieveRequest/IssueRagRetrieveResponse schemas mirroring the MCP tool Zod shapes (reusing the same MAX_FIND_OPPORTUNITIES_* / MAX_ISSUE_RAG_* / PREFLIGHT_LIMITS constants).
  • Registers both POST paths in src/openapi/spec.ts (same registration pattern as #6611 / gate-config/effective).
  • Regenerates and commits apps/loopover-ui/public/openapi.json.
  • Extends openapi.test.ts with path/schema presence + field regression guards (aiPolicyAllowed, retrievedPathCount).

Why #9423 closed

PR #9423 had green CI and no review blockers, but was auto-closed for a base-branch conflict. This is a fresh reimplementation on current upstream/main.

Scope

  • The PR title follows type(scope): short summary Conventional Commit format, for example fix(api): restore profile access checks.
  • This PR is focused and does not mix unrelated backend, UI, MCP, docs, dependency, and deploy changes.
  • This follows CONTRIBUTING.md and does not reintroduce GitHub Pages, VitePress, site/, or CNAME.
  • I linked a currently open issue this PR resolves (e.g. Closes #123) — a linked open issue is required for every contributor PR.

Validation

  • git diff --check
  • npm run ui:openapi + npm run ui:openapi:check
  • npx vitest run test/unit/openapi.test.ts — 5 passed
  • npm run test:ci (full gate; run before push)
  • New or changed behavior has unit/integration tests for new branches, fallback paths, and sanitizer boundaries

If any required check was skipped, explain why:

OpenAPI documentation + regeneration + targeted contract test complete. Full test:ci left for the opener.

Safety

  • No secrets, wallets, hotkeys, trust scores, or reward values.
  • Does not touch site/, CNAME, **/lovable/**, or root CHANGELOG.md.

UI Evidence

N/A — OpenAPI contract / generated openapi.json only; no product UI change.

Notes for reviewers / gate

  • No production route behavior change — documentation parity only.
  • Fresh PR required: closed PRs are not reopened after conflict auto-close.

andriy-polanski and others added 7 commits July 27, 2026 18:13
JSONbored#9310)

Both discovery routes were live (and MCP-backed) but absent from OpenAPI.
Add request/response schemas mirroring the MCP tool shapes, register the
POST paths, regenerate openapi.json, and add regression assertions.
Replaces conflict-closed JSONbored#9423 on current main.

Co-authored-by: Cursor <cursoragent@cursor.com>
Resolve the openapi.json conflict by regenerating from the merged
schemas/spec sources so JSONbored#9310 opportunities/issue-rag paths and main coexist.

Co-authored-by: Cursor <cursoragent@cursor.com>
@andriypolanski andriypolanski changed the title Fix/9310 openapi opportunities issue rag v3 fix(openapi): document /v1/opportunities/find + /v1/issue-rag/retrieve Jul 27, 2026
@loopover-orb

loopover-orb Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-27 19:34:46 UTC

4 files · 1 AI reviewer · no blockers · readiness 100/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This PR adds OpenAPI schemas and path registrations for two previously-undocumented routes, /v1/opportunities/find and /v1/issue-rag/retrieve, mirroring the Zod shapes in src/mcp/find-opportunities.ts and src/mcp/issue-rag.ts, and regenerates the committed openapi.json. Cross-checking FindOpportunitiesRequestSchema/FindOpportunitiesResponseSchema against the actual runFindOpportunities implementation shows the field names, limits (MAX_FIND_OPPORTUNITIES_TARGETS, minRankScore 0-100, publicRankScore's aiPolicyAllowed:true literal) line up correctly, and the test additions assert both new paths and both new schemas exist plus spot-check the aiPolicyAllowed/retrievedPathCount fields that would catch silent drift. The change is narrow, doc-only (plus a regenerated JSON artifact and one new test assertion block), and closes issue #9310 per the PR description.

Nits — 5 non-blocking
  • src/openapi/schemas.ts: FindOpportunitiesRequestSchema and IssueRagRetrieveRequestSchema aren't `.openapi()`-tagged or registered in spec.ts's registry.register() list (unlike LintPrTextRequest, ValidateLinkedIssueRequest, etc. used elsewhere in this same file), so the request bodies render as anonymous inline schemas instead of named $ref components — worth doing for consistency with the established route pattern.
  • src/openapi/schemas.ts:2100-2101: IssueRagRetrieveRequestSchema's `owner`/`repo` fields have no `.min(1)` even though both are in the `required` list — since the stated goal of this PR is verbatim parity with the MCP tool's Zod shape, confirm issueRagShape in src/mcp/server.ts doesn't enforce a min length that's being silently dropped here.
  • src/openapi/schemas.ts: FindOpportunitiesResponseSchema marks `ranked`/`totalCandidates` as `.optional()`, but runFindOpportunities always returns both (ranked defaults to `[]`, totalCandidates always set) — making them required would tighten the documented contract to match the real return shape.
  • Register FindOpportunitiesRequestSchema/IssueRagRetrieveRequestSchema as named components the same way response schemas are, for consistency with other routes in spec.ts.
  • Mark `ranked` and `totalCandidates` required on FindOpportunitiesResponseSchema since runFindOpportunities never omits them.

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #9310
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 180 registered-repo PR(s), 117 merged, 22 issue(s).
Contributor context ✅ Confirmed Gittensor contributor andriypolanski; Gittensor profile; 180 PR(s), 22 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Linked issue satisfaction

Addressed
The PR adds FindOpportunitiesResponseSchema/IssueRagRetrieveResponseSchema plus matching request-body schemas in schemas.ts, registers both as components and registerPath entries in spec.ts mirroring the gate-config/effective pattern, regenerates and commits openapi.json, and adds regression tests asserting both paths and key response fields (aiPolicyAllowed, retrievedPathCount) exist.

Review context
  • Author: andriypolanski
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Python, TypeScript, Rust, Cuda, JavaScript, Kotlin, MDX, Scala
  • Official Gittensor activity: 180 PR(s), 22 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Keep the PR focused and include validation evidence before maintainer review.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
🧪 Chat with LoopOver

Ask LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @loopover ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

Full command reference: https://loopover.ai/docs/loopover-commands

🧪 Experimental — new and may change.

Visual preview
Route Viewport Before (production) After (this PR's preview) Diff
/ desktop before /
before /
after /
after /
/ mobile before / (mobile)
before / (mobile)
after / (mobile)
after / (mobile)

Click any thumbnail to open the full-size screenshot. Before = production · After = this PR's preview deploy.

Scroll preview
Route Before (production) After (this PR's preview)
/ before / (scroll)
before / (scroll)
after / (scroll)
after / (scroll)

A short scroll-through clip (desktop) — click either thumbnail to open the full animation. Evidence for scroll-linked behavior a single screenshot can't show.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.

  • Re-run LoopOver review

@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 27, 2026
@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.69%. Comparing base (a4894da) to head (372ee66).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9452      +/-   ##
==========================================
+ Coverage   75.51%   75.69%   +0.18%     
==========================================
  Files         275      277       +2     
  Lines       58032    58480     +448     
  Branches     6209     6216       +7     
==========================================
+ Hits        43820    44267     +447     
  Misses      13942    13942              
- Partials      270      271       +1     
Flag Coverage Δ
backend 99.77% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/openapi/schemas.ts 100.00% <100.00%> (ø)
src/openapi/spec.ts 99.63% <100.00%> (ø)

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LoopOver approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit c8c9e44 into JSONbored:main Jul 27, 2026
10 checks passed
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.

openapi: /v1/opportunities/find + /v1/issue-rag/retrieve missing from spec (MCP tools + schemas already exist)

2 participants