test(copilot): add diagnostic logging to helpers.test.ts

CI fails with reasoning length 0 instead of 1, but the same code passes
locally with --frozen-lockfile + clean regen. Log runtime state from
inside the failing test so the next CI run surfaces what isInteractiveToolPart
sees and what splitReasoningAndResponse returns. Will revert once root cause
is found.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
anvyle
2026-04-29 15:13:49 +02:00
parent b373e3757f
commit 3b7cbe7d38

View File

@@ -7,6 +7,7 @@ import {
splitReasoningAndResponse,
} from "../helpers";
import type { MessagePart } from "../helpers";
import { ResponseType } from "@/app/api/__generated__/models/responseType";
function textPart(text: string): MessagePart {
return { type: "text", text } as MessagePart;
@@ -228,7 +229,27 @@ describe("splitReasoningAndResponse", () => {
}),
textPart("Here is the plan."),
];
// DEBUG: surface runtime state in CI to diagnose env-specific failures.
// eslint-disable-next-line no-console
console.log(
"[DEBUG splits]",
JSON.stringify({
types: parts.map((p) => p.type),
toolPartIsInteractive: isInteractiveToolPart(parts[1]),
responseTypeImport: ResponseType.task_decomposition,
}),
);
const { reasoning, response } = splitReasoningAndResponse(parts);
// eslint-disable-next-line no-console
console.log(
"[DEBUG splits result]",
JSON.stringify({
reasoningLen: reasoning.length,
reasoningTypes: reasoning.map((p) => p.type),
responseLen: response.length,
responseTypes: response.map((p) => p.type),
}),
);
expect(reasoning).toHaveLength(1);
expect(reasoning[0]).toBe(parts[0]);
expect(response).toHaveLength(2);