fix(models): Break infinite recursion in GroupHash repr#110902
Merged
fix(models): Break infinite recursion in GroupHash repr#110902
Conversation
lobsterkatie
approved these changes
Mar 17, 2026
s1gr1d
added a commit
to getsentry/craft
that referenced
this pull request
Mar 20, 2026
…sh (#777) A package was published to the release registry without `main_docs_url` set. Now, we use `repo_url` as `mainDocsUrl` fallback and emit warnings on missing metadata. Related Sentry PR: getsentry/sentry#110902 This PR adds upfront validation warnings and clearer, rewritten documentation for all config options (the diff looks big as I ran prettier). ### Validation For all new packages (apps, SDKs), it checks: - `name` - `mainDocsUrl` (can also use the fallback value of `repo_url`) When an `sdkName` is provided, we can safely assume that a new SDK will be added and we additionally check for `packageUrl`. In case of missing options, the workflow will fail -> avoids incorrect registry states. --------- Co-authored-by: getsentry-bot <[email protected]>
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.
Break a mutual recursion between GroupHash.repr and GroupHashMetadata.repr that causes a RecursionError and a storm of database queries.
The cycle: GroupHashMetadata.repr accesses
seer_matched_grouphash(lazy-loads a GroupHash), whose repr accessesmetadata(lazy-loads a GroupHashMetadata via reverse OneToOneField), whose repr accessesseer_matched_grouphash... and so on until Python hits the recursion limit. This is triggered by the Sentry SDK's Django caching integration callingstr()on cached model instances to measure their size.Two changes to break the cycle from both sides:
GroupHashMetadata: useseer_matched_grouphash_id(raw FK column) instead ofseer_matched_grouphash(related object) insane_repr— avoids the lazy load entirelyGroupHash: removemetadatafromsane_repr— it triggered a reverse OneToOneField query on every repr call