Skip to content

feat(api): REST + CLI mirror for loopover_watch_issues (#6746)#7113

Closed
RealDiligent wants to merge 3 commits into
JSONbored:mainfrom
RealDiligent:feat/watch-issues-rest-cli-6746
Closed

feat(api): REST + CLI mirror for loopover_watch_issues (#6746)#7113
RealDiligent wants to merge 3 commits into
JSONbored:mainfrom
RealDiligent:feat/watch-issues-rest-cli-6746

Conversation

@RealDiligent

Copy link
Copy Markdown
Contributor

Summary

  • Add GET/POST/DELETE /v1/contributors/:login/watches with requireContributorAccess + session canWatchRepo gate, backed by shared issue-watch helpers.
  • Add stdio tool loopover_watch_issues + shell CLI watch-issues list|watch|unwatch (stdio tool count 79 → 80).
  • Cover route/auth/parity, CLI mirrors, OpenAPI, and session self-scoping.

Closes #6746

Test plan

  • Local vitest: routes-watches, mcp-cli-watches, issue-watch, mcp-tool-rename-aliases
  • CI validate-code + Codecov patch ≥99%

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

Copy link
Copy Markdown
Contributor

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

RealDiligent and others added 2 commits July 18, 2026 05:50
Expose issue-watch list/watch/unwatch over /v1/contributors/:login/watches and the watch-issues CLI so subscriptions are not MCP-only.

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 96.49123% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.76%. Comparing base (8e31375) to head (6d878cf).
⚠️ Report is 12 commits behind head on main.

Files with missing lines Patch % Lines
src/api/routes.ts 93.10% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7113   +/-   ##
=======================================
  Coverage   93.75%   93.76%           
=======================================
  Files         692      693    +1     
  Lines       68809    68864   +55     
  Branches    18781    18791   +10     
=======================================
+ Hits        64512    64567   +55     
  Misses       3302     3302           
  Partials      995      995           
Flag Coverage Δ
shard-1 43.76% <15.78%> (-0.03%) ⬇️
shard-2 36.91% <49.12%> (+0.06%) ⬆️
shard-3 33.22% <28.07%> (+0.08%) ⬆️
shard-4 33.88% <89.47%> (-0.60%) ⬇️
shard-5 32.27% <12.28%> (-0.02%) ⬇️
shard-6 45.82% <17.54%> (+0.05%) ⬆️

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

Files with missing lines Coverage Δ
src/mcp/server.ts 96.58% <100.00%> (+0.18%) ⬆️
src/openapi/schemas.ts 100.00% <100.00%> (ø)
src/openapi/spec.ts 99.48% <100.00%> (+<0.01%) ⬆️
src/services/issue-watch.ts 100.00% <100.00%> (ø)
src/api/routes.ts 94.94% <93.10%> (-0.03%) ⬇️

@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

Caution

🛑 LoopOver review result - fixes required

Review updated: 2026-07-17 22:32:21 UTC

14 files · 1 AI reviewer · no blockers · CI failing · unstable

🛑 Suggested Action - Fix Blockers

Review summary
This PR adds a clean REST (GET/POST/DELETE /v1/contributors/:login/watches) and CLI (watch-issues) mirror for the existing loopover_watch_issues MCP tool, extracting the shared logic into src/services/issue-watch.ts so route, tool, and CLI all call the same list/watch/unwatch helpers. The auth wiring correctly layers requireContributorAccess (self-scope) with a session-only canWatchRepo gate mirroring the MCP requireWatchableRepo check, and the mcp/server.ts refactor to call manageContributorWatches preserves the missingRepo early-return behavior. Parity is directly asserted with tests that call both the REST route and the MCP tool and diff the structuredContent, which is the right way to prove a mirror actually mirrors.

Nits — 5 non-blocking
  • packages/loopover-mcp/bin/loopover-mcp.js: `manageWatches`'s final `throw new Error("Unknown watch action")` is unreachable — `watchIssuesCli` only ever calls it with 'list'/'watch'/'unwatch' after validating the subcommand earlier, so this branch is dead defensive code contributing to the codecov/patch shortfall (96.49% vs 99%).
  • test/unit/issue-watch.test.ts only covers the missing-repoFullName case for action='watch'; consider adding the same assertion for action='unwatch' since `manageContributorWatches`'s `input.action === "watch" || input.action === "unwatch"` branch in src/services/issue-watch.ts is otherwise only half-exercised for that guard.
  • packages/loopover-mcp/bin/loopover-mcp.js watchIssuesCli is flagged at ~23 cyclomatic complexity (threshold 10) — consider splitting the list/watch/unwatch branches into separate handler functions the way other CLI subcommands do.
  • src/api/routes.ts:3441-3474 repeats the `requireContributorAccess` → parse → session-gate pattern three times for GET/POST/DELETE; a small shared helper could reduce duplication without changing behavior.
  • Minor grammar: "Watching N repo(s)" in src/services/issue-watch.ts's watchingSummary reads awkwardly for N=1, though this matches the pre-existing convention from the MCP tool being mirrored.

CI checks failing

  • codecov/patch — 96.49% of diff hit (target 99.00%)

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 #6746
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
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: 421 registered-repo PR(s), 212 merged, 36 issue(s).
Contributor context ✅ Confirmed Gittensor contributor RealDiligent; Gittensor profile; 421 PR(s), 36 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Linked issue satisfaction

Addressed
The PR adds GET/POST/DELETE /v1/contributors/:login/watches reusing requireContributorAccess and canWatchRepo (mirroring requireWatchableRepo), adds a shared issue-watch service used by both REST and the refactored MCP tool, and adds a CLI watch-issues list|watch|unwatch mirror plus OpenAPI docs and parity tests between REST and MCP.

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: Python, JavaScript, Ruby, Svelte, TypeScript, Markdown, MDX
  • Official Gittensor activity: 421 PR(s), 36 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Add a concise scope and risk note.
  • Then work through the remaining 1 step 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

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

REST + CLI mirror for loopover_watch_issues

1 participant