feat(api): add a REST route + CLI mirror for loopover_simulate_open_pr_pressure#6894
feat(api): add a REST route + CLI mirror for loopover_simulate_open_pr_pressure#6894davion-knight wants to merge 1 commit into
Conversation
…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
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Caution 🛑 LoopOver review result - fixes requiredReview updated: 2026-07-17 10:54:21 UTC
Review summary Nits — 1 non-blocking
CI checks failing
Decision drivers
Context & advisory signals — never blocks the verdict
Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk 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.
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.
|
|
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. |
What & why
loopover_simulate_open_pr_pressurehad 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 fromsrc/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 puresimulateOpenPrPressureand adds no logic of its own.That mattered here: the real
queueHealthschema requires a nestedsignalsobject (8 counts +ageBuckets), afindingsarray, 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):
simulateOpenPrPressurelives 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 nestedsignals,findings, and nullablequeueHealth. 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 nullablequeueHealtharm, and 400s for each rejected field plus an unparseable body. CLI: the proxied POST, the null-queueHealtharm, 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 --noEmitclean.Closes #6751