Skip to content

Commit 4eecd16

Browse files
geezoria1337claude
andcommitted
test(server): cover split UTF-8 and an unterminated last line in the bridge
Deliver the U+2028/U+2029 message the way process.stdin can: split inside a multi-byte character and without a trailing newline, which readline handled and the stream framing must keep handling. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent a98cec2 commit 4eecd16

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎apps/server/src/mcp/AcpMcpStdioBridge.test.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,14 @@ describe("AcpMcpStdioBridge", () => {
174174
jsonrpc: "2.0",
175175
id: 4,
176176
method: "tools/call",
177-
params: { name: "echo", arguments: { text: "a\u2028b\u2029c" } },
177+
params: { name: "echo", arguments: { text: "a\u2028b\u2029c\u{1f30d}" } },
178178
});
179179

180-
input.end(`${message}\n`);
180+
// Split inside the emoji's UTF-8 bytes and leave the last line unterminated, as stdin may.
181+
const bytes = Buffer.from(message);
182+
const split = bytes.indexOf(Buffer.from("\u{1f30d}")) + 2;
183+
input.write(bytes.subarray(0, split));
184+
input.end(bytes.subarray(split));
181185
yield* Fiber.join(fiber);
182186

183187
expect(requests.map((request) => request.body)).toEqual([message]);

0 commit comments

Comments
 (0)