feat(api): surface computeRuleGateEval's per-(project, ruleCode) rows - #8929
feat(api): surface computeRuleGateEval's per-(project, ruleCode) rows#8929hurryup52 wants to merge 1 commit into
Conversation
computeRuleGateEval (rule-gate-eval.ts) is the finer-grained "which rule is broken on which repo" sibling of computeBlendedRuleGateEval, but had zero consumers outside its own unit test — the blended, pooled-across- projects view is the only one wired into the auto-tune breaker cache (outcomes-wire.ts) and the operator-dashboard tile. Add GET /v1/internal/rule-gate-eval, mirroring the existing unflagged /v1/internal/fleet/analytics route (bearer-gated by the shared /v1/internal/* middleware, ?days= window defaulting to 90). ruleCode carries no privacy concern (unlike a contributor login), so unlike the fairness/contributors detail-route-plus-summary-tile split, this returns the full per-project report directly. Test seeds two different projects sharing the same ruleCode via real review_audit gate_decision/pr_outcome pairs and asserts the response contains two distinct per-project rows (not one pooled row), plus the ?days= default/override and 401-without-token cases. Closes JSONbored#8906
|
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 #8929 +/- ##
==========================================
- Coverage 93.84% 91.01% -2.84%
==========================================
Files 803 97 -706
Lines 80084 24932 -55152
Branches 24277 4672 -19605
==========================================
- Hits 75157 22692 -52465
+ Misses 3562 1975 -1587
+ Partials 1365 265 -1100
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Caution 🛑 LoopOver review result - reject/close recommendedReview updated: 2026-07-26 13:50:24 UTC
Review summary Nits — 3 non-blocking
Why this is blocked
📋 Copy for AI agents — paste into your coding agentDecision 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. Decision record
🟩 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 (No linked issue detected). 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. |
Summary
computeRuleGateEval(src/review/rule-gate-eval.ts) is the finer-grained "which rule is broken on which repo" sibling ofcomputeBlendedRuleGateEval, but had zero consumers outside its own unit test. AddsGET /v1/internal/rule-gate-evalso an operator can actually reach the per-(project, ruleCode) breakdown.Scope
type(scope): short summaryConventional Commit format.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Closes #8906.Validation
git diff --checknpm run actionlint— not run (no workflow files touched).npm run typecheck— clean.npm run test:coveragelocally — ran the full suite; see notes below.npm run test:workers/npm run build:mcp/npm run test:mcp-pack/npm run ui:openapi:check/npm run ui:lint/npm run ui:typecheck/npm run ui:build— not run; this change touches onlysrc/api/routes.ts(a backend route) and a backend integration test, no UI/worker/MCP/OpenAPI-spec surface (confirmed no/v1/internal/*route appears insrc/openapi/spec.ts— internal routes aren't documented there, matching the existing sibling routes this PR mirrors).npm audit --audit-level=moderate— no new dependencies added.?days=present/absent, per-project vs. pooled response shape, 401 without the bearer token).If any required check was skipped, explain why:
src/api/routes.ts(new route only) +test/integration/api.test.ts(new tests only) — no UI, Worker entrypoint, MCP package, or OpenAPI spec files changed.Safety
ruleCodeis not sensitive — unlike a contributor login, which is why the fairness/contributors routes need a detail+summary split and this doesn't.)/v1/internal/*middleware; no new auth logic was written).UI Evidence
N/A — backend-only change, no UI surface touched.
Notes
operator-dashboard.tsonly ever surfaces a derived count (rulesBelowClosePrecisionFloor(...).length), never raw rows — matching that literally would not satisfy the issue's stated goal ("operator can see which specific rule is broken on which specific repo"), since a count alone doesn't identify project/rule pairs.rule-gate-eval.ts's own module header says it "mirrors contributor-gate-eval.ts EXACTLY" — and that sibling module's finer-grained view is already exposed via a dedicated route (/v1/internal/fairness/contributors/:login) rather than a dashboard field, precisely because raw per-entity rows need their own reachable endpoint. SinceruleCode(unlike a contributor login) carries no privacy concern, the closer and simpler precedent is the unflaggedGET /v1/internal/fleet/analytics(single route,?days=, no detail/summary split) — that's what this PR mirrors.