fix: never drop webhooks and reconcile missed merge XP - #867
Open
ionfwsrijan wants to merge 1 commit into
Open
Conversation
Contributor
|
@ionfwsrijan is attempting to deploy a commit to the codersogs-3057's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Hey @ionfwsrijan You have 4 open PRs right now. The limit is 3 at a time. Please get your existing PRs merged or closed before opening new ones:
This PR will remain open but won't be reviewed until you're under the limit. See our Contributing Guidelines for details. |
Contributor
Author
|
@Soumya-codr @codersogs-code Please review this |
Contributor
Author
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.
Fix: Never Drop Webhooks and Reconcile Missed Merge XP (#862)
Problem
GitHub does not auto-redeliver failed webhook deliveries. The webhook route returned 500 on a DB insert failure and threw on
inngest.sendfailure, permanently losing business-critical events (merged-PR XP, claims). Rate limiting also used one bucket per install, so a burst of one event type could starvepull_requestevents on the same install.Changes
src/app/api/webhooks/github/route.tspush,create,delete,star,ping, …) are acknowledged with a 2xx before rate limiting or persisting, sowebhook_deliveriesonly grows with events the app consumes.install:{id}:{event}), so one burst can't starve business-critical events.inngest.sendfailure no longer throws; the event is dead-lettered tofailed_webhook_eventsand the route acks 2xx — a webhook is never dropped with a 5xx.src/inngest/functions/maintenance.tsreconcileMergedPrXp(daily): for closed PRs merged in the last 7 days on each installation's repos, re-awards merge XP via the idempotenthandleMergewhen noxp_eventsrow exists — recovering lost merge XP.webhookDeliveriesCleanup(daily): pruneswebhook_deliveriesolder than 30 days (GitHub redelivery is only ~3 days, so older rows are pure storage growth).src/inngest/functions/process-pr-event.ts: exportshandleMerge/MergePrShapefor reuse by the reconciler.Impact
Signature-verified webhooks are never dropped with a 5xx; rate-limit misses are honest (429, rare per-event buckets); and lost merge XP from transient failures is recovered daily.
Closes #862