Skip to content

Commit

Permalink
chore(grouping): Add checksum grouping variant test inputs (#79655)
Browse files Browse the repository at this point in the history
This adds three checksum-based inputs to the grouping variant snapshot tests, so I can be sure an upcoming refactor in that area of the code doesn’t break anything.

Note: Careful observers will notice that in the resulting snapshots where we store both the raw and hashed checksum, neither one is marked as contributing, and there's no hint explaining by the non-contributing one was ignored. We also don't run the other strategies (message, stacktrace, etc.) the way we do with all other methods of grouping. Fixing either of those felt out of the scope of this PR, but I did leave two `TODO`s so we won't forget to revisit it at some point.
  • Loading branch information
lobsterkatie authored Oct 24, 2024
1 parent e381699 commit b357045
Show file tree
Hide file tree
Showing 17 changed files with 134 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/sentry/grouping/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,14 @@ def get_grouping_variants_for_event(
"""Returns a dict of all grouping variants for this event."""
# If a checksum is set the only variant that comes back from this
# event is the checksum variant.
#
# TODO: Is there a reason we don't treat a checksum like a custom fingerprint, and run the other
# strategies but mark them as non-contributing, with explanations why?
#
# TODO: In the case where we have to hash the checksum to get a value in the right format, we
# store the raw value as well (provided it's not so long that it will overflow the DB field).
# Even when we do this, though, we don't set the raw value as non-cotributing, and we don't add
# an "ignored because xyz" hint on the variant, which we should.
checksum = event.data.get("checksum")
if checksum:
if HASH_RE.match(checksum):
Expand Down
4 changes: 2 additions & 2 deletions tests/sentry/grouping/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ def _dump_component(component: GroupingComponent, indent: int) -> None:
if isinstance(value, GroupingComponent):
lines.append("{}{}:".format(" " * indent, key))
_dump_component(value, indent + 1)
elif key == "config":
# We do not want to dump the config
elif key in ["config", "hash"]:
# We do not want to dump the config, and we've already dumped the hash
continue
else:
lines.append("{}{}: {}".format(" " * indent, key, to_json(value)))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"checksum": "not a legit checksum and also too long a string",
"message": "Dogs are great!"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"checksum": "not a legit checksum",
"message": "Dogs are great!"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"checksum": "11212012123120120415201309082013",
"message": "Dogs are great!"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
created: '2024-10-23T23:31:04.165771+00:00'
creator: sentry
source: tests/sentry/grouping/test_variants.py
---
checksum:
hash: "not a legit checksum"
hashed: false
--------------------------------------------------------------------------
hashed-checksum:
hash: "de46d023e69b171b90ccf3ebca7aede4"
hashed: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
created: '2024-10-23T23:31:04.119227+00:00'
creator: sentry
source: tests/sentry/grouping/test_variants.py
---
hashed-checksum:
hash: "2c2e85a6e73109222f131228ed06a7af"
hashed: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
created: '2024-10-23T23:31:04.207745+00:00'
creator: sentry
source: tests/sentry/grouping/test_variants.py
---
checksum:
hash: "11212012123120120415201309082013"
hashed: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
created: '2024-10-23T23:31:04.025726+00:00'
creator: sentry
source: tests/sentry/grouping/test_variants.py
---
checksum:
hash: "not a legit checksum"
hashed: false
--------------------------------------------------------------------------
hashed-checksum:
hash: "de46d023e69b171b90ccf3ebca7aede4"
hashed: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
created: '2024-10-23T23:31:03.978728+00:00'
creator: sentry
source: tests/sentry/grouping/test_variants.py
---
hashed-checksum:
hash: "2c2e85a6e73109222f131228ed06a7af"
hashed: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
created: '2024-10-23T23:31:04.074740+00:00'
creator: sentry
source: tests/sentry/grouping/test_variants.py
---
checksum:
hash: "11212012123120120415201309082013"
hashed: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
created: '2024-10-23T23:31:03.885053+00:00'
creator: sentry
source: tests/sentry/grouping/test_variants.py
---
checksum:
hash: "not a legit checksum"
hashed: false
--------------------------------------------------------------------------
hashed-checksum:
hash: "de46d023e69b171b90ccf3ebca7aede4"
hashed: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
created: '2024-10-23T23:31:03.843495+00:00'
creator: sentry
source: tests/sentry/grouping/test_variants.py
---
hashed-checksum:
hash: "2c2e85a6e73109222f131228ed06a7af"
hashed: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
created: '2024-10-23T23:31:03.932140+00:00'
creator: sentry
source: tests/sentry/grouping/test_variants.py
---
checksum:
hash: "11212012123120120415201309082013"
hashed: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
created: '2024-10-23T23:31:02.204971+00:00'
creator: sentry
source: tests/sentry/grouping/test_variants.py
---
checksum:
hash: "not a legit checksum"
hashed: false
--------------------------------------------------------------------------
hashed-checksum:
hash: "de46d023e69b171b90ccf3ebca7aede4"
hashed: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
created: '2024-10-23T23:31:00.433039+00:00'
creator: sentry
source: tests/sentry/grouping/test_variants.py
---
hashed-checksum:
hash: "2c2e85a6e73109222f131228ed06a7af"
hashed: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
created: '2024-10-23T23:31:03.762694+00:00'
creator: sentry
source: tests/sentry/grouping/test_variants.py
---
checksum:
hash: "11212012123120120415201309082013"
hashed: false

0 comments on commit b357045

Please sign in to comment.