From c747c395cf4febde7e128fa99e08fc17a04e55ba Mon Sep 17 00:00:00 2001 From: toki Date: Wed, 8 Jul 2026 16:24:01 +0900 Subject: [PATCH] =?UTF-8?q?test(openai):=20passthrough=20=EB=AA=A8?= =?UTF-8?q?=EB=8D=B8=20alias=20=EC=84=A4=EB=AA=85=EC=9D=84=20=EC=A0=95?= =?UTF-8?q?=EB=A6=AC=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/edge/internal/openai/server_test.go | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/apps/edge/internal/openai/server_test.go b/apps/edge/internal/openai/server_test.go index bab3f2c..6f87ccf 100644 --- a/apps/edge/internal/openai/server_test.go +++ b/apps/edge/internal/openai/server_test.go @@ -4492,8 +4492,9 @@ func chatPassthroughServer(providerURL string) (*Server, *fakeRunService) { } // TestChatCompletionsPassthroughNonStreamingByteIdentity verifies SDD S04 for -// the non-streaming path: with omitted response mode, the caller receives the -// provider JSON body byte-identically, along with provider status and headers. +// the non-streaming path: when the provider omits a top-level model echo, the +// caller receives the provider JSON body byte-identically, along with provider +// status and headers. func TestChatCompletionsPassthroughNonStreamingByteIdentity(t *testing.T) { // Provider-original body with fields the normalized path would rewrite or // drop (reasoning_content, provider-specific key order and spacing). @@ -4592,7 +4593,8 @@ func TestChatCompletionsPassthroughNonStreamingRewritesModelEcho(t *testing.T) { // TestChatCompletionsPassthroughProviderPoolGenerationPolicy verifies that // provider-pool omitted-mode passthrough requests apply the catalog entry's // generation policy (default_max_tokens, min_max_tokens, default_thinking_token_budget) -// before dispatching to the provider. +// before dispatching to the provider. The fixture omits a top-level model echo, +// so the response body remains byte-identical. func TestChatCompletionsPassthroughProviderPoolGenerationPolicy(t *testing.T) { providerBody := `{"id":"cmpl-provider-1","object":"chat.completion","choices":[{"index":0,"message":{"role":"assistant","content":"hi"},"finish_reason":"stop"}]}` var gotProviderReq []byte @@ -4662,10 +4664,9 @@ func TestChatCompletionsPassthroughProviderPoolGenerationPolicy(t *testing.T) { } // TestChatCompletionsPassthroughStreamingByteIdentity verifies SDD S04 for the -// streaming path: provider SSE bytes (including provider-specific fields like -// reasoning_content and native tool_calls chunks) reach the caller -// with provider fields preserved except the top-level model echo, which is -// normalized back to the caller-facing model alias. +// streaming path: provider SSE bytes without top-level model echoes, including +// provider-specific fields like reasoning_content and native tool_calls chunks, +// reach the caller byte-identically. func TestChatCompletionsPassthroughStreamingByteIdentity(t *testing.T) { providerBody := "data: {\"choices\":[{\"delta\":{\"role\":\"assistant\"}}]}\n\n" + "data: {\"choices\":[{\"delta\":{\"reasoning_content\":\"thinking...\"}}]}\n\n" + @@ -5102,9 +5103,9 @@ func TestChatCompletionsPassthroughProviderErrorAfterStartStopsBodyWrites(t *tes } // TestChatCompletionsPassthroughSlowClientByteIdentity verifies a slow caller -// applies backpressure without corrupting the relay: every body frame reaches -// the caller exactly once, in order, byte-identically, and a slow-but-alive -// client never triggers CancelRun. +// applies backpressure without corrupting opaque relay data: every body frame +// reaches the caller exactly once, in order, and a slow-but-alive client never +// triggers CancelRun. func TestChatCompletionsPassthroughSlowClientByteIdentity(t *testing.T) { const chunkCount = 40 var want strings.Builder