Skip to content

fix(serializer): Add type annotations to databag limits - #7505

Merged
sentrivana merged 1 commit into
getsentry:masterfrom
8rulerstar:fix/7503-annotate-config-vars
Sep 15, 2026
Merged

sentrivana merged 1 commit into
getsentry:masterfrom
8rulerstar:fix/7503-annotate-config-vars

Conversation

@8rulerstar

@8rulerstar 8rulerstar commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Description

Add int annotations to MAX_DATABAG_DEPTH and MAX_DATABAG_BREADTH in serializer.py.

Without them, ty infers the variables as Literal[5] / Literal[10] and reports invalid-assignment when users reassign them (e.g. sentry_sdk.serializer.MAX_DATABAG_DEPTH = 15). I checked this with ty locally: the errors go away after this change. No runtime change.

As discussed in the issue, MAX_EVENT_BYTES is left as is.

This is my first open source contribution ever, so thanks @sentrivana for the quick reply on the issue, and I'm happy to make any changes if needed!

Issues

Annotate MAX_DATABAG_DEPTH and MAX_DATABAG_BREADTH as int so type
checkers such as ty don't infer them as Literal types and flag user
reassignments as invalid.

Fixes getsentry#7503
@8rulerstar
8rulerstar marked this pull request as ready for review September 15, 2026 08:45
@8rulerstar
8rulerstar requested a review from a team as a code owner September 15, 2026 08:45
@sentrivana

Copy link
Copy Markdown
Contributor

Thanks @8rulerstar!

@sentrivana
sentrivana enabled auto-merge (squash) September 15, 2026 08:59
@sentrivana
sentrivana merged commit 4b364fd into getsentry:master Sep 15, 2026
159 checks passed
@8rulerstar
8rulerstar deleted the fix/7503-annotate-config-vars branch September 15, 2026 23:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add type annotations to global config variables

2 participants