Skip to content

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

Closed
RealDiligent wants to merge 2 commits into
JSONbored:mainfrom
RealDiligent:feat/pr-outcomes-rest-cli-6747
Closed

feat(api): REST + CLI mirror for loopover_pr_outcome (#6747)#6981
RealDiligent wants to merge 2 commits into
JSONbored:mainfrom
RealDiligent:feat/pr-outcomes-rest-cli-6747

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 mirror parity, OpenAPI, and session self-scoping.

Closes #6747

Test plan

  • vitest routes-pr-outcomes, mcp-cli-pr-outcomes, mcp-tool-rename-aliases
  • CI validate-code + Codecov patch ≥99%

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

Copy link
Copy Markdown
Contributor

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

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

❌ Patch coverage is 73.68421% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.31%. Comparing base (d6e7404) to head (bf6db57).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/api/routes.ts 54.54% 4 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6981      +/-   ##
==========================================
+ Coverage   89.24%   89.31%   +0.06%     
==========================================
  Files         687      688       +1     
  Lines       68422    68439      +17     
  Branches    18737    18740       +3     
==========================================
+ Hits        61066    61123      +57     
+ Misses       5647     5606      -41     
- Partials     1709     1710       +1     
Flag Coverage Δ
shard-1 43.73% <15.78%> (-0.01%) ⬇️
shard-2 36.92% <42.10%> (-0.01%) ⬇️
shard-3 33.18% <68.42%> (+0.11%) ⬆️
shard-5 32.15% <10.52%> (-0.01%) ⬇️
shard-6 45.77% <15.78%> (+0.01%) ⬆️

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

Files with missing lines Coverage Δ
src/mcp/server.ts 93.05% <100.00%> (-0.01%) ⬇️
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%> (ø)
src/api/routes.ts 88.22% <54.54%> (-0.17%) ⬇️

... and 1 file 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

Caution

🛑 LoopOver review result - fixes required

Review updated: 2026-07-17 17:38:54 UTC

13 files · 1 AI reviewer · no blockers · CI failing · blocked

🛑 Suggested Action - Fix Blockers

Review summary
This PR extracts the existing `loopover_pr_outcome` MCP tool's logic into a shared `buildContributorPrOutcomes` function, adds a REST route that reuses it, and mirrors it as a CLI/stdio tool — following the exact established pattern used for `monitor-open-prs` and prior mirrors. The refactor of `src/mcp/server.ts` correctly delegates to the new shared builder rather than duplicating logic, and the parity test in `test/unit/routes-pr-outcomes.test.ts` verifies REST, MCP, and the shared builder all produce identical output for the same login. The limit validation is duplicated (once in `src/api/routes.ts`, once in the CLI) but is otherwise correct and bounded (1-100), and auth/self-scoping is covered by the added `routes-errors.test.ts` case.

Nits — 5 non-blocking
  • Patch coverage is 73.68% against a 99% target (CI: codecov/patch failed) — likely the CLI plain-text output path (`prOutcomesCli` heading/attribution printing) and some error branches aren't exercised.
  • packages/loopover-mcp/bin/loopover-mcp.js: the limit-parsing logic in `prOutcomesCli` duplicates the same validation done server-side in src/api/routes.ts — consider extracting a shared helper if this pattern recurs again.
  • The magic numbers 50 (default limit) and 100 (max limit) in src/signals/contributor-pr-outcomes.ts and src/api/routes.ts are unexplained inline literals; a named constant would make the contract clearer across the three places it's repeated (schema, route, builder).
  • Add or confirm a CLI test that exercises the out-of-range limit and no-login failure paths already written in mcp-cli-pr-outcomes.test.ts contribute to patch coverage — if they already run, check why codecov/patch still reports 73.68%.
  • Consider a shared `parsePrOutcomesLimit` helper reused between src/api/routes.ts and the CLI to avoid the two near-identical integer/range checks drifting apart later.

CI checks failing

  • codecov/patch — 73.68% of diff hit (target 99.00%)
  • validate
  • validate-tests (4)

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 · LLM: minor
Linked issue satisfaction

Addressed
The PR adds the GET /v1/contributors/:login/pr-outcomes route with requireContributorAccess reusing listNotificationDeliveriesForRecipient via a shared buildContributorPrOutcomes, adds a CLI/stdio mirror (pr-outcomes command and loopover_pr_outcome tool), and includes unit tests covering the route, CLI, and REST/CLI/MCP parity as required.

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 8 meaningful terms. (issue #6744, issue #6747)
  • Related work: Titles/paths share 8 meaningful terms. (issue #6744, issue #6746)
  • Related work: Titles/paths share 8 meaningful terms. (issue #6744, 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 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

LoopOver is closing this pull request on the maintainer's behalf (CI is failing (codecov/patch, validate, validate-tests (4))). 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_pr_outcome

1 participant