fix: acknowledge GitHub ping events on the git webhook route - #932
Conversation
A ping event, sent automatically right after a webhook is created, has neither a push nor a release payload shape. It fell through to the push parser and was rejected as malformed, so every new git source's first delivery showed a 400 in GitHub's own UI. Observed live on console.levelrail.com after connecting a real repo.
|
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe webhook handler now recognizes GitHub ping events from the ChangesGitHub ping webhook handling
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~8 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to GitHub setup pings receive the intended acknowledgment without triggering a deployment. No merge-blocking risk is established by the supplied change context. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The acknowledgment remains behind authentication and cannot trigger a deployment. No introduced security issue was established, but incomplete coverage and unknown ingress behavior limit confidence in a minimal-risk assessment. Retained concerns Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |



Summary
github-app use-as-sourceauto-registers a GitHub webhook, which immediately fires a "ping" event. That event has neither a push nor a release payload shape, so it fell through to the push parser and came back as "malformed payload" (400).gh api repos/<owner>/<repo>/hooksshowedlast_response: {"code":400}for the hook right after creation, even though the very next real push delivered and deployed correctly (so this never blocked a real deploy, just made every new connection's first delivery look broken in GitHub's own UI and inapps webhook-deliveries list).X-GitHub-Event: pingto a 200 ack before it reacheswebhook.ParsePushEventForProvider, the same pattern already used formerge_groupandrelease.Test plan
TestHandleGitPushWebhook_GitHubPing_Returns200, confirmed it fails on pre-fix code (400 "malformed payload") and passes after the fixgo build ./...,go vet ./internal/api/...cleangolangci-lint run ./internal/api/...: 0 issuesgo test ./internal/api/...: full package passDoes not fix: GitLab/Bitbucket/Gitea have no equivalent "ping" event wired up because none of their webhook UIs show a scary status for one (out of scope here).
Summary by CodeRabbit