Skip to content

Commit 99b0bbc

Browse files
committed
test: compare non-target replay against baseline
1 parent 3742e26 commit 99b0bbc

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

‎tests/cline-pass-deepseek-v4-tool-replay.test.ts‎

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { describe, expect, test } from "bun:test";
2+
import { createOpenAIChatAdapter } from "../src/adapters/openai-chat";
23
import { createRegisteredAdapter } from "../src/adapters/registry";
34
import {
45
stripClinePassDeepSeekV4ToolReplayNarration,
@@ -72,12 +73,16 @@ function parsedWithHybridToolTurn(modelId: string): OcxParsedRequest {
7273
};
7374
}
7475

75-
async function outboundMessages(modelId: string): Promise<Array<Record<string, unknown>>> {
76-
const adapter = createRegisteredAdapter(provider);
77-
const request = await adapter.buildRequest(parsedWithHybridToolTurn(modelId), {
76+
function incoming() {
77+
return {
7878
headers: new Headers(),
7979
translatorBudget: createTestTranslatorBudget(),
80-
});
80+
};
81+
}
82+
83+
async function outboundMessages(modelId: string): Promise<Array<Record<string, unknown>>> {
84+
const adapter = createRegisteredAdapter(provider);
85+
const request = await adapter.buildRequest(parsedWithHybridToolTurn(modelId), incoming());
8186
const body = JSON.parse(request.body) as { messages?: Array<Record<string, unknown>> };
8287
return body.messages ?? [];
8388
}
@@ -106,12 +111,12 @@ describe("ClinePass DeepSeek V4 tool-call history replay", () => {
106111
expect(finalAssistant).toBeDefined();
107112
});
108113

109-
test("leaves hybrid assistant content unchanged for non-target models", async () => {
110-
const messages = await outboundMessages("cline-pass/not-deepseek-v4");
111-
const toolTurn = messages.find(message => Array.isArray(message.tool_calls));
114+
test("leaves non-target OpenAI-chat requests byte-identical", async () => {
115+
const parsed = parsedWithHybridToolTurn("cline-pass/not-deepseek-v4");
116+
const plainRequest = await createOpenAIChatAdapter(provider).buildRequest(parsed, incoming());
117+
const wrappedRequest = await createRegisteredAdapter(provider).buildRequest(parsed, incoming());
112118

113-
expect(toolTurn?.content).toContain("I should inspect the repository first.");
114-
expect(toolTurn?.content).toContain("Let me run that now.");
119+
expect(wrappedRequest.body).toBe(plainRequest.body);
115120
});
116121

117122
test("keeps reasoning metadata when stripping a target tool turn", () => {

0 commit comments

Comments
 (0)