Skip to content

feat(openapi): document GET /v1/repos/:owner/:repo/gate-config/effective - #6687

Merged
JSONbored merged 1 commit into
JSONbored:mainfrom
ultrahighsuper:feat/openapi-gate-config-effective-6611
Jul 16, 2026
Merged

feat(openapi): document GET /v1/repos/:owner/:repo/gate-config/effective#6687
JSONbored merged 1 commit into
JSONbored:mainfrom
ultrahighsuper:feat/openapi-gate-config-effective-6611

Conversation

@ultrahighsuper

Copy link
Copy Markdown
Contributor

What

GET /v1/repos/:owner/:repo/gate-config/effective (src/api/routes.ts) is the direct sibling of live-gate-thresholds — back-to-back handlers sharing the exact same auth (requireStaticProtectedApiToken + the mcp-allowlist check) — but was missing from the OpenAPI contract entirely: no schema, no registerPath, no test assertion. So it never appeared in the generated openapi.json (or apps/loopover-ui/public/openapi.json), even though its live sibling did, leaving API consumers to reverse-engineer it from the route implementation.

Resolves #6611.

Change

  • src/openapi/schemas.ts: add GateConfigEffectiveResponseSchema matching the handler's inline response shape — { repoFullName, effective: { confidenceFloor, scopeCap: { files, lines } }, shadowPending } — with the same .openapi(...) convention as the adjacent LiveGateThresholdsResponseSchema.
  • src/openapi/spec.ts: register the schema and add a registry.registerPath for GET /v1/repos/{owner}/{repo}/gate-config/effective, adjacent to live-gate-thresholds. The handler always returns data (nulls when no override) rather than 404-ing, and returns 401 (bad token) / 403 (not allowlisted) / 200 — so those are the documented statuses.
  • test/unit/openapi.test.ts: .toBeDefined() assertion for the new path, so a future regression is caught by CI.
  • Regenerated apps/loopover-ui/public/openapi.json (ui:openapi:check passes).

Scoped to gate-config/effective only — no other undocumented route is touched.

Locally green: npx vitest run test/unit/openapi.test.ts → 3/3; tsx scripts/write-ui-openapi.ts --check passes; spec.ts coverage 100% lines; eslint clean.

…ive (JSONbored#6611)

`gate-config/effective` (src/api/routes.ts) is the direct sibling of
`live-gate-thresholds` — same auth (requireStaticProtectedApiToken +
mcp-allowlist) — but was missing from the OpenAPI contract entirely (no schema,
no registerPath, no test), so it never appeared in the generated openapi.json or
the frontend copy, even though its live sibling did.

- Add GateConfigEffectiveResponseSchema to src/openapi/schemas.ts matching the
  handler's inline response shape ({ repoFullName, effective: { confidenceFloor,
  scopeCap: { files, lines } }, shadowPending }), with the same
  .openapi("GateConfigEffectiveResponse") convention as the adjacent
  LiveGateThresholdsResponseSchema.
- Register the schema and a registry.registerPath for
  GET /v1/repos/{owner}/{repo}/gate-config/effective in src/openapi/spec.ts,
  adjacent to live-gate-thresholds; the handler returns 200/401/403 (it always
  returns data with nulls rather than 404-ing).
- Add a .toBeDefined() assertion for the new path to test/unit/openapi.test.ts.
- Regenerate apps/loopover-ui/public/openapi.json (ui:openapi:check passes).

Scoped to gate-config/effective only; no other undocumented route is touched.

Closes JSONbored#6611
@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.65%. Comparing base (986a12a) to head (c4f31f0).
⚠️ Report is 12 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6687   +/-   ##
=======================================
  Coverage   93.65%   93.65%           
=======================================
  Files         681      682    +1     
  Lines       68114    68118    +4     
  Branches    18706    18711    +5     
=======================================
+ Hits        63791    63795    +4     
  Misses       3347     3347           
  Partials      976      976           
Flag Coverage Δ
shard-1 43.89% <100.00%> (-0.07%) ⬇️
shard-2 36.97% <33.33%> (+0.10%) ⬆️
shard-3 32.46% <100.00%> (+0.05%) ⬆️
shard-4 34.24% <100.00%> (-0.43%) ⬇️
shard-5 31.38% <33.33%> (+0.46%) ⬆️
shard-6 45.75% <100.00%> (+0.07%) ⬆️

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

Files with missing lines Coverage Δ
src/openapi/schemas.ts 100.00% <100.00%> (ø)
src/openapi/spec.ts 99.44% <100.00%> (+<0.01%) ⬆️

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 16, 2026
@loopover-orb

loopover-orb Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-16 19:21:43 UTC

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

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This adds an OpenAPI schema, path registration, and a contract-test assertion for GET /v1/repos/:owner/:repo/gate-config/effective, mirroring the adjacent live-gate-thresholds documentation pattern. The schema in schemas.ts matches the response shape asserted in the existing integration test (repoFullName, effective.confidenceFloor/scopeCap.files/scopeCap.lines, shadowPending), and the regenerated openapi.json diff is consistent with the schema addition. It's a narrowly-scoped, low-risk documentation fix that closes issue #6611 as claimed.

Nits — 5 non-blocking
  • The test/unit/openapi.test.ts addition only checks `.toBeDefined()` for the path — it doesn't assert the registered schema shape or response codes, so a future accidental schema drift wouldn't be caught by this file (though the integration test in test/integration/api.test.ts does verify the actual response shape).
  • src/openapi/spec.ts: the new GateConfigEffectiveResponseSchema import is inserted out of alphabetical order relative to the surrounding imports (it sits between IssueQualityResponseSchema and LabelAuditSchema, but 'GateConfigEffectiveResponseSchema' should sort before 'InstallationRepairSchema' alphabetically) — minor consistency nit given the file otherwise appears alphabetized.
  • Consider adding a light assertion in test/unit/openapi.test.ts on the response schema's required fields (repoFullName, effective, shadowPending) rather than only path existence, for symmetry with how thorough test/integration/api.test.ts already is.
  • Double check the import ordering in src/openapi/spec.ts:34 against the file's alphabetization convention (if it has ESLint import/order enabled, CI would have already caught this, but worth a manual glance).
  • Code changes lack test evidence — Add focused regression tests or explain why existing coverage is sufficient.

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 #6611
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
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: 120 registered-repo PR(s), 72 merged, 21 issue(s).
Contributor context ✅ Confirmed Gittensor contributor ultrahighsuper; Gittensor profile; 120 PR(s), 21 issue(s).
Improvement ℹ️ None detected risk: low · value: none
Review context
  • Author: ultrahighsuper
  • 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: 120 PR(s), 21 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Add a concise scope and risk note.
  • 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.

Visual preview
Route Viewport Before (production) After (this PR's preview) Diff
/ desktop before /
before /
after /
after /
/ mobile before / (mobile)
before / (mobile)
after / (mobile)
after / (mobile)

Click any thumbnail to open the full-size screenshot. Before = production · After = this PR's preview deploy.

🟩 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 16, 2026
@JSONbored
JSONbored merged commit b650036 into JSONbored:main Jul 16, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. manual-review Gittensor contributor context

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenAPI spec is missing GET /v1/repos/{owner}/{repo}/gate-config/effective (documented sibling: live-gate-thresholds)

2 participants