From 2b022171a25d33db0bf1e7763bb1ad516d2f41ab Mon Sep 17 00:00:00 2001 From: Xiangzhe Date: Tue, 18 Aug 2026 22:35:45 -0300 Subject: [PATCH] fix(tests): drain three base-reds left by the SSE-comment default and a locale gap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All three reproduce on a pristine tip; none is caused by the branch that found them. 1. i18n vi — six keys landed in en.json without a Vietnamese counterpart (settings.reasoningTokenBuffer*, settings.zeroLatencyOptimizations*, settings.compressionOutputStyle.i-have-adhd.*). The vi locale is held to strict parity, so the whole i18n-vi suite went red. Translated; no existing key reordered. 2. chatcore-translation-paths — #10539 flipped OMNIROUTE_SSE_COMMENTS to off-by-default and updated three sibling tests, but not this one, which asserted the `: x-omniroute-*` trailer is emitted. The test now asserts the current contract (stream is comment-free, still ends with [DONE], metadata still travels in the X-OmniRoute-* headers). The opt-in half stays covered by sse-comments-optout-9305.test.ts, which drives the env var through all three states. Enabling the flag inside this file instead leaks process.env into its sibling call-log tests, which is how the first attempt turned one red into a different one. 3. chat-messages-validation-6402 — all nine Antigravity cases asserted `assert.match(body, /ok/)` against the mocked model output. That text never reached this layer: the match only ever succeeded on the "ok" inside `: x-omniroute-tokens-in=0`, an SSE comment trailer. When the trailers stopped being emitted the coincidence broke, not the behavior — bisected to 6b823aa441, whose parent 6d99a46d4b passes. The test now asserts the guard it is named for (a cloudcode envelope must not be rejected by the #6402 missing-messages validator). Real content-relay coverage for this provider lives in antigravity-streaming-passthrough.test.ts, which passes. Verified: vi 5/5, chatcore-translation-paths 70/70, chat-messages-validation 14/14. --- .../10702-basereds-sse-comments-vi-parity.md | 1 + src/i18n/messages/vi.json | 10 +++++++++- .../chat-messages-validation-6402.test.ts | 16 ++++++++++++++- tests/unit/chatcore-translation-paths.test.ts | 20 ++++++++++++------- 4 files changed, 38 insertions(+), 9 deletions(-) create mode 100644 changelog.d/maintenance/10702-basereds-sse-comments-vi-parity.md diff --git a/changelog.d/maintenance/10702-basereds-sse-comments-vi-parity.md b/changelog.d/maintenance/10702-basereds-sse-comments-vi-parity.md new file mode 100644 index 0000000000..5ab9e06e98 --- /dev/null +++ b/changelog.d/maintenance/10702-basereds-sse-comments-vi-parity.md @@ -0,0 +1 @@ +- **fix(tests):** drain three base-reds on the release branch — the Vietnamese locale regained parity with English (6 keys added), the chatCore SSE test now asserts the comment-free default that #10539 introduced instead of the trailer it replaced, and the Antigravity cloudcode test asserts the missing-messages guard it is named for instead of a `/ok/` regex that only ever matched the "ok" inside `: x-omniroute-tokens-in` ([#10702](https://github.com/diegosouzapw/OmniRoute/pull/10702)) diff --git a/src/i18n/messages/vi.json b/src/i18n/messages/vi.json index a18723573d..16dece1256 100644 --- a/src/i18n/messages/vi.json +++ b/src/i18n/messages/vi.json @@ -7763,6 +7763,10 @@ "terse-cjk": { "label": "CJK súc tích (文言)", "description": "Văn phong Hán cổ cực kỳ súc tích (chỉ khả dụng với tiếng Trung)." + }, + "i-have-adhd": { + "label": "Tôi bị ADHD (ưu tiên hành động)", + "description": "Đầu ra ưu tiên hành động: nêu hành động kế tiếp trước, các bước được đánh số, một bước tiếp theo cụ thể, không mở đầu dài dòng." } }, "resilienceWaitForCooldown": "Chờ thời gian hồi", @@ -8195,7 +8199,11 @@ "cliproxyapiHealth": "Sức Khỏe", "cliproxyapiPort": "Cổng", "qdrantHost": "Máy chủ", - "qdrantCollection": "Bộ Sưu Tập" + "qdrantCollection": "Bộ Sưu Tập", + "reasoningTokenBuffer": "Bộ đệm token suy luận", + "reasoningTokenBufferDesc": "Cho phép định tuyến combo thêm khoảng dư max_tokens chỉ với các mô hình suy luận đã biết, khi toàn bộ bộ đệm vẫn nằm trong giới hạn đầu ra đã biết.", + "zeroLatencyOptimizations": "Tối ưu hóa zero-latency", + "zeroLatencyOptimizationsDesc": "Bật hedging, bỏ qua TTFT theo dự đoán và nén dự phòng chủ động. Để tắt nếu bạn không muốn các tính năng độ trễ này chạy đua giữa các đích hoặc nén các yêu cầu dự phòng." }, "contextRtk": { "title": "RTK Engine", diff --git a/tests/unit/chat-messages-validation-6402.test.ts b/tests/unit/chat-messages-validation-6402.test.ts index e4931b0c54..d75c8df3f1 100644 --- a/tests/unit/chat-messages-validation-6402.test.ts +++ b/tests/unit/chat-messages-validation-6402.test.ts @@ -171,8 +171,22 @@ for (const model of ANTIGRAVITY_GEMINI_MODELS) { assert.equal(upstreamCalled, true, "Antigravity request should reach the upstream executor"); assert.equal(response.status, 200, "Antigravity cloudcode envelopes must not return 400"); + // This assertion is the guard the test is named for: a cloudcode envelope has no + // `messages` key, so it must not be rejected by the #6402 validator. + // + // It used to read `assert.match(body, /ok/)`, aimed at the mocked upstream's + // "ok" text — but that text never reached this layer. The match only ever + // succeeded on the "ok" inside `: x-omniroute-tokens-in=0`, an SSE *comment* + // trailer. When #10539 flipped OMNIROUTE_SSE_COMMENTS to off-by-default the + // trailers stopped being emitted, the body went empty, and the coincidence — + // not the behavior — broke. Content relay for this provider is covered for + // real, at the executor level, by antigravity-streaming-passthrough.test.ts. const body = await response.text(); - assert.match(body, /ok/); + assert.doesNotMatch( + body, + /messages.*Expected array/i, + "cloudcode envelope must not be caught by the missing-messages guard" + ); }); } diff --git a/tests/unit/chatcore-translation-paths.test.ts b/tests/unit/chatcore-translation-paths.test.ts index f28caccf09..482f273332 100644 --- a/tests/unit/chatcore-translation-paths.test.ts +++ b/tests/unit/chatcore-translation-paths.test.ts @@ -2597,7 +2597,7 @@ test("chatCore injects progress events into streaming responses when requested", assert.equal(result.response.headers.get("X-OmniRoute-Progress"), "enabled"); assert.match(streamText, /event: progress/); }); -test("chatCore emits final SSE metadata comments before [DONE] on streaming responses", async () => { +test("chatCore keeps the SSE stream comment-free by default and still ends with [DONE]", async () => { const { result } = await invokeChatCore({ provider: "openai", model: "gpt-4o-mini", @@ -2615,14 +2615,20 @@ test("chatCore emits final SSE metadata comments before [DONE] on streaming resp const streamText = await result.response.text(); assert.equal(result.success, true); + // The per-request metadata reaches the client through these headers regardless + // of the comment setting — that is what makes the trailer optional. assert.equal(result.response.headers.get("X-OmniRoute-Provider"), "openai"); assert.equal(result.response.headers.get("X-OmniRoute-Model"), "gpt-4o-mini"); - assert.match(streamText, /: x-omniroute-response-cost=\d+\.\d{10}/); - assert.match(streamText, /: x-omniroute-tokens-in=\d+/); - assert.match(streamText, /: x-omniroute-tokens-out=\d+/); - assert.ok( - streamText.indexOf(": x-omniroute-response-cost=") < streamText.indexOf("data: [DONE]") - ); + + // #10524 flipped OMNIROUTE_SSE_COMMENTS to off-by-default: strict SSE clients + // JSON.parse every line and crash on `: x-omniroute-*` comments. This test used + // to assert the opposite and went red on the release branch when that default + // landed. The opt-in half — trailer present, after the finish chunk and before + // [DONE] — is owned by sse-comments-optout-9305.test.ts, which drives the env + // var through all three states; enabling it here instead leaks process.env into + // the sibling call-log tests in this file. + assert.doesNotMatch(streamText, /: x-omniroute-/); + assert.match(streamText, /data: \[DONE\]/); }); test("buildStreamingResponseHeaders drops upstream compression and framing headers", () => { const headers = new Headers(