Files
OmniRoute/tests/unit/combo-quality-tiny-budget-probe.test.ts
Diego Rodrigues de Sa e Souza 2cb02d26c6 fix(sse): exempt tiny-budget reasoning probes and trace persisted-cooldown skips (#12659) (#13269)
Merged as part of the 39-PR owner batch of 2026-09-11, validated as a unit.

Boarded into one consolidated worktree cut from `release/v3.8.51` with the other 38 — zero conflicts between them.

- ESLint over every changed file: no errors (the only finding was one suppression entry the batch emptied, pruned on #13243)
- `typecheck:core` clean; `check:dashboard-typecheck` OK (206 pre-existing, within baseline); `check:changelog-integrity` OK
- complexity 2821 / baseline 3218 and cognitive-complexity 1272 / baseline 1437 — both under baseline
- 256 assertions green: 246 under node:test and 10 under vitest, which is where `tests/unit/**/*.test.tsx` actually runs
- `check-file-size`: `chatCore.ts` rebaselined 6144 → 6146 for #13278 and #13276, annotated and landed on #13243

⚠️ base-red inherited: #12732 — the provider count (356 in the docs vs the 358 the modules define) and `open-sse/utils/stream.ts` at 3115 > frozen 3098 both reproduce on the pure tip with zero contribution from this batch.
2026-09-11 22:06:15 -03:00

20 lines
1006 B
TypeScript

import test from "node:test";
import assert from "node:assert/strict";
const { validateResponseQuality } = await import("../../open-sse/services/combo.ts");
const silentLog = { warn: () => {} };
function makeTinyProbeResponse(): Response {
// Mirrors the issue's reported shape verbatim: "reasoning consumed 10/10 tokens — no content output"
return new Response(
JSON.stringify({
choices: [{ message: { content: null, reasoning_content: "Ok" }, finish_reason: "length" }],
usage: { completion_tokens: 10, reasoning_tokens: 10 },
}),
{ status: 200, headers: { "content-type": "application/json" } }
);
}
test("#12659 EXPECTED: combo validator exempts a tiny-budget reasoning probe (finish_reason:length, tiny completion_tokens) instead of a genuine quality failure", async () => {
const res = makeTinyProbeResponse();
const out = await validateResponseQuality(res, false, silentLog);
assert.equal(out.valid, true, `reproduces #12659: ... (reason: ${out.reason})`);
});