Skip to content

feat(api): REST + CLI mirror for loopover_pr_outcome (#6747) - #6996

Merged
JSONbored merged 3 commits into
JSONbored:mainfrom
RealDiligent:feat/pr-outcomes-rest-cli-6747-v2
Jul 17, 2026
Merged

feat(api): REST + CLI mirror for loopover_pr_outcome (#6747)#6996
JSONbored merged 3 commits into
JSONbored:mainfrom
RealDiligent:feat/pr-outcomes-rest-cli-6747-v2

Conversation

@RealDiligent

Copy link
Copy Markdown
Contributor

Summary

  • Add GET /v1/contributors/:login/pr-outcomes[?limit=N] with requireContributorAccess, backed by shared buildContributorPrOutcomes.
  • Add stdio tool loopover_pr_outcome + shell CLI pr-outcomes that proxy the new REST route (stdio tool count 77 → 78).
  • Cover route/auth/parity, CLI edge branches, OpenAPI artifact, and session self-scoping.
  • Fix stale mcp-cli-draft-pr-body fixture expectation (gittensoryloopover) that was failing CI.

Closes #6747

Supersedes #6981 (auto-closed after validate-tests flake / openapi stale check).

Test plan

  • Local vitest: routes-pr-outcomes, mcp-cli-pr-outcomes, mcp-cli-draft-pr-body
  • CI validate-code + Codecov patch ≥99%

@RealDiligent
RealDiligent requested a review from JSONbored as a code owner July 17, 2026 17:41
@superagent-security

Copy link
Copy Markdown
Contributor

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

RealDiligent and others added 3 commits July 18, 2026 01:45
Expose post-merge PR outcomes via GET /v1/contributors/:login/pr-outcomes and stdio/shell CLI so contributors are not limited to the host MCP tool.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@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.72%. Comparing base (018e261) to head (631eecc).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6996      +/-   ##
==========================================
+ Coverage   89.25%   93.72%   +4.46%     
==========================================
  Files         688      689       +1     
  Lines       68491    68508      +17     
  Branches    18737    18740       +3     
==========================================
+ Hits        61135    64209    +3074     
+ Misses       5647     3302    -2345     
+ Partials     1709      997     -712     
Flag Coverage Δ
shard-1 43.66% <15.78%> (-0.01%) ⬇️
shard-2 36.87% <42.10%> (-0.01%) ⬇️
shard-3 33.14% <68.42%> (+0.11%) ⬆️
shard-4 33.94% <100.00%> (?)
shard-5 32.10% <10.52%> (-0.01%) ⬇️
shard-6 45.85% <15.78%> (-0.02%) ⬇️

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.86% <100.00%> (+6.48%) ⬆️
src/mcp/server.ts 96.26% <100.00%> (+3.20%) ⬆️
src/openapi/schemas.ts 100.00% <100.00%> (ø)
src/openapi/spec.ts 99.46% <100.00%> (+<0.01%) ⬆️
src/signals/contributor-pr-outcomes.ts 100.00% <100.00%> (ø)

... and 98 files with indirect coverage changes

@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 17:50:27 UTC

14 files · 1 AI reviewer · no blockers · readiness 80/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This PR adds a REST route and CLI/stdio mirror for the existing loopover_pr_outcome MCP tool, refactoring the tool's inline logic into a shared buildContributorPrOutcomes() function used by both the MCP server and the new REST route — good DRY move that also gets covered by a parity test asserting REST/MCP/CLI all return identical payloads. The limit validation (integer, 1-100) is duplicated consistently across route, CLI, and OpenAPI schema, and the stale gittensory→loopover fixture fix is a legitimate unrelated-but-small CI fix called out honestly in the description. Auth uses the same requireContributorAccess self-scoping pattern as the sibling open-pr-monitor route, verified by a 403 cross-login test.

Nits — 5 non-blocking
  • src/api/routes.ts:3339 and packages/loopover-mcp/bin/loopover-mcp.js: the `100`/`1`/`50` limit bounds are duplicated across route, CLI, and OpenAPI spec with no shared constant — fine for now but a future limit change requires touching three places in sync.
  • packages/loopover-mcp/bin/loopover-mcp.js prOutcomesCli mixes login-resolution, limit-parsing, and output-formatting in one function (flagged at ~complexity 15) — consider extracting limit parsing like the route handler nearly duplicates.
  • src/signals/contributor-pr-outcomes.ts: `attribution` is echoed directly from `delivery.body`, which is developer-authored text, not attacker input, so this is safe, but worth a one-line note confirming that assumption holds if the notification body ever becomes influenced by PR titles.
  • Factor the `Number.isInteger(parsed) && parsed >= 1 && parsed <= 100` limit-validation logic (duplicated in src/api/routes.ts, packages/loopover-mcp/bin/loopover-mcp.js, and src/openapi/spec.ts's z.coerce schema) into one shared helper/schema.
  • Consider trimming prOutcomesCli by extracting the `--limit` parsing into its own function, mirroring how limit validation is isolated in the route handler.

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 #6747
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: 402 registered-repo PR(s), 201 merged, 34 issue(s).
Contributor context ✅ Confirmed Gittensor contributor RealDiligent; Gittensor profile; 402 PR(s), 34 issue(s).
Improvement ✅ Minor risk: clean · value: minor
Review context
  • Author: RealDiligent
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: not available
  • Official Gittensor activity: 402 PR(s), 34 issue(s).
  • Related work: Titles/paths share 6 meaningful terms. (issue #6744)
  • Related work: Titles/paths share 6 meaningful terms. (issue #6746)
  • Related work: Titles/paths share 6 meaningful terms. (issue #6980)
  • 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.

Visual preview
Route Viewport Before (production) After (this PR's preview) Diff
/ desktop before /
before /
after /
after /
/ mobile before / (mobile)
before / (mobile)
after / (mobile)
after / (mobile)

Click any thumbnail to open the full-size screenshot. Before = production · After = this PR's preview deploy.

🟩 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 added the manual-review Gittensor contributor context label Jul 17, 2026
@JSONbored
JSONbored merged commit 748acee into JSONbored:main Jul 17, 2026
16 checks passed
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_pr_outcome

2 participants