mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-18 05:02:15 +03:00
fix(sse): green PR #7223 CI — complexity ratchet + stale test expectations
- Extract applyChatCompletionsOnlyQuirks() and resolveInitiatorHeader() out of GithubExecutor.transformRequest()/buildHeaders() so the two methods drop back under the complexity/cognitive-complexity ratchets (2058/891 -> 2056/890, matching the frozen baseline). No behavior change — same guards, just relocated. - Update 4 pre-existing unit tests that hard-coded now-native claude-* Copilot ids (claude-sonnet-4.5/4.6) to exercise the /chat/completions legacy path via an unregistered id (claude-sonnet-4), matching the sibling test already using that pattern. These ids now intentionally route to the native /v1/messages shim added by this PR, which correctly skips the /chat/completions-only workarounds these tests were built to verify — the native path's own coverage lives in github-copilot-claude-native-messages.test.ts. - Split the routing invariant test (copilot-gemini-claude-route-no-responses.test.ts) into a Claude case (expects /v1/messages) and a Gemini case (still expects /chat/completions), reflecting the intentional routing change.
This commit is contained in:
@@ -161,7 +161,13 @@ test("GithubExecutor.transformRequest sanitizes Anthropic-shape content parts (t
|
||||
],
|
||||
};
|
||||
|
||||
const result = executor.transformRequest("claude-sonnet-4.6", body, true, {});
|
||||
// Use an unregistered claude-* id (not "claude-sonnet-4.6"/etc.) so
|
||||
// getModelTargetFormat("gh", ...) resolves to null and this stays on the
|
||||
// /chat/completions path this test targets. Registered claude-* ids now
|
||||
// carry targetFormat:"claude" (native /v1/messages — port of
|
||||
// decolua/9router#2608, see github-copilot-claude-native-messages.test.ts)
|
||||
// and intentionally skip this sanitization.
|
||||
const result = executor.transformRequest("claude-sonnet-4", body, true, {});
|
||||
|
||||
// user message keeps text + image_url parts untouched
|
||||
assert.equal(result.messages[0].content[0].type, "text");
|
||||
|
||||
Reference in New Issue
Block a user