Skip to content

feat(api): add a REST route + CLI mirror for loopover_simulate_open_pr_pressure#6894

Closed
davion-knight wants to merge 1 commit into
JSONbored:mainfrom
davion-knight:feat-open-pr-pressure-mirror
Closed

feat(api): add a REST route + CLI mirror for loopover_simulate_open_pr_pressure#6894
davion-knight wants to merge 1 commit into
JSONbored:mainfrom
davion-knight:feat-open-pr-pressure-mirror

Conversation

@davion-knight

Copy link
Copy Markdown
Contributor

What & why

loopover_simulate_open_pr_pressure had neither a REST route nor a CLI mirror, though it's deterministic, public-safe, and read-only (no repo access, no GitHub writes) — the same tier as the lint routes that already have full parity.

One schema, not two

Rather than hand-copying the tool's input contract, the route parses with the tool's own simulateOpenPrPressureShape, now exported from src/mcp/server.ts (a one-word change). The two surfaces cannot diverge on accepted input, because there is only one schema. The route then delegates to the same pure simulateOpenPrPressure and adds no logic of its own.

That mattered here: the real queueHealth schema requires a nested signals object (8 counts + ageBuckets), a findings array, and is .nullable(). A hand-copy written from the issue text would have quietly diverged — exactly the failure mode that cost #6807.

Why this CLI mirror proxies

Consistent with the boundary-tests mirror (#6750): simulateOpenPrPressure lives app-side (src/services/open-pr-pressure-scenarios.ts), not in @loopover/engine, so the tool proxies to the route rather than computing in-process. The route stays the single source of truth for the ranking.

The bin can't import from src/ (package boundary), so its zod shape is the one hand-mirrored copy — reproduced verbatim including the nested signals, findings, and nullable queueHealth. Its tests pin that mirror directly: the fields the real schema requires are enforced in the tool rather than waved through to a route 400.

Tests

Route: output parity with the pure simulator across every queue-health level × both role lanes, the optional contributorOpenPrCount, the nullable queueHealth arm, and 400s for each rejected field plus an unparseable body. CLI: the proxied POST, the null-queueHealth arm, and that zod rejects bad input before any API call.

100% line and branch coverage on every changed line, measured against the changed-line set. tsc --noEmit clean.

Closes #6751

…r_pressure

loopover_simulate_open_pr_pressure had neither a REST route nor a CLI mirror, though it is
deterministic, public-safe, and read-only -- no repo access, no GitHub writes -- the same tier as the
lint routes that already have full REST/CLI parity.

Adds POST /v1/lint/open-pr-pressure beside them. Rather than hand-copying the tool's input contract,
the route parses with the tool's OWN simulateOpenPrPressureShape, now exported from src/mcp/server.ts
(a one-word change): the two surfaces cannot diverge on accepted input because there is only one
schema. It then delegates to the same pure simulateOpenPrPressure and adds no logic of its own.

Adds the loopover_simulate_open_pr_pressure stdio tool. Like the boundary-tests mirror it PROXIES to
the route rather than computing in-process: simulateOpenPrPressure lives app-side in
src/services/open-pr-pressure-scenarios.ts, not in @loopover/engine. The bin cannot import from src/
(package boundary), so its zod shape is the one hand-mirrored copy here -- reproduced VERBATIM,
including the nested signals object, findings, and the nullable queueHealth -- and its own tests pin
that the fields the real schema requires are enforced there too rather than waved through to a 400.

Route tests assert output parity with the pure simulator across every queue-health level and both role
lanes, the optional contributorOpenPrCount, the nullable queueHealth arm, and 400s for each rejected
field plus an unparseable body. The CLI test asserts the proxied POST, the null-queueHealth arm, and
that zod rejects bad input before any API call. 100% line and branch coverage on every changed line.

Closes JSONbored#6751
@davion-knight
davion-knight requested a review from JSONbored as a code owner July 17, 2026 10:40
@superagent-security

Copy link
Copy Markdown
Contributor

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

@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 10:54:21 UTC

7 files · no blockers · CI failing · blocked

🛑 Suggested Action - Fix Blockers

  • AI review already in progress for this PR head: Another LoopOver pass is already running the AI review for this exact PR head. This pass is skipping to avoid a duplicate LLM call.

Review summary
AI review is already running for this PR head in another LoopOver pass. LoopOver is holding this PR for manual review until that pass completes.

Nits — 1 non-blocking
  • AI review already in progress for this PR head — The gate is held for a human reviewer rather than passed automatically; it re-evaluates once the in-flight review completes or on the next update.

CI checks failing

  • validate
  • validate-tests (1)
  • validate-tests (4)

Decision drivers

  • ✅ Code review — No blockers (No AI review summary)
  • ⚠️ Gate result — Not blocking (Advisory; not blocking this PR.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #6751
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: 188 registered-repo PR(s), 118 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor davion-knight; Gittensor profile; 188 PR(s), 0 issue(s).
Improvement ✅ Minor risk: clean · value: minor
Review context
  • Author: davion-knight
  • 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: 188 PR(s), 0 issue(s).
  • Related work: Titles/paths share 8 meaningful terms. (issue #6744, issue #6751)
  • Related work: Titles/paths share 8 meaningful terms. (issue #6747, issue #6751)
  • Related work: Titles/paths share 8 meaningful terms. (issue #6746, issue #6751)
  • 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 <question> answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat <question> 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 commented Jul 17, 2026

Copy link
Copy Markdown

LoopOver is closing this pull request on the maintainer's behalf (CI is failing (validate, validate-tests (1), 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_simulate_open_pr_pressure

1 participant