Skip to content

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

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

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

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.

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 13:16
@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:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jul 17, 2026
@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 89.31%. Comparing base (f1fb812) to head (785f473).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6918      +/-   ##
==========================================
- Coverage   89.39%   89.31%   -0.09%     
==========================================
  Files         685      685              
  Lines       68345    68351       +6     
  Branches    18726    18727       +1     
==========================================
- Hits        61096    61046      -50     
- Misses       5497     5550      +53     
- Partials     1752     1755       +3     
Flag Coverage Δ
shard-1 43.64% <28.57%> (-0.04%) ⬇️
shard-2 36.92% <28.57%> (+0.07%) ⬆️
shard-4 34.69% <100.00%> (-0.12%) ⬇️
shard-5 31.20% <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 83.64% <100.00%> (+0.04%) ⬆️
src/mcp/server.ts 94.25% <100.00%> (ø)

... and 2 files with indirect coverage changes

@loopover-orb

loopover-orb Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Caution

🛑 LoopOver review result - fixes required

Review updated: 2026-07-17 13:24:16 UTC

7 files · no blockers · CI failing · blocked

🛑 Suggested Action - Fix Blockers

  • AI review already in progress for this PR head: Another LoopOver pass is already running the AI review for this exact PR head. This pass is skipping to avoid a duplicate LLM call.

Review summary
AI review is already running for this PR head in another LoopOver pass. LoopOver is holding this PR for manual review until that pass completes.

Nits — 1 non-blocking
  • AI review already in progress for this PR head — The gate is held for a human reviewer rather than passed automatically; it re-evaluates once the in-flight review completes or on the next update.

CI checks failing

  • validate
  • validate-tests (3)

Decision drivers

  • ✅ Code review — No blockers (No AI review summary)
  • ⚠️ Gate result — Not blocking (Advisory; not blocking this PR.)
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: 192 registered-repo PR(s), 122 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor davion-knight; Gittensor profile; 192 PR(s), 0 issue(s).
Improvement ✅ Minor risk: clean · value: minor
Linked issue satisfaction

Addressed
The diff adds POST /v1/lint/improvement-potential in routes.ts delegating to buildStructuralImprovementAssessment via the exported checkImprovementPotentialShape, adds an improvement-potential CLI subcommand mirroring slopRiskCli's proxy pattern, and includes unit tests for both the route and CLI mirror plus parity assertions across shared inputs. All three deliverables (route, CLI subcommand, uni

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: 192 PR(s), 0 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 (CI is failing (validate, validate-tests (3))). 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.

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

REST + CLI mirror for loopover_check_improvement_potential

1 participant