feat(telemetry): gate false-positive measurement loop (#554) - #828
Conversation
Record each gate BLOCK and let a maintainer compute a per-gate-type false-positive rate (blocked-then-merged / blocked) — the evidence needed before promoting a gate from advisory to block. MEASUREMENT only, mirroring the #543 outcome-learning loop: it never auto-adjusts a gate. - New gate_outcomes ledger (migration 0041): one latest block row per (repo, PR), upserted at the gate-failure finalize site (best-effort, a write failure never aborts finalization). Privacy: repo + PR number + blocker codes + timestamps ONLY — no actor logins, no trust/reward fields. A maintainer override (#538) flags the row (overridden), the strongest false-positive signal. - gate-precision service (mirrors outcome-calibration): a blocked PR that later MERGED is a false positive; per gate type reports blocked / blocked-then-merged / overridden / rate (null below a 5-block sample), plus actionable signals. Pure builder + env-bound loader. - Surfaced read-only at GET /v1/repos/:owner/:repo/gate-precision, the same requireRepoMaintainer auth + canSessionAccessPath allowlist as /outcome-calibration. No public route. - A privacy-safe gate_blocked product-usage event is also emitted.
|
Note Gittensory Gate skippedPR closed before full evaluation. No late first comment was created.
💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers. |
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #828 +/- ##
=======================================
Coverage 96.55% 96.56%
=======================================
Files 97 98 +1
Lines 14091 14175 +84
Branches 5141 5169 +28
=======================================
+ Hits 13606 13688 +82
Misses 105 105
- Partials 380 382 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
gittensory · advisory review Reviewed 9 changed file(s) — two independent AI reviewers. Changed files (9)
Suggested action: ✅ Safe to merge — both reviewers found no blocking issues. Reviewer A · Suggestions
Worth double-checking
Reviewer B · Suggestions
Worth double-checking
|
…s for the 97% patch gate The #554 patch missed coverage on the new /gate-precision route handler, the listGateOutcomes windowDays branch, the gate_outcomes schema $defaultFn arrows, and the repoFullName-scoping branch. Add an integration test for the route (authed + windowDays + no-window), a pure buildGatePrecisionReport scoping test, and let recordGateBlockOutcome rely on the schema $defaultFn for blockedAt/updatedAt (covers the arrows + drops a redundant nowIso).
…ng nullish guard Clears the remaining repositories.ts and gate-precision.ts branch partials flagged by the 97% patch gate: listGateOutcomes with windowDays/now/limit and an unscoped (no-repo) listing, and a null-repoFullName PR exercising sameRepo's nullish-coalesce.
Closes #554.
What
Maintainers won't move a gate from advisory to block without evidence it's precise. This records each gate block and computes a per-gate-type false-positive rate (
blocked-then-merged / blocked) — the evidence to promote (or hold back) a gate. MEASUREMENT only, mirroring the existing #543 outcome-learning loop: it never auto-adjusts a gate or score.How (mirrors #543's ledger + outcome-calibration service)
gate_outcomesledger (migration 0041): one latest block row per(repo, PR), upserted at the gate-failure finalize site inprocessors.ts. Best-effort — a write failure never aborts gate finalization (same pattern as the slop-assessment persist). Privacy: repo + PR number + blocker codes + timestamps only — no actor logins, no trust/reward fields.overridden(a human explicitly judged the block wrong).gate-precisionservice: a blocked PR that later merged is a false positive. Per gate type →blocked/blockedThenMerged/overridden/falsePositiveRate(null below a 5-block sample so a 1-of-1 isn't reported as noise), plus human-readablesignals("keep it advisory until this drops"). Pure builder + env-bound loader, same split asoutcome-calibration.GET /v1/repos/:owner/:repo/gate-precision, the samerequireRepoMaintainerauth +canSessionAccessPathallowlist as/outcome-calibration. No public route. A privacy-safegate_blockedproduct-usage event is also emitted.Acceptance criterion met
A blocked-then-merged PR increments the false-positive count (per gate type and overall); the rate is queryable per gate mode via the maintainer-authenticated endpoint.
Tests
gate-precision.test.ts(12 cases): blocked-then-merged increments the count, per-gate-type attribution (a multi-code block counts toward each), the MIN_SAMPLE null guard, overridden tracking, and a privacy assertion that the report carries no actor/PII fields. Plus repository upsert/override/list coverage.Verification
migration guard (0001..0041, no dup) · typecheck clean · full suite 1993 passed, 1 skipped (only the pre-existing pngjs visual-agent skip) · openapi drift-clean (spec is hand-curated; the sibling /outcome-calibration route isn't in it either).
Relates #525/#528 (Phase 1), #543 (outcome-learning loop), #538 (gate override = the override signal).