Repository navigation
test(breadcrumbs): Add regression tests for breadcrumb truncation _meta (#3996) - #7621
Closed
DawnofGenX wants to merge 1 commit into
Closed
DawnofGenX wants to merge 1 commit into
DawnofGenX wants to merge 1 commit into
Conversation
Collaborator
|
Going to close this because we don't have capacity to review the 5 PRs you've opened. |
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
Adds regression tests for the breadcrumb-truncation
_metaannotation described in #3996.The runtime behavior itself already exists (merged in 5147ab9 / #4007): when breadcrumbs exceed
max_breadcrumbs, the SDK tracks the number dropped on the scope and attachesevent["_meta"]["breadcrumbs"] = {"": {"len": <original total>}}to captured events. However, the original PR shipped with no dedicated tests (its only test change was an adjustment totests/test_scrubber.pycaused by the new annotation), so nothing in the suite guards this protocol behavior today.This PR adds three tests to
tests/test_client.pynext to the existingtest_max_breadcrumbs_option:test_breadcrumbs_truncated_meta— 10 breadcrumbs withmax_breadcrumbs=3→ event carries 3 crumbs and_metarecords the original total (10).test_breadcrumbs_not_truncated_no_meta— exactly at the limit → nobreadcrumbsentry under_meta.test_breadcrumbs_truncated_meta_from_child_scope— breadcrumbs added in a child scope accumulate correctly across scope merging (Scope._merge_into).Test plan / evidence
Fails without the fix (I temporarily reverted the
_metaattachment block insentry_sdk/client.py):Passes with the fix restored (full
tests/test_client.py):Commands:
uv run tox -e py3.14-common -- -k "breadcrumbs_truncated_meta or breadcrumbs_not_truncated_no_meta"uv run tox -e py3.14-common -- tests/test_client.pyuv run ruff check --fix tests/test_client.py/uv run ruff format tests/test_client.py(clean)Fixes #3996