fix(public-stats): repoint proof-of-power counter to the live ledger - #1114
Merged
Conversation
The homepage "PRs reviewed" counter was frozen (2,742) because getPublicStats
read review_targets / review_audit — both orphaned by the convergence cutover,
so nothing writes them anymore. Recompute from the LIVE ledger instead:
reviewed = distinct PRs the review system published a review surface for
(audit_events `github_app.pr_public_surface_published`)
disposition = merged / closed-without-merge / still-open-in-review, read from
the pull_requests cache
reversed = review_audit reversal history (accuracy floor; no live source yet)
Read-only, isolated to public-stats.ts — no review-engine code touched, so it
cannot affect reviews. The PublicStatsPayload shape is byte-identical, so the
homepage UI needs no changes; it renders the live numbers (~3,150 reviewed)
within the 60s HTTP cache window. Tests reseeded to the live model
(audit_events + pull_requests); every changed line is covered.
Contributor
|
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 #1114 +/- ##
==========================================
- Coverage 94.90% 94.90% -0.01%
==========================================
Files 154 154
Lines 18623 18617 -6
Branches 6737 6733 -4
==========================================
- Hits 17674 17668 -6
Misses 390 390
Partials 559 559 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The homepage "PRs reviewed" proof-of-power counter is frozen at 2,742 and never moves, even as the queue keeps reviewing PRs.
Root cause:
getPublicStatsreadsreview_targets(dispositions) andreview_audit(reversals). Both were orphaned by the convergence cutover — the live engine now writesaudit_events, and nothing writes those two tables anymore, so the aggregate is stuck at its last pre-cutover value.Fix (read-only, backend-only)
Recompute the same payload from the live ledger:
reviewedaudit_eventswhereevent_type = 'github_app.pr_public_surface_published'(target_key=owner/repo#number)merged/closed/commented=still-open)pull_requestscache (merged_at,state),LEFT JOINed per PRreversedreview_auditreversal history — historical floor for accuracy (no live reversal signal yet)Live numbers today: ~3,150 reviewed (awesome-claude 2,368 + gittensory 473 + metagraphed 312), updating within the 60s HTTP cache window — no rollup/cron.
Safety
src/review/public-stats.ts— zero review-engine files touched, so it cannot affect reviews. All reads are public-safe COUNTs that degrade to 0 viasafeAll.PublicStatsPayloadshape is byte-identical, so the homepage UI (proof-of-power-stats) needs no changes — it was stale purely because of the orphaned source, and now renders live data automatically.GITTENSORY_PUBLIC_STATSexactly as before.Tests
Both
public-statstest files reseeded to the live model (audit_events+pull_requestsinstead ofreview_targets); 11/11 pass and every changed line is covered (codecov/patch).