Skip to content

feat(api): add a REST route + CLI mirror for loopover_check_improvement_potential - #6937

Closed
davion-knight wants to merge 1 commit into
JSONbored:mainfrom
davion-knight:feat-improvement-potential-mirror-v3
Closed

feat(api): add a REST route + CLI mirror for loopover_check_improvement_potential#6937
davion-knight wants to merge 1 commit into
JSONbored:mainfrom
davion-knight:feat-improvement-potential-mirror-v3

Conversation

@davion-knight

Copy link
Copy Markdown
Contributor

What & why

loopover_check_improvement_potential was 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 have POST /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-potential 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's only one schema. That matters here: the shape carries nested complexityDeltas/duplicationDeltas bounds 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: buildStructuralImprovementAssessment lives 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 from src/, 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 --noEmit clean.

Resubmit of #6918, which failed only on the shared tool-count invariant (expected 71 to be 70) — another tool-adding PR merged between my push and CI, so the count moved underneath. Rebased and re-pinned against the live server's actual count. No behavior change.

Closes #6748

…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
@davion-knight
davion-knight requested a review from JSONbored as a code owner July 17, 2026 14:29
@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.71%. Comparing base (363a8b5) to head (1d7df8a).
⚠️ Report is 1 commits behind head on main.

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           
Flag Coverage Δ
shard-1 43.66% <28.57%> (-0.04%) ⬇️
shard-2 36.92% <28.57%> (+0.07%) ⬆️
shard-3 32.84% <28.57%> (+0.07%) ⬆️
shard-4 34.73% <100.00%> (-0.12%) ⬇️
shard-5 31.31% <28.57%> (-0.01%) ⬇️
shard-6 45.75% <28.57%> (-0.01%) ⬇️

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

Files with missing lines Coverage Δ
src/api/routes.ts 94.78% <100.00%> (+0.01%) ⬆️
src/mcp/server.ts 96.30% <100.00%> (ø)

@loopover-orb loopover-orb Bot added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jul 17, 2026
@loopover-orb

loopover-orb Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Warning

⏸️ LoopOver review result - manual review recommended

Review updated: 2026-07-17 15:23:38 UTC

7 files · 1 AI reviewer · no blockers · CI green · dirty

⏸️ Suggested Action - Manual Review

Review summary
This PR adds a REST route (POST /v1/lint/improvement-potential) and a CLI mirror for loopover_check_improvement_potential, following the exact same pattern already established for check_slop_risk and simulate_open_pr_pressure. The route reuses the tool's own exported zod shape (a one-word export change) so the two surfaces can't diverge on input validation, and returns only the same three-field subset the tool handler returns, which is directly pinned by a test asserting the exact key set. The CLI-side shape is a necessary hand-mirror (bin can't import from src/) but its bounds are tested against every rejected case, matching the established convention (#6750/#6751) for this kind of proxy tool.

Nits — 3 non-blocking
  • packages/loopover-mcp/bin/loopover-mcp.js:640-666 repeats magic numbers (400, 2000) already duplicated across sibling shapes in the file; not new to this PR's pattern but worth a shared constant eventually.
  • Consider extracting the repeated max(400)/max(2000) bounds into named constants shared across the sibling shapes in loopover-mcp.js, since this file already has several near-identical schemas.
  • No functional changes needed; the parity tests (routes-improvement-potential.test.ts and mcp-cli-improvement-potential-tool.test.ts) look sufficiently thorough for both directions of the mirror.

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 #6748
Related work ⚠️ 3 scoped overlaps Top overlaps are listed below; lower-confidence bulk is hidden.
Change scope ❌ 8/20 High 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: 193 registered-repo PR(s), 122 merged, 1 issue(s).
Contributor context ✅ Confirmed Gittensor contributor davion-knight; Gittensor profile; 193 PR(s), 1 issue(s).
Improvement ✅ Minor risk: clean · value: minor
Review context
  • Author: davion-knight
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Rust
  • Official Gittensor activity: 193 PR(s), 1 issue(s).
  • Related work: Titles/paths share 6 meaningful terms. (issue #6744)
  • Related work: Titles/paths share 6 meaningful terms. (issue #6747)
  • Related work: Titles/paths share 6 meaningful terms. (issue #6746)
  • Additional title-only matches omitted; title-only overlap does not block.
Contributor next steps
  • Start here: Review top overlaps.
  • Then work through the remaining 2 steps in the Signals table above.
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.

🟩 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 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

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.

@loopover-orb loopover-orb Bot closed this Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. manual-review Gittensor contributor context

Projects

None yet

Development

Successfully merging this pull request may close these issues.

REST + CLI mirror for loopover_check_improvement_potential

1 participant