feat(orb): record terminal PR outcomes + global merged/closed aggregate - #1310
Merged
Conversation
The central Orb App now captures the raw material for the global "proof of power" homepage counter (das- github-mirror style): a pull_request `closed` webhook records whether the PR merged or closed into a new orb_pr_outcomes table (migration 0067), keyed on (repo, pr_number) so a redelivery or reopen→close cycle overwrites the latest terminal state; recordOrbPrOutcome runs synchronously in the verified receiver alongside the install-registry upsert. getOrbGlobalStats sums merged/closed/total across REGISTERED installations only (registered=1) — an install that hasn't been opted in never contributes to the public counter; the SUM-over-empty nullish guard fails safe to zeros. Backend only — wiring the global aggregate into the public homepage stats is the follow-up. Advances #1255 (the central Orb data layer).
Contributor
|
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 #1310 +/- ##
==========================================
- Coverage 95.16% 95.15% -0.01%
==========================================
Files 181 182 +1
Lines 20217 20227 +10
Branches 7275 7280 +5
==========================================
+ Hits 19240 19248 +8
Misses 386 386
- Partials 591 593 +2
🚀 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.
Summary
The central Orb App now captures the raw material for the global "proof of power" homepage counter (das-github-mirror style — total merged / closed across all registered maintainer repos):
orb_pr_outcomes(migration0067): apull_requestclosed webhook records whether the PR merged (merged_atset) or closed (no merge), keyed on(repo, pr_number)so a redelivery or reopen→close cycle overwrites the latest terminal state.recordOrbPrOutcomeruns synchronously in the verified receiver alongside the install-registry upsert (same fail-to-error+500 → GitHub-redelivers guarantee).getOrbGlobalStats: sumsmerged / closed / totalacross registered installations only (registered = 1) — an install that hasn't been opted in never contributes to the public counter. The SUM-over-empty NULL is nullish-guarded to zeros (fail-safe on a cold table).Backend only — wiring the aggregate into the public homepage stats (
getPublicStats) is the follow-up.Validation
npm run test:cigreen (incl.db:migrations:checkfor0067)outcomes.ts+ thewebhook.tswiring (merged/closed; no-op for non-PR / non-closed / missing pr / missing repo; idempotent re-close; registered-only aggregate excludes an unregistered install; empty-table nullish guard).Advances #1255 (the central Orb data layer).