feat: implement GitHub issue webhooks and Redis caching for contributor cap queries - #506
Merged
Merged
Conversation
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 pull request introduces two backend improvements focused on scalability and synchronization:
The changes add Redis caching for frequently accessed Soroban contract queries and implement GitHub webhook processing to keep backend issue state synchronized with GitHub in near real time.
These improvements reduce unnecessary RPC traffic, improve application responsiveness under load, and ensure issue assignment data remains consistent with GitHub.
Issue #294 – Redis caching for contributor cap queries
Background
Every issue card render previously triggered multiple read-only Soroban contract queries for contributor limits.
Under moderate or heavy traffic this created unnecessary load against the Soroban RPC node, increasing latency and producing duplicate requests for identical data.
This PR introduces a lightweight Redis caching layer to reduce repeated contract reads while preserving correctness.
Changes
Redis cache support
Implemented caching for:
get_global_application_countget_org_assignment_countusing the existing Redis client.
Cache keys
Global contributor count
Organization contributor count
Cache lifecycle
(default 30 seconds)
cache miss:
cache hit:
cache invalidation:
Benefits
Issue #295 – GitHub webhook handler
Background
The backend must stay synchronized with GitHub issue activity so dashboards, contributor assignments, and review workflows accurately reflect repository state.
Previously this synchronization depended on polling or manual updates.
This PR introduces a GitHub webhook endpoint that reacts to issue events as they occur.
Changes
New webhook endpoint
Security
Implemented verification of GitHub webhook signatures using:
X-Hub-Signature-256Invalid signatures return:
Supported events
Implemented handling for:
issues.openedissues.closedissues.labeledissues.unlabeledissues.assignedEvent behavior
issues.closed
issues.labeled
When the label is:
the issue is inserted or updated in the backend database so it becomes visible on the contributor dashboard.
issues.unlabeled
If removal of the label causes the issue to become ineligible:
Unknown events
Unsupported webhook events are acknowledged with:
without further processing.
Benefits
Testing
Validation included:
Redis cache
GitHub webhook
All automated tests pass successfully.
Backwards Compatibility
These changes are fully backward compatible.
Performance Impact
This PR substantially reduces repeated Soroban RPC reads for contributor cap lookups while maintaining fresh data through short-lived caching and explicit invalidation after successful transactions.
Webhook-driven synchronization also removes the need for periodic polling, reducing unnecessary backend work.
Checklist
Issues Resolved
Closes #294
Closes #295