feat(api): expose self-tune override audit and clear routes (#6168) - #6215
Conversation
…d#6168) Add operator-facing routes backing the built-but-unrouted self-tune override admin functions: - GET /v1/repos/:owner/:repo/selftune/overrides/audit -> listOverrideAudit - DELETE /v1/repos/:owner/:repo/selftune/overrides -> deleteLiveOverride, with an optional confirmation body validated via sanitizeOverridePayload Both are maintainer-scoped (requireRepoMaintainer, mirroring gate-precision) and allowlisted so a browser maintainer session reaches the handler. The automatic promote path and the write helpers are untouched. Closes JSONbored#6168
|
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 #6215 +/- ##
=======================================
Coverage 95.32% 95.32%
=======================================
Files 596 596
Lines 47090 47109 +19
Branches 15010 15015 +5
=======================================
+ Hits 44888 44907 +19
Misses 1477 1477
Partials 725 725
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-15 22:34:50 UTC
✅ Suggested Action - Approve/Merge
Review summary Nits — 4 non-blocking
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://gittensory.aethereal.dev/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.
|
Summary
src/review/auto-apply.tsfully implements and unit-testslistOverrideAudit,deleteLiveOverride, andsanitizeOverridePayload, but none of them is reachable — no routein
src/api/routes.tsexposes override management, so a self-host operator running theLOOPOVER_REVIEW_SELFTUNEloop had no way to inspect the override audit trail or clear a liveoverride short of direct D1 access.
This adds the missing operator-facing read/delete surface:
GET /v1/repos/:owner/:repo/selftune/overrides/audit→listOverrideAudit(newest-firsttrail; optional
?limit=).DELETE /v1/repos/:owner/:repo/selftune/overrides→deleteLiveOverride. An optional JSONbody is treated as a confirmation of the override being cleared and is validated through
sanitizeOverridePayload— a malformed payload is rejected400rather than silently ignored.The live override is a per-project singleton (
tunables_overridesis keyed by project), so theclear targets the repo directly rather than an invented
:idsub-resource.Both routes are maintainer-scoped via
requireRepoMaintainer(the same gate thegate-precisionroute uses) and added to the session path allowlist so a browser maintainer reaches the handler,
where per-repo authority is enforced.
writeLiveOverride/writeShadowOverride/recordOverrideAuditand the automatic promote path are untouched.
Scope
type(scope): short summaryConventional Commit format, for examplefix(api): restore profile access checks.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Closes #123) — a linked open issue is required for every contributor PR.Validation
git diff --checknpm run typechecknpm run test:coveragelocally;codecov/patchrequires ≥99% coverage of the lines AND branches you changed — verified every added line and branch insrc/api/routes.tsis covered (audit read with/without?limit, delete with empty/valid/invalid body, and the 401/403 rejection paths).npm run ui:openapi:check(these operator routes are intentionally not in the curated public spec, matchinggate-precision/maintainer-noise; check stays green)If any required check was skipped, explain why:
Safety
Notes
Closes #6168