@@ -515,10 +515,8 @@ def test_built_in_chunkload_rules_variants(self):
515
515
}
516
516
assert "built-in-fingerprint" in variants
517
517
518
- # ignore hash as it's not relevant for this test
519
- variants ["built-in-fingerprint" ].pop ("hash" , None )
520
-
521
518
assert variants ["built-in-fingerprint" ] == {
519
+ "hash" : mock .ANY , # ignore hash as it can change for unrelated reasons
522
520
"type" : "built-in-fingerprint" ,
523
521
"description" : "Sentry defined fingerprint" ,
524
522
"values" : ["chunkloaderror" ],
@@ -609,7 +607,7 @@ def test_built_in_hydration_rules_different_transactions(self):
609
607
data = self .hydration_error_trace , project_id = self .project
610
608
)
611
609
data_transaction_text = self .hydration_error_trace .copy ()
612
- data_transaction_text ["transaction" ] = "/text/"
610
+ data_transaction_text ["tags" ][ " transaction" ] = "/text/" # type: ignore[index]
613
611
event_transaction_text = self .store_event (
614
612
data = data_transaction_text , project_id = self .project
615
613
)
@@ -650,3 +648,30 @@ def test_built_in_hydration_rules_disabled(self):
650
648
event = self .store_event (data = self .hydration_error_trace , project_id = self .project )
651
649
assert event .data .data ["fingerprint" ] == ["my-route" , "{{ default }}" ]
652
650
assert event .data .data .get ("_fingerprint_info" ) is None
651
+
652
+ @with_feature ("organizations:grouping-built-in-fingerprint-rules" )
653
+ def test_built_in_hydration_rules_no_transactions (self ):
654
+ """
655
+ With the flag enabled, hydration errors with no transactions should work as expected.
656
+ """
657
+
658
+ data_transaction_no_tx = self .hydration_error_trace
659
+ del data_transaction_no_tx ["tags" ]["transaction" ] # type: ignore[attr-defined]
660
+ event_transaction_no_tx = self .store_event (
661
+ data = data_transaction_no_tx , project_id = self .project
662
+ )
663
+ variants = {
664
+ k : v .as_dict ()
665
+ for k , v in event_transaction_no_tx .get_grouping_variants (
666
+ force_config = GROUPING_CONFIG
667
+ ).items ()
668
+ }
669
+
670
+ assert variants ["built-in-fingerprint" ] == {
671
+ "hash" : mock .ANY , # ignore hash as it can change for unrelated reasons
672
+ "type" : "built-in-fingerprint" ,
673
+ "description" : "Sentry defined fingerprint" ,
674
+ "values" : ["hydrationerror" , "<no-value-for-tag-transaction>" ],
675
+ "client_values" : ["my-route" , "{{ default }}" ],
676
+ "matched_rule" : 'sdk:"sentry.javascript.nextjs" message:"Text content does not match server-rendered HTML." -> "hydrationerror{{tags.transaction}}"' ,
677
+ }
0 commit comments