From 227e382d6474016b807f765912b5910224d56ea8 Mon Sep 17 00:00:00 2001 From: Diego Rodrigues de Sa e Souza Date: Sun, 19 Jul 2026 13:51:33 -0300 Subject: [PATCH] test(antigravity): assert converted chat.completion for non-stream 429 retry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The executor's non-streaming path collects the upstream SSE and returns a finished OpenAI chat.completion payload. The test still treated the body as raw SSE and piped it through parseSSEToGeminiResponse, which correctly returns null for non-SSE input — failing the release-tip unit suite. Verified the production output is exactly what the test's own assertions expect (content 'Hello again', usage 2/3/5, finish_reason stop, 2 fetch calls incl. the 429 retry), so this realigns the test with the real contract rather than weakening it: 3 pass/1 fail -> 4 pass/0 fail. --- .../maintenance/antigravity-nonstream-test-realign.md | 1 + tests/unit/antigravity-streaming-passthrough.test.ts | 10 ++++------ 2 files changed, 5 insertions(+), 6 deletions(-) create mode 100644 changelog.d/maintenance/antigravity-nonstream-test-realign.md diff --git a/changelog.d/maintenance/antigravity-nonstream-test-realign.md b/changelog.d/maintenance/antigravity-nonstream-test-realign.md new file mode 100644 index 0000000000..b116718b81 --- /dev/null +++ b/changelog.d/maintenance/antigravity-nonstream-test-realign.md @@ -0,0 +1 @@ +- Realign the Antigravity non-streaming 429-retry test with the executor's actual contract: it returns the already-converted OpenAI `chat.completion` payload, so the test asserts that payload directly instead of re-parsing it as raw SSE (which returned `null` and failed the release-tip unit suite). diff --git a/tests/unit/antigravity-streaming-passthrough.test.ts b/tests/unit/antigravity-streaming-passthrough.test.ts index 23715cbae3..5aef685b7b 100644 --- a/tests/unit/antigravity-streaming-passthrough.test.ts +++ b/tests/unit/antigravity-streaming-passthrough.test.ts @@ -9,7 +9,6 @@ import { AntigravityExecutor, createCreditsExtractionTransform, } from "../../open-sse/executors/antigravity.ts"; -import { parseSSEToGeminiResponse } from "../../open-sse/handlers/sseParser/geminiResponse.ts"; import { clearAntigravityVersionCache, seedAntigravityVersionCache, @@ -73,11 +72,10 @@ test("AntigravityExecutor.execute auto-retries short 429 responses and collects credentials: { accessToken: "token", projectId: "project-1" }, log: { debug() {}, warn() {} }, }); - // Non-streaming now returns raw SSE; parse it the way chatCore would. - const rawSSE = await result.response.text(); - const parsed = parseSSEToGeminiResponse(rawSSE, "antigravity/gemini-2.5-flash"); - assert.ok(parsed, "parseSSEToGeminiResponse should parse the SSE"); - const payload = parsed as ChatCompletionPayload; + // Non-streaming collects the upstream SSE and returns the already-converted + // OpenAI chat.completion payload — no further SSE parsing on the caller side. + const payload = JSON.parse(await result.response.text()) as ChatCompletionPayload; + assert.equal(payload.object, "chat.completion"); assert.equal(calls.length, 2); assert.equal(result.response.status, 200);