test(gateway): make queued follow-up regression generic

Replace tenant-specific example text in the transcript offset regression with generic follow-up turns so the upstream test documents the bug without customer-specific wording.
This commit is contained in:
Kong 2026-05-14 02:52:42 +08:00 committed by Teknium
parent 9a815b6c8c
commit cc64a04f61

View file

@ -282,22 +282,26 @@ class TestTranscriptHistoryOffset:
{"role": "user", "content": "Earlier question"}, {"role": "user", "content": "Earlier question"},
{"role": "assistant", "content": "Earlier answer"}, {"role": "assistant", "content": "Earlier answer"},
] ]
cool_turn = [ first_followup_turn = [
{"role": "user", "content": "cool"}, {"role": "user", "content": "First follow-up question"},
{"role": "assistant", "content": "Quote again"}, {"role": "assistant", "content": "First follow-up answer"},
] ]
order_turn = [ second_followup_turn = [
{"role": "user", "content": "how to make order?"}, {"role": "user", "content": "Second follow-up question"},
{"role": "assistant", "content": "Deposit flow"}, {"role": "assistant", "content": "Second follow-up answer"},
] ]
current_result = { current_result = {
"history_offset": len(history_before_chain), "history_offset": len(history_before_chain),
"messages": history_before_chain + cool_turn, "messages": history_before_chain + first_followup_turn,
} }
followup_result = { followup_result = {
"history_offset": len(history_before_chain + cool_turn), "history_offset": len(history_before_chain + first_followup_turn),
"messages": history_before_chain + cool_turn + order_turn, "messages": (
history_before_chain
+ first_followup_turn
+ second_followup_turn
),
} }
merged = _preserve_queued_followup_history_offset( merged = _preserve_queued_followup_history_offset(
@ -307,7 +311,7 @@ class TestTranscriptHistoryOffset:
assert merged["history_offset"] == len(history_before_chain) assert merged["history_offset"] == len(history_before_chain)
persisted = merged["messages"][merged["history_offset"]:] persisted = merged["messages"][merged["history_offset"]:]
assert persisted == cool_turn + order_turn assert persisted == first_followup_turn + second_followup_turn
def test_recursive_queued_followup_preserves_smaller_existing_offset(self): def test_recursive_queued_followup_preserves_smaller_existing_offset(self):
"""Do not widen the slice if the nested result is already conservative.""" """Do not widen the slice if the nested result is already conservative."""