Skip to content

feat(api): REST + CLI mirror for loopover_build_results_payload - #6904

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
lourincedaging0-commits:feat/rest-cli-results-payload-6752
Jul 17, 2026
Merged

feat(api): REST + CLI mirror for loopover_build_results_payload#6904
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
lourincedaging0-commits:feat/rest-cli-results-payload-6752

Conversation

@lourincedaging0-commits

Copy link
Copy Markdown
Contributor

The loopover_build_results_payload MCP tool (src/mcp/server.ts, via the pure buildResultsPayload composer) has neither a REST route nor a CLI mirror — unlike its same-tier sibling loopover_check_slop_risk (/v1/lint/slop-risk + stdio tool), which has both. Both are pure, source-free composers over caller-supplied, already-computed data, so the parity gap is the only difference between them.

Changes

  • POST /v1/loop/results-payload — delegates to the same buildResultsPayload the tool calls and adds no logic of its own. It formats the result; it does not fetch, open, or deliver anything. Placed alongside its source-free /v1/loop/evaluate-escalation and /v1/lint/* siblings.
  • loopover_build_results_payload stdio tool — computed in-process from @loopover/engine, so results composition works fully offline with no API round-trip (same posture as the check_slop_risk local mirror).
  • Both surfaces mirror buildResultsPayloadShape (src/mcp/server.ts) verbatim — same bounds, same optionality — so no surface can accept an input another would reject.

Tests

  • test/unit/routes-results-payload.test.ts — pins the ROUTE contract: the composed payload is returned unmodified for every shape the tool accepts (PR/no-PR, absent vs null prNumber, each status, absent/empty/partial changedFiles, and a change over the diff-preview cap where totals must still count every file), invalid/unparseable bodies are rejected with 400, and no wallet/hotkey/trust-score terms leak.
  • test/unit/mcp-cli-results-payload-tool.test.ts — cross-surface PARITY: the stdio tool returns exactly what the pure composer returns for identical input, proven offline against a black-holed API URL, plus input-schema rejection.
  • Tool-count invariant bumped 67 → 68 in the same commit.

Rebased onto current main (e118f6e9), which includes the terraform/sentry/branding-drift cleanup — the branding-drift regression guard passes on this branch (35 file(s) match the recorded baseline).

Closes #6752

The loopover_build_results_payload MCP tool (src/mcp/server.ts, via the pure
buildResultsPayload composer) had neither a REST route nor a CLI mirror, unlike
its same-tier sibling loopover_check_slop_risk, which has both. Both are pure,
source-free composers over caller-supplied, already-computed data.

Add POST /v1/loop/results-payload, delegating to the same buildResultsPayload the
tool calls and adding no logic of its own, and register the matching in-process
loopover_build_results_payload stdio tool so results composition also works fully
offline. Both surfaces mirror buildResultsPayloadShape verbatim, so no surface can
accept an input another would reject.

Closes JSONbored#6752
@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.70%. Comparing base (e118f6e) to head (b11812c).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6904   +/-   ##
=======================================
  Coverage   93.70%   93.70%           
=======================================
  Files         685      685           
  Lines       68284    68290    +6     
  Branches    18715    18716    +1     
=======================================
+ Hits        63985    63991    +6     
  Misses       3302     3302           
  Partials      997      997           
Flag Coverage Δ
shard-1 43.68% <33.33%> (-0.01%) ⬇️
shard-2 36.85% <33.33%> (+0.06%) ⬆️
shard-3 32.78% <33.33%> (+0.11%) ⬆️
shard-4 34.71% <33.33%> (-0.06%) ⬇️
shard-5 31.91% <33.33%> (+0.73%) ⬆️
shard-6 45.42% <100.00%> (-0.27%) ⬇️

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.73% <100.00%> (+0.01%) ⬆️

@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

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-17 12:03:24 UTC

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

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This PR adds a REST route (POST /v1/loop/results-payload) and a CLI/stdio mirror (loopover_build_results_payload) that both delegate to the existing pure buildResultsPayload composer, following the exact pattern already established for loopover_check_slop_risk. The zod schemas in both new surfaces are verbatim duplicates of each other and are claimed to mirror buildResultsPayloadShape in src/mcp/server.ts (not shown in this diff, so exact parity can't be directly confirmed here, but the pattern matches sibling PRs). Tests cover route contract, cross-surface parity against the pure composer, and the tool-count bump is consistently applied across the alias-invariant test file.

Nits — 5 non-blocking
  • packages/loopover-mcp/bin/loopover-mcp.js:558 and src/api/routes.ts:502 both introduce the magic number 5000 for the changedFiles array cap without a named constant explaining the bound.
  • The resultsPayloadShape/resultsPayloadSchema duplication between loopover-mcp.js and routes.ts (and the claimed third copy in src/mcp/server.ts) is not verifiable in this diff — worth double-checking the three shapes stay in sync since there's no shared import enforcing it.
  • Both changed files are already very large (routes.ts ~3324 lines, loopover-mcp.js ~1525 lines); not a regression introduced by this PR but the pattern of appending route/tool pairs continues to grow single-file size.
  • Consider extracting a shared zod schema (e.g. a small shared module) for buildResultsPayloadShape so the three call sites (server.ts, routes.ts, loopover-mcp.js) can't drift apart silently.
  • Name the 5000 changedFiles cap as a constant (e.g. MAX_CHANGED_FILES) reused across both schemas for self-documentation.

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 #6752
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: 113 registered-repo PR(s), 55 merged, 5 issue(s).
Contributor context ✅ Confirmed Gittensor contributor lourincedaging0-commits; Gittensor profile; 113 PR(s), 5 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: minor
Linked issue satisfaction

Addressed
The PR adds POST /v1/loop/results-payload delegating to buildResultsPayload, a matching loopover_build_results_payload stdio CLI tool with a schema mirroring the MCP tool's, and unit tests covering both surfaces plus a parity check against identical input, fulfilling all stated deliverables.

Review context
  • Author: lourincedaging0-commits
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: HTML
  • Official Gittensor activity: 113 PR(s), 5 issue(s).
  • Related work: Titles/paths share 8 meaningful terms. (issue #6744, issue #6753)
  • Related work: Titles/paths share 8 meaningful terms. (issue #6744, issue #6752)
  • Related work: Titles/paths share 8 meaningful terms. (issue #6747, issue #6753)
  • 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 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.

@loopover-orb
loopover-orb Bot merged commit 7f7ea50 into JSONbored:main Jul 17, 2026
16 checks passed
This was referenced 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

REST + CLI mirror for loopover_build_results_payload

1 participant