fix(eap): Recognize normalize deprecations in attribute mapping#116509
Merged
Conversation
Contributor
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 37ac7f9. Configure here.
mchen-sentry
approved these changes
May 29, 2026
Member
mchen-sentry
left a comment
There was a problem hiding this comment.
Should revisit as mentioned in pr desc, let's unblock
| assert len(keys) == 4 | ||
| assert "transaction.op" in keys | ||
| assert "span.op" in keys | ||
| # These two are unrelated, but happen to match. |
Member
Author
There was a problem hiding this comment.
Definitely, will fast follow with a less fragile version and tag whoever wrote/maintains this
mjq
added a commit
that referenced
this pull request
Jun 1, 2026
`OrganizationTraceItemAttributesEndpointSpansTest::test_aliased_attribute` in `tests/snuba/api/endpoints/test_organization_trace_item_attributes.py` revealed itself to be fragile in #116509, when adding new attributes suddenly broke its assertions around `op` aliases: https://github.com/getsentry/sentry/blob/61bc60a3e716563ca3bdc1dc0cd0f17114666408/tests/snuba/api/endpoints/test_organization_trace_item_attributes.py#L904-L906 Update the test to be less fragile, focusing on the presence or absence of `op` aliases rather than complete `keys` results.
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.
Okay, here goes.
#116399 broke 3 tests in tests/sentry/api/endpoints/test_project_trace_item_details.py, breaking CI:
test_convert_rpc_attribute_to_json_serializes_known_string_array_without_array_flagtest_convert_rpc_attribute_to_json_exposes_array_with_array_flagTestReplacementAttributeFiltering::test_replacement_array_shown_when_no_deprecated_sourceThese all test the very fiddly logic in
ProjectTraceItemDetailsEndpointaround arrays. Dig through enough indirection and you'll find that said logic depends on attribute info (especially deprecation metadata) being included in the relevant<type>_ATTRIBUTE_DEFINITIONSlist (e.g.SPAN_ATTRIBUTE_DEFINITIONSfor spans).When #116399 changed our data source for deprecations, it picked up a convention update that wasn't reflected in the old static deprecation JSON, changing 8
gen_ai.*spans frombackfilldeprecations tonormalizedeprecations. However, onlybackfilldeprecations get included inSPAN_ATTRIBUTE_DEFINITIONSlists - so the definitions disappeared, breaking the logic the tests depended on.Frankly: all this code needs a major rethink. The
<type>_ATTRIBUTE_DEFINITIONSlists are now heavily overloaded, acting as public search aliases, type definitions (often duplicating conventions), conventional attributes themselves, and their deprecation aliases. On top of that, the wholebackfillvsnormalizething is poorly defined between conventions, Relay and Sentry. This is going to be a constant source of bugs until this is untangled.But, this has to get fixed now and can't wait for all that heavy lifting. So I made the change that seems least likely to have a blast radius: processing
normalizedeprecated attributes the same way we dobackfillones. This only affects the 8gen_ai.*attributes plus 2 more (db.operationanddb.statement), and fixes the failing tests.Fixes BROWSE-536.
🤖 Claude Code (Opus 4.6) used heavily to understand WTF is going on. I wrote the code change, Claude wrote the tests, I reviewed. All words mine.