Fix 8 high-volume Sentry production errors (~30K events/day)#3199
Draft
cursor[bot] wants to merge 2 commits intomainfrom
Draft
Fix 8 high-volume Sentry production errors (~30K events/day)#3199cursor[bot] wants to merge 2 commits intomainfrom
cursor[bot] wants to merge 2 commits intomainfrom
Conversation
Fixes RESEARCHHUB-BACKEND-4KKR: Handle deleted unified documents in Personalize sync (14K events) - guard with DoesNotExist catch Fixes RESEARCHHUB-BACKEND-4KTW: Handle deleted items in feed entry creation (2.8K events) - catch DoesNotExist on content type lookup Fixes RESEARCHHUB-BACKEND-4KQQ: Fix Hub.MultipleObjectsReturned in get_from_subfield (3.1K events) - use filter().first() instead of get() Fixes RESEARCHHUB-BACKEND-4MFH: Reduce Paper-not-found log noise in github/x enrichment tasks (1K+ events) - downgrade logger.error to warning Fixes RESEARCHHUB-BACKEND-4M79: Stop sending RelatedObjectDoesNotExist to Sentry for missing author_profile (640 events) - catch specific exception Fixes RESEARCHHUB-BACKEND-4KXM: Guard null unified_document in paper ingestion (188 events) - null check before accessing hubs Fixes RESEARCHHUB-BACKEND-4MGB: Handle null first_name/last_name in Persona webhook (9 events) - default to empty string Fixes RESEARCHHUB-BACKEND-4JW1: Handle GitHub 422 gracefully in metrics enrichment (8.4K events) - treat as permanent skip, not error Co-authored-by: Kobe Attias <kobeattias@gmail.com>
- Test sync_item_by_id handles deleted unified documents gracefully - Test GitHub 422 is treated as skip (not error or retryable) - Test GitHub 403 is treated as retryable - Test Persona webhook handles null first_name/last_name Co-authored-by: Kobe Attias <kobeattias@gmail.com>
|
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.



Addresses 8 recurring Sentry errors with a combined ~30K events/day through minimal, safe defensive fixes:
Fixes:
ResearchhubUnifiedDocument.DoesNotExistin Personalize sync — guard with try/exceptHub.MultipleObjectsReturnedinget_from_subfield— usefilter().first()instead ofget()Paper.DoesNotExistin feed entry creation — catch missing items gracefullylogger.errortologger.warningUser has no author_profile— catchRelatedObjectDoesNotExistbefore logging to Sentryunified_documentin paper ingestion — add null check before.hubs.add()first_name— default to empty stringAll fixes are defensive guards with no behavioral changes to happy paths. Tests included.