Skip to content

feat(mcp): add a maintain outcome-calibration CLI mirror#6960

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
jeffrey701:feat-mcp-maintain-outcome-calibration-6735
Jul 17, 2026
Merged

feat(mcp): add a maintain outcome-calibration CLI mirror#6960
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
jeffrey701:feat-mcp-maintain-outcome-calibration-6735

Conversation

@jeffrey701

Copy link
Copy Markdown
Contributor

Closes #6735

Problem

The MCP tool loopover_get_outcome_calibration (src/mcp/server.ts:1926) mirrors the maintainer-gated route GET /v1/repos/:owner/:repo/outcome-calibration (src/api/routes.ts:2795, supports ?windowDays=). No CLI mirror existed even though its sibling gate-telemetry report (maintain precision) already has one.

Fix

Add a maintain outcome-calibration [--window-days N] subcommand to maintainCli, mirroring the maintain precision handler byte-for-byte: it GETs {repoBase}/outcome-calibration (forwarding ?windowDays when positive, else full history — exactly how precision treats the flag), and formats the slop-band merge rates + recommendation-outcome totals for the plain path while --json re-serializes the untouched payload. Also registered in the maintain subcommand routing table (so the PowerShell completer lists it) and documented in printMaintainHelp.

Tests

  • test/unit/mcp-cli-maintain.test.ts adds an outcome-calibration case mirroring the precision one: it asserts the formatted slop-band + recommendation summary (plain), payload parity (--json), and that --window-days 30 is forwarded and reflected as (last 30d).
  • test/unit/support/mcp-cli-harness.ts gains an /v1/repos/owner/repo/outcome-calibration fixture route (additive, mirroring the existing gate-precision fixture) that echoes windowDays.
  • test/unit/mcp-cli-basics.test.ts's PowerShell-completer assertion is updated to include the new subcommand in its committed position.

Validation

  • npx vitest run test/unit/mcp-cli-maintain.test.ts test/unit/mcp-cli-basics.test.ts36/36 pass
  • Full MCP net → zero net-new failures vs the pristine baseline (Windows-only npm-registry/telemetry/file-mode cases only).
  • npm run typecheckclean (0 errors); node --check on the CLI passes.
  • packages/loopover-mcp/** and test/** are outside the Codecov include, so no codecov/patch obligation.
  • Scope: 1 source file + 3 test files (additions only).

@jeffrey701
jeffrey701 requested a review from JSONbored as a code owner July 17, 2026 15:42
@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.71%. Comparing base (27c7c59) to head (ac7f443).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6960   +/-   ##
=======================================
  Coverage   93.71%   93.71%           
=======================================
  Files         685      685           
  Lines       68379    68379           
  Branches    18730    18730           
=======================================
  Hits        64080    64080           
  Misses       3302     3302           
  Partials      997      997           
Flag Coverage Δ
shard-1 43.75% <ø> (ø)
shard-2 36.80% <ø> (+0.01%) ⬆️
shard-3 32.93% <ø> (+0.17%) ⬆️
shard-4 33.85% <ø> (-0.62%) ⬇️
shard-5 32.13% <ø> (-0.04%) ⬇️
shard-6 45.74% <ø> (ø)

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

@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

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-17 15:50:48 UTC

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

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This is a narrow, well-scoped CLI mirror for an existing MCP tool/API route (closing #6735), following the exact pattern of the sibling `maintain precision` command: source, docs, subcommand routing, and PowerShell completer are all updated together, and three test files (unit test, harness fixture, completer assertion) cover the new path including the `--window-days` forwarding and `--json` passthrough. The formatting logic (rate(), window computation, positive/negative/pending line) is a straightforward transcription of the sibling command with no obvious logic errors.

Nits — 5 non-blocking
  • packages/loopover-mcp/bin/loopover-mcp.js: the CLI treats `payload.slop` as a flat array of band objects, while `src/services/outcome-calibration.ts` builds `OutcomeCalibration.slop` as a `SlopOutcomeCalibration` object (`{totalResolved, bands, overallMergeRate, discriminates}`); confirm the actual API route at `src/api/routes.ts:2795` reshapes this to a flat array before it reaches the CLI (the test harness fixture assumes it does), since if it doesn't, `.map` on a non-array would throw at runtime.
  • test/unit/support/mcp-cli-harness.ts: the fixture route only handles the base path and ignores repo/owner variation, matching the existing sibling fixtures' convention — fine, but worth a quick sanity check that no other test hits this same URL prefix with a different owner/repo.
  • packages/loopover-mcp/bin/loopover-mcp.js: the inline comment block above the new handler is fairly long relative to the sibling `precision` handler's comment-free style — could be trimmed for consistency.
  • Double check `src/api/routes.ts:2795`'s actual JSON response shape for `slop` (array vs nested object) against what this CLI code and the harness fixture assume, since that's the one place this review couldn't verify directly.
  • Consider trimming the multi-line comment in the new `outcome-calibration` block down to a single line to match the terser style of the neighboring `precision` 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 #6735
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: 134 registered-repo PR(s), 64 merged, 32 issue(s).
Contributor context ✅ Confirmed Gittensor contributor jeffrey701; Gittensor profile; 134 PR(s), 32 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: minor
Linked issue satisfaction

Addressed
The PR adds a `maintain outcome-calibration [--window-days N]` subcommand mirroring the `precision` pattern, forwards windowDays to the outcome-calibration endpoint, updates printMaintainHelp, registers the subcommand, and includes unit tests plus a fixture route for parity/window-forwarding assertions.

Review context
  • Author: jeffrey701
  • 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: 134 PR(s), 32 issue(s).
  • Related work: Titles/paths share 8 meaningful terms. (issue #6735, issue #6737)
  • Related work: Titles/paths share 8 meaningful terms. (issue #6735, issue #6747)
  • Related work: Titles/paths share 9 meaningful terms. (issue #6735, issue #6734)
  • 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

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 a4310f1 into JSONbored:main Jul 17, 2026
16 checks passed
@github-actions github-actions Bot mentioned this pull request Jul 17, 2026
12 tasks
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.

CLI mirror for loopover_get_outcome_calibration

1 participant