Fix #162: Implement automatic webhook secret refresh#178
Open
snagasuri wants to merge 2 commits intocalcom:mainfrom
Open
Fix #162: Implement automatic webhook secret refresh#178snagasuri wants to merge 2 commits intocalcom:mainfrom
snagasuri wants to merge 2 commits intocalcom:mainfrom
Conversation
This commit addresses the bug where SyncLinear infinitely recreates issues after renaming them with Linear IDs. The fix includes: 1. Database constraints: Added unique constraints to prevent duplicate syncedIssue entries for the same Linear/GitHub issue pairs 2. Webhook deduplication: Track processed webhook events using Linear-Delivery and X-GitHub-Delivery headers to prevent reprocessing 3. Transaction safety: Implement atomic operations for issue creation to prevent race conditions when multiple webhooks arrive simultaneously The root cause was a race condition where multiple webhook events could check for existing issues simultaneously, all find none, and proceed to create duplicates before any were recorded in the database. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add webhookSecretCreatedAt and webhookSecretExpiresAt fields to GitHubRepo model - Create refreshWebhookSecret utility to update secrets in both DB and GitHub - Update webhook handler to auto-refresh expired secrets on 403 errors - Add manual refresh endpoint at /api/github/refresh-webhook-secret - Update GitHubAuthButton to set expiration dates when creating webhooks - Webhook secrets now expire after 30 days and refresh automatically - Add comprehensive test file demonstrating the functionality
|
@snagasuri is attempting to deploy a commit to the Rubric Labs Team on Vercel. A member of the Team first needs to authorize it. |
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
This PR addresses issue #162 by implementing automatic webhook secret refresh to prevent 403 errors when secrets expire.
Changes
Implementation Details
Testing
Fixes
Fixes #162