From 89a194bbd0fd25c57df5456ccdc223978e4ac084 Mon Sep 17 00:00:00 2001 From: yucheng-berri Date: Mon, 19 Oct 2026 13:20:50 -0700 Subject: [PATCH] test(integration): hold the upstream until the disconnect is settled before reading its spend row (#47303) test_client_disconnect_before_any_content_sends_no_response_scan released the gated upstream right after the client closed, so the upstream's next chunk raced the disconnect into the proxy. When the chunk won, the proxy had " tail" on record for the client and the cut-short scan recorded a post_call success on the spend row, which the test asserts is absent (CircleCI integration-extensions job 2263560 on 68db022d5704: `AssertionError: (('success',),)`). The test now reads the spend row first, which is written once the proxy has settled the disconnect, and releases the upstream after it. The proxy's behavior is unchanged; only the test's ordering is. Co-authored-by: yucheng-berri <293926326+yucheng-berri@users.noreply.github.com> --- tests/integration/observability/test_guardrail_effects.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/observability/test_guardrail_effects.py b/tests/integration/observability/test_guardrail_effects.py index b3481057b3b..086baac6ee5 100644 --- a/tests/integration/observability/test_guardrail_effects.py +++ b/tests/integration/observability/test_guardrail_effects.py @@ -2836,9 +2836,9 @@ def test_client_disconnect_before_any_content_sends_no_response_scan(gateway: Ga with _disconnect_rig(gateway, tmp_path, shape="empty") as rig: try: _stream_and_close(rig, "/v1/chat/completions", _chat_body(rig, 0), "data: ") + rows: Final = _post_call_statuses(rig, rig.model) finally: rig.gate.set() - rows: Final = _post_call_statuses(rig, rig.model) assert rig.scans.response_scans(rig.secret()) == (), rig.scans.seen assert len(rows) == 1 and "success" not in rows[0], rows