feat(api): add a REST route + CLI mirror for loopover_check_improvement_potential - #6937
Conversation
…nt_potential loopover_check_improvement_potential was the one deterministic lint tool with neither a REST route nor a CLI mirror: its siblings loopover_check_slop_risk, loopover_check_issue_slop, loopover_lint_pr_text, and loopover_validate_config all already have POST /v1/lint/... routes and CLI mirrors. It is the same tier -- rate-limit-only, pure local-metadata, no source uploaded. Adds POST /v1/lint/improvement-potential beside them. Rather than hand-copying the tool's input contract, the route parses with the tool's OWN checkImprovementPotentialShape, now exported from src/mcp/server.ts (a one-word change): the two surfaces cannot diverge on accepted input because there is only one schema. It returns the SAME field subset the tool's handler returns (improvementScore/band/findings) rather than the whole assessment, so the mirror is byte-identical to the tool rather than merely similar -- a test asserts the response has exactly those three keys. Adds the loopover_check_improvement_potential stdio tool. Like the boundary-tests and open-PR-pressure mirrors it PROXIES to the route rather than computing in-process: buildStructuralImprovementAssessment lives app-side in src/signals/improvement.ts, not in @loopover/engine. The bin cannot import from src/ (package boundary), so its zod shape is the one hand-mirrored copy -- reproduced VERBATIM, including every nested complexityDeltas/duplicationDeltas bound -- and its own tests pin that those bounds are enforced in the tool rather than waved through to a route 400. Route tests assert the handler's exact subset for a structurally-improving change, parity with the scorer across empty/test-only/coverage-regression inputs, 400s for each rejected bound, and an unparseable body. 100% line and branch coverage on every changed line. Closes JSONbored#6748
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6937 +/- ##
=======================================
Coverage 93.71% 93.71%
=======================================
Files 685 685
Lines 68358 68364 +6
Branches 18726 18727 +1
=======================================
+ Hits 64059 64065 +6
Misses 3302 3302
Partials 997 997
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Warning ⏸️ LoopOver review result - manual review recommendedReview updated: 2026-07-17 15:23:38 UTC
Review summary Nits — 3 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk 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.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 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.
|
|
LoopOver is closing this pull request on the maintainer's behalf (conflicts with the base branch — resolve and open a fresh PR). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed. |
What & why
loopover_check_improvement_potentialwas the one deterministic lint tool with neither a REST route nor a CLI mirror — its siblings (check_slop_risk,check_issue_slop,lint_pr_text,validate_config) all already havePOST /v1/lint/...routes and CLI mirrors, and it's the same tier: rate-limit-only, pure local-metadata, no source uploaded.One schema, and the tool's exact response
POST /v1/lint/improvement-potentialparses with the tool's owncheckImprovementPotentialShape, now exported fromsrc/mcp/server.ts(a one-word change) — the two surfaces cannot diverge on accepted input, because there's only one schema. That matters here: the shape carries nestedcomplexityDeltas/duplicationDeltasbounds a hand-copy would have quietly gotten wrong.It also returns the same field subset the tool's handler returns (
improvementScore/band/findings), not the whole assessment — a test asserts the response has exactly those three keys, so the mirror is byte-identical rather than merely similar.Why this CLI mirror proxies
Consistent with #6750/#6751:
buildStructuralImprovementAssessmentlives app-side (src/signals/improvement.ts), not in@loopover/engine, so the tool proxies and the route stays the single source of truth for scoring. The bin can't import fromsrc/, so its zod shape is the one hand-mirrored copy — reproduced verbatim, and its tests pin that every real bound is enforced in the tool, before any API call.Tests
Route: the handler's exact subset for a structurally-improving change (complexity down, duplication resolved, coverage up, tests added); parity with the scorer across empty / test-only / coverage-regression inputs; 400s for each rejected bound; unparseable body. CLI: the proxied POST, the all-optional empty payload, and bound enforcement before any call.
100% line and branch coverage on every changed line.
tsc --noEmitclean.Closes #6748