Skip to content

openapi: /v1/scoring/eligibility-plan + /v1/scoring/explain-breakdown missing from spec (MCP tools + schemas already exist) - #9421

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
phamngocquy:miner/issue-9301
Jul 27, 2026
Merged

openapi: /v1/scoring/eligibility-plan + /v1/scoring/explain-breakdown missing from spec (MCP tools + schemas already exist)#9421
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
phamngocquy:miner/issue-9301

Conversation

@phamngocquy

Copy link
Copy Markdown
Contributor

Summary

src/api/routes.ts has two live, tested /v1/scoring/* POST routes, each already backed by an MCP
tool with its own Zod output shape in src/mcp/server.ts:

  • POST /v1/scoring/eligibility-planloopover_get_eligibility_plan (outputSchema: eligibilityPlanOutputSchema)
  • POST /v1/scoring/explain-breakdownloopover_explain_score_breakdown (outputSchema: scoreBreakdownOutputSchema)

Neither route appears anywhere in src/openapi/spec.ts — grep for "/v1/scoring/eligibility-plan"
and "/v1/scoring/explain-breakdown" in that file returns nothing, and neither route is reachable
from the generated apps/loopover-ui/public/openapi.json. Their sibling /v1/scoring/* routes
(/v1/scoring/model, /v1/scoring/preview) ARE documented. This is the same class of gap #6611
fixed for /v1/repos/{owner}/{repo}/gate-config/effective ("OpenAPI spec is missing GET
.../gate-config/effective (documented sibling: live-gate-thresholds)").

Deliverables

  • EligibilityPlanResponseSchema and ScoreBreakdownResponseSchema added to
    src/openapi/schemas.ts, matching the MCP tools' existing output shapes field-for-field.
  • Both routes registered as OpenAPI paths in src/openapi/spec.ts.
  • apps/loopover-ui/public/openapi.json regenerated via npm run ui:openapi and committed.
  • npm run ui:openapi:check passes in CI.

All deliverables are required in this one PR — there is no follow-up issue.

Test plan

99%+ Codecov patch target (codecov/patch, unsharded via npm run test:coverage) on any new schema
helper code. Add a regression test (or extend an existing OpenAPI-spec snapshot/shape test) asserting
both new paths are present in buildOpenApiSpec()'s output with the correct method and a response
schema whose keys match eligibilityPlanOutputSchema/scoreBreakdownOutputSchema.

Fixes #9301

… missing from spec (MCP tools + schemas already exist)

Fixes JSONbored#9301
@phamngocquy
phamngocquy requested a review from JSONbored as a code owner July 27, 2026 17:41
@superagent-security

Copy link
Copy Markdown
Contributor

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

@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 18:05:02 UTC

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

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
The AI review returned non-blocking notes for this change but did not include a separate narrative summary. Review the nits below before deciding this PR.

Nits — 4 non-blocking
  • src/openapi/spec.ts (new paths): neither /v1/scoring/eligibility-plan nor /v1/scoring/explain-breakdown declares a requestBody schema even though explain-breakdown's own 400 description says contributorLogin is required in the body — worth adding a request schema for completeness, matching the pattern used for /v1/loop/evaluate-escalation.
  • The magic numbers 200/400 in the new registerPath response blocks (src/openapi/spec.ts) are standard HTTP status keys already used identically elsewhere in the file, so this is a non-issue from the external brief, not a real nit.
  • Consider adding a requestBody schema (e.g. a ScoringPreviewRequest) to both new paths in src/openapi/spec.ts so consumers know what fields (like contributorLogin) to send, not just what comes back.
  • The regression test in test/unit/openapi.test.ts is well-targeted (asserts path presence + response schema key parity via the exported MCP output shapes) — this is the right kind of contract test to prevent future spec drift for sibling routes.

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 #9301
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: 14 registered-repo PR(s), 7 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor phamngocquy; Gittensor profile; 14 PR(s), 0 issue(s).
Improvement ✅ Minor risk: clean · value: minor
Linked issue satisfaction

Addressed
Both schemas are added to schemas.ts matching the exported MCP output shapes field-for-field, both routes are registered via registry.register + registerPath in spec.ts mirroring the gate-config pattern, the generated openapi.json is updated, and a regression test asserts both paths exist with schema key parity to the MCP tool outputs.

Review context
  • Author: phamngocquy
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Java, Python, Lua, Jupyter Notebook, C, Dockerfile, JavaScript, Shell
  • Official Gittensor activity: 14 PR(s), 0 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 <question> answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat <question> 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.

Decision record
  • action: merge · clause: success
  • config: 7c4018d7df37ef3307558a88e70a78a8705db36fa7b5bded70f6e7216b71d23e · pack: oss-anti-slop · ci: passed
  • record: edfa1b7e2220c7625da2b02efa17fee7654fcad32a9b67181917d69684a14d2b (schema v5, head 14c6e19)
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

@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 76.09%. Comparing base (71aad1a) to head (14c6e19).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9421      +/-   ##
==========================================
+ Coverage   75.51%   76.09%   +0.58%     
==========================================
  Files         275      278       +3     
  Lines       58032    59610    +1578     
  Branches     6209     6456     +247     
==========================================
+ Hits        43820    45362    +1542     
- Misses      13942    13955      +13     
- Partials      270      293      +23     
Flag Coverage Δ
backend 97.71% <100.00%> (?)

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

Files with missing lines Coverage Δ
src/mcp/server.ts 97.13% <100.00%> (ø)
src/openapi/schemas.ts 100.00% <100.00%> (ø)
src/openapi/spec.ts 99.53% <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.

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/scoring/eligibility-plan + /v1/scoring/explain-breakdown missing from spec (MCP tools + schemas already exist)

1 participant