Skip to content

REST + CLI mirror for loopover_explain_review_risk #6980

Description

@JSONbored

Context

The MCP tool loopover_explain_review_risk (src/mcp/server.ts:2558-2565, implementation explainReviewRisk at src/mcp/server.ts:4210-4232) builds a review-risk explanation for a planned PR — the same buildPreflightResult core its sibling loopover_preflight_pr uses, plus an optional per-contributor roleContext (maintainer-lane / duplicate-risk recommendation) when contributorLogin is supplied. loopover_preflight_pr already has both a REST route (POST /v1/preflight/pr, src/api/routes.ts:3536) and a CLI mirror — loopover_explain_review_risk has neither, despite sharing the same preflightShape input contract (src/mcp/server.ts:327-336).

Requirements

  • Add POST /v1/preflight/review-risk in src/api/routes.ts, following POST /v1/preflight/pr's exact validation/response pattern (same preflightSchema/PREFLIGHT_LIMITS), but returning explainReviewRisk's richer payload (preflight, roleContext, recommendation) instead of the bare preflight result.
  • Add a CLI mirror (maintain explain-review-risk or the equivalent registerStdioTool entry in packages/loopover-mcp/bin/loopover-mcp.js, following the CLI mirror already shipped for loopover_preflight_pr).
  • contributorLogin stays optional in both the route and CLI mirror, matching the MCP tool's own optional-role-context behavior (src/mcp/server.ts:4211).

Deliverables

  • POST /v1/preflight/review-risk route
  • CLI mirror command
  • Unit test asserting output parity between the MCP tool and the new REST/CLI surfaces for identical input (both with and without contributorLogin)

Test Coverage Requirements

99%+ Codecov patch coverage on every changed line and branch in the new route/CLI code, plus the parity test above.

Expected Outcome

loopover_explain_review_risk is reachable over REST and CLI, matching every other MCP tool in the "review" category.

Links & Resources

Precedent: POST /v1/preflight/pr (src/api/routes.ts:3536) and its CLI mirror — the sibling route/CLI pair using the identical preflightShape input contract.

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:featureGittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.help wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions