feat(api): add a REST route + CLI mirror for loopover_simulate_open_pr_pressure#6915
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. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6915 +/- ##
=======================================
Coverage 93.70% 93.70%
=======================================
Files 685 685
Lines 68331 68336 +5
Branches 18723 18724 +1
=======================================
+ Hits 64032 64037 +5
Misses 3302 3302
Partials 997 997
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-17 13:04:39 UTC
Review summary Nits — 4 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed 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.
|
JSONbored#6915 registered loopover_simulate_open_pr_pressure without updating the alias-retirement discovery invariant; merge CI was failing expected 69 got 70. Co-authored-by: Cursor <cursoragent@cursor.com>
* fix(miner): cover four omitted stores in doctor and migrate governor-state, attempt-log, replay-snapshot, and worktree-allocator were only migrated lazily; keep storeIntegrityChecks and migrate STORES in sync at eleven entries. Tests seed the four stores so the worktree-allocator open adapter is covered. Also bump the MCP discovery invariant 69→70 for #6915's loopover_simulate_open_pr_pressure (merge CI pin drift on main). Closes #6768 Co-authored-by: Cursor <cursoragent@cursor.com> * test(miner): type tempEnv as ProcessEnv for replay-snapshot resolve validate-code failed: resolveReplaySnapshotDbPath expects NodeJS.ProcessEnv. Co-authored-by: Cursor <cursoragent@cursor.com> * test(miner): cover only worktree-allocator migrate adapter Avoid ProcessEnv-typed resolve helpers that reject the slim tempEnv object under the repo's strict Env typing; the uncovered patch line is the adapter. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
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