Skip to content

feat(api): add a REST route + CLI mirror for loopover_suggest_boundary_tests#6872

Merged
JSONbored merged 1 commit into
JSONbored:mainfrom
davion-knight:feat-boundary-tests-mirror
Jul 17, 2026
Merged

feat(api): add a REST route + CLI mirror for loopover_suggest_boundary_tests#6872
JSONbored merged 1 commit into
JSONbored:mainfrom
davion-knight:feat-boundary-tests-mirror

Conversation

@davion-knight

Copy link
Copy Markdown
Contributor

What & why

loopover_suggest_boundary_tests had neither a REST route nor a CLI mirror — unlike its same-tier advisory-lint sibling loopover_check_slop_risk, which already has full parity (POST /v1/lint/slop-risk + a stdio tool). Both are deterministic, advisory-only, no-repo-access evaluators over caller-supplied metadata, so the asymmetry was arbitrary.

The route

POST /v1/lint/boundary-tests, beside /v1/lint/slop-risk, reproducing the MCP tool's handler exactly: keep only boundary touches whose path is in the changed set, build the finding, and build the spec only when the finding fired. Reuses buildBoundaryTestGenerationFinding/Spec as-is. Advisory-only — never blocks, never writes, and returns criteria/hints only, never generated test code, so the review/execution boundary stays intact (a test asserts no scaffolded test code crosses it).

Why this CLI mirror proxies (unlike its sibling)

Worth flagging, since it deviates from the two mirrors I shipped before: check_slop_risk computes in-process because buildSlopAssessment is engine-side. Here the builders live app-sidesrc/signals/boundary-test-generation.ts depends on the app's AdvisoryFinding type, and there's no engine copy. Computing locally would mean dragging an app type into @loopover/engine.

So this tool proxies to the route, which stays the single source of truth for the filtering + finding/spec logic. The issue asks for "a CLI subcommand", not an in-process one — this satisfies it without an unrequested engine cascade.

Schema parity

Both new schemas mirror the tool's suggestBoundaryTestsShape verbatim — same bounds, same .strict() objects, same optionality, including accepting an empty changedFiles exactly as the tool does. (Read from server.ts, not inferred — the lesson from #6807.)

Tests

Route: the handler's filtering (an out-of-diff touch is dropped → no gap), the finding/spec pairing, the no-gap cases (test evidence present via testFiles or free-text tests; no touches at all), schema parity, and 400s including a malformed body. CLI: the proxied POST, and that zod rejects bad input before any API call.

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

Closes #6750

…y_tests

loopover_suggest_boundary_tests had neither a REST route nor a CLI mirror, unlike its same-tier
advisory-lint sibling loopover_check_slop_risk, which already has full parity (POST /v1/lint/slop-risk
+ a stdio tool). Both are deterministic, advisory-only, no-repo-access evaluators over caller-supplied
metadata, so the asymmetry was arbitrary.

Adds POST /v1/lint/boundary-tests beside /v1/lint/slop-risk, reproducing the MCP tool's handler
exactly: keep only boundary touches whose path is in the changed set, build the finding, and build the
spec only when the finding fired. It reuses buildBoundaryTestGenerationFinding/Spec as-is. Advisory
only -- never blocks, never writes, and returns criteria/hints only, never generated test code, so the
review/execution boundary stays intact.

Adds the loopover_suggest_boundary_tests stdio tool. Unlike the check_slop_risk sibling this one
PROXIES to the route rather than computing in-process: the builders live app-side
(src/signals/boundary-test-generation.ts depends on the app's AdvisoryFinding type), not in
@loopover/engine, so extracting them to compute locally would drag an app type into the engine. The
route therefore stays the single source of truth for the filtering + finding/spec logic.

Both new input schemas mirror the MCP tool's suggestBoundaryTestsShape VERBATIM -- same bounds, same
.strict() objects, same optionality -- so no surface can accept an input another would reject
(including an empty changedFiles, which the tool accepts).

Route tests pin the handler's filtering (an out-of-diff touch is dropped), the finding/spec pairing,
the no-gap cases (test evidence present, no touches), schema parity, and 400s. The CLI test asserts
the proxied POST and that zod rejects bad input before any API call. 100% line and branch coverage on
the new route lines.

Closes JSONbored#6750
@davion-knight
davion-knight requested a review from JSONbored as a code owner July 17, 2026 09:40
@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.70%. Comparing base (4328d08) to head (4d5212e).
⚠️ Report is 11 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6872   +/-   ##
=======================================
  Coverage   93.70%   93.70%           
=======================================
  Files         685      685           
  Lines       68247    68256    +9     
  Branches    18707    18709    +2     
=======================================
+ Hits        63948    63957    +9     
  Misses       3302     3302           
  Partials      997      997           
Flag Coverage Δ
shard-1 43.63% <22.22%> (-0.06%) ⬇️
shard-2 36.92% <22.22%> (+0.12%) ⬆️
shard-3 32.68% <100.00%> (+0.02%) ⬆️
shard-4 34.75% <22.22%> (-0.01%) ⬇️
shard-5 31.15% <22.22%> (-0.01%) ⬇️
shard-6 45.71% <22.22%> (+0.01%) ⬆️

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

Files with missing lines Coverage Δ
src/api/routes.ts 94.72% <100.00%> (+0.02%) ⬆️

@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 09:58:28 UTC

6 files · 1 AI reviewer · no blockers · readiness 82/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This PR adds POST /v1/lint/boundary-tests as a REST route mirroring the loopover_suggest_boundary_tests MCP tool's handler logic exactly (filter touches to changed paths, build finding, conditionally build spec), plus a CLI stdio tool that proxies to that route since the underlying builders are app-side and depend on an app-only AdvisoryFinding type. The schema is copy-verbatim from suggestBoundaryTestsShape in src/mcp/server.ts (confirmed identical against the provided reference excerpt), and the tool-count assertion bump from 66 to 67 correctly reflects the new tool registration. Tests cover route filtering/pairing/400s and CLI proxying/rejection-before-API-call, matching the pattern already established for the check_slop_risk and check_test_evidence mirrors.

Nits — 4 non-blocking
  • The magic-number bounds (400, 500, 20, 2000) in both routes.ts:504-517 and loopover-mcp.js:557-563 are copy-pasted duplicates of the MCP shape rather than a shared constant/import, so a future bound change requires updating three places in sync (this matches the existing pattern for slop-risk/test-evidence mirrors, so it's consistent with prior art, not a regression).
  • test/unit/routes-boundary-tests.test.ts calls post(env, body) twice in the first test case (once for the .toEqual check, once for the payload check) — functionally fine since the route is pure/stateless, but it's a redundant duplicate call that could be simplified to reuse the first response.
  • Consider extracting the shared boundary-touch schema (routes.ts:504-517 and loopover-mcp.js:557-563) into a single exported shape both files import, the way other duplicated schemas in this codebase might already be centralized, to reduce the three-way drift risk noted in the linked issue's own 'feat(api): add a REST route + CLI mirror for loopover_check_test_evidence #6807 lesson' comment.
  • The PR description says the issue is REST + CLI mirror for loopover_suggest_boundary_tests #6750 but references 'Boundary-safe test generation #1972' in the boundaryTouches comment in src/mcp/server.ts — worth double-checking these are the same tracked issue to avoid confusing future readers.

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 #6750
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 · LLM: moderate
Linked issue satisfaction

Addressed
The PR adds POST /v1/lint/boundary-tests reproducing the tool's exact filtering/finding/spec logic, a CLI stdio mirror that proxies to the route, and unit tests covering route behavior, schema parity, and CLI proxy behavior including a check that no scaffolded test code crosses the boundary.

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: Rust
  • Official Gittensor activity: 188 PR(s), 0 issue(s).
  • Related work: Titles/paths share 8 meaningful terms. (issue #6744, issue #6750)
  • Related work: Titles/paths share 8 meaningful terms. (issue #6747, issue #6750)
  • Related work: Titles/paths share 8 meaningful terms. (issue #6746, issue #6750)
  • 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 added the manual-review Gittensor contributor context label Jul 17, 2026
@JSONbored
JSONbored merged commit 80869bd into JSONbored:main Jul 17, 2026
16 checks passed
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. manual-review Gittensor contributor context

Projects

None yet

Development

Successfully merging this pull request may close these issues.

REST + CLI mirror for loopover_suggest_boundary_tests

2 participants