Skip to content

Commit 52fc462

Browse files
mchen-sentrygeorge-sentry
authored andcommitted
fix(tests): Fix flaky AI conversations tests exceeding Snuba retention (#112612)
1 parent dc41c0a commit 52fc462

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

tests/sentry/api/endpoints/test_organization_ai_conversations.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ def test_complete_conversation_data_across_time_range(self) -> None:
637637

638638
def test_first_input_last_output(self) -> None:
639639
"""Test firstInput and lastOutput are correctly populated from ai_client spans"""
640-
now = before_now(days=90).replace(microsecond=0)
640+
now = before_now(days=11).replace(microsecond=0)
641641
conversation_id = uuid4().hex
642642
trace_id = uuid4().hex
643643

@@ -699,7 +699,7 @@ def test_first_input_last_output(self) -> None:
699699

700700
def test_no_ai_client_spans_filtered_out(self) -> None:
701701
"""Test conversations without input/output are filtered out"""
702-
now = before_now(days=91).replace(microsecond=0)
702+
now = before_now(days=12).replace(microsecond=0)
703703
conversation_id = uuid4().hex
704704
trace_id = uuid4().hex
705705

@@ -732,7 +732,7 @@ def test_no_ai_client_spans_filtered_out(self) -> None:
732732

733733
def test_query_filter(self) -> None:
734734
"""Test that query parameter filters conversations"""
735-
now = before_now(days=30).replace(microsecond=0)
735+
now = before_now(days=25).replace(microsecond=0)
736736
conversation_id_1 = uuid4().hex
737737
conversation_id_2 = uuid4().hex
738738

@@ -770,7 +770,7 @@ def test_query_filter(self) -> None:
770770

771771
def test_conversation_with_user_data(self) -> None:
772772
"""Test that user data is extracted from spans and returned in the response"""
773-
now = before_now(days=100).replace(microsecond=0)
773+
now = before_now(days=13).replace(microsecond=0)
774774
conversation_id = uuid4().hex
775775
trace_id = uuid4().hex
776776

@@ -822,7 +822,7 @@ def test_conversation_with_user_data(self) -> None:
822822

823823
def test_conversation_with_partial_user_data(self) -> None:
824824
"""Test that user is returned even with partial user data"""
825-
now = before_now(days=101).replace(microsecond=0)
825+
now = before_now(days=14).replace(microsecond=0)
826826
conversation_id = uuid4().hex
827827
trace_id = uuid4().hex
828828

@@ -857,7 +857,7 @@ def test_conversation_with_partial_user_data(self) -> None:
857857

858858
def test_new_format_input_output_messages(self) -> None:
859859
"""Test that new format gen_ai.input.messages and gen_ai.output.messages are parsed correctly"""
860-
now = before_now(days=102).replace(microsecond=0)
860+
now = before_now(days=16).replace(microsecond=0)
861861
conversation_id = uuid4().hex
862862
trace_id = uuid4().hex
863863

@@ -904,7 +904,7 @@ def test_new_format_input_output_messages(self) -> None:
904904

905905
def test_new_format_with_multiple_text_parts(self) -> None:
906906
"""Test that multiple text parts are concatenated correctly"""
907-
now = before_now(days=103).replace(microsecond=0)
907+
now = before_now(days=17).replace(microsecond=0)
908908
conversation_id = uuid4().hex
909909
trace_id = uuid4().hex
910910

@@ -955,7 +955,7 @@ def test_new_format_with_multiple_text_parts(self) -> None:
955955

956956
def test_new_format_priority_over_old_format(self) -> None:
957957
"""Test that new format attributes take priority over old format when both exist"""
958-
now = before_now(days=104).replace(microsecond=0)
958+
now = before_now(days=18).replace(microsecond=0)
959959
conversation_id = uuid4().hex
960960
trace_id = uuid4().hex
961961

@@ -1010,7 +1010,7 @@ def test_new_format_priority_over_old_format(self) -> None:
10101010

10111011
def test_new_format_parts_structure(self) -> None:
10121012
"""Test that new format with parts structure works correctly"""
1013-
now = before_now(days=105).replace(microsecond=0)
1013+
now = before_now(days=19).replace(microsecond=0)
10141014
conversation_id = uuid4().hex
10151015
trace_id = uuid4().hex
10161016

@@ -1055,7 +1055,7 @@ def test_new_format_parts_structure(self) -> None:
10551055

10561056
def test_tool_names_populated(self) -> None:
10571057
"""Test that toolNames is populated with distinct tool names from tool spans"""
1058-
now = before_now(days=106).replace(microsecond=0)
1058+
now = before_now(days=21).replace(microsecond=0)
10591059
conversation_id = uuid4().hex
10601060
trace_id = uuid4().hex
10611061

@@ -1128,7 +1128,7 @@ def test_tool_names_populated(self) -> None:
11281128

11291129
def test_tool_errors_counted(self) -> None:
11301130
"""Test that toolErrors counts only failed tool spans"""
1131-
now = before_now(days=107).replace(microsecond=0)
1131+
now = before_now(days=35).replace(microsecond=0)
11321132
conversation_id = uuid4().hex
11331133
trace_id = uuid4().hex
11341134

@@ -1212,7 +1212,7 @@ def test_tool_errors_counted(self) -> None:
12121212

12131213
def test_empty_tool_names_when_no_tool_calls(self) -> None:
12141214
"""Test that toolNames is empty when there are no tool calls"""
1215-
now = before_now(days=108).replace(microsecond=0)
1215+
now = before_now(days=23).replace(microsecond=0)
12161216
conversation_id = uuid4().hex
12171217
trace_id = uuid4().hex
12181218

@@ -1257,7 +1257,7 @@ def test_tokens_only_counted_from_ai_client_spans(self) -> None:
12571257
This prevents double counting when both agent spans (invoke_agent) and their
12581258
child ai_client spans have token/cost data.
12591259
"""
1260-
now = before_now(days=109).replace(microsecond=0)
1260+
now = before_now(days=24).replace(microsecond=0)
12611261
conversation_id = uuid4().hex
12621262
trace_id = uuid4().hex
12631263

0 commit comments

Comments
 (0)