Skip to content

feat(orb): record terminal PR outcomes + global merged/closed aggregate - #1310

Merged
JSONbored merged 1 commit into
mainfrom
feat/orb-pr-outcomes
Jun 25, 2026
Merged

feat(orb): record terminal PR outcomes + global merged/closed aggregate#1310
JSONbored merged 1 commit into
mainfrom
feat/orb-pr-outcomes

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

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 (migration 0067): a pull_request closed webhook records whether the PR merged (merged_at set) or closed (no merge), 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 (same fail-to-error+500 → GitHub-redelivers guarantee).
  • 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 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:ci green (incl. db:migrations:check for 0067)
  • 100% branch coverage on outcomes.ts + the webhook.ts wiring (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).

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).
@dosubot dosubot Bot added the size:M label Jun 25, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.15%. Comparing base (facbec2) to head (5291de3).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/orb/outcomes.ts 77.77% 0 Missing and 2 partials ⚠️
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     
Files with missing lines Coverage Δ
src/orb/webhook.ts 100.00% <100.00%> (ø)
src/orb/outcomes.ts 77.77% <77.77%> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JSONbored
JSONbored merged commit b5c1655 into main Jun 25, 2026
18 of 19 checks passed
@JSONbored
JSONbored deleted the feat/orb-pr-outcomes branch June 25, 2026 04:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant