From 68dcb5882d743047fb310ad65a0d3e44e4149700 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 29 Sep 2026 12:31:53 +0000 Subject: [PATCH] test(mcp): cap below every payload in the capped-response contract test The Release job failed on main: with the full git history it checks out, `coupling` on the mini-repo fixture answers `{"ok": true, "couplings": []}` (36 bytes), which fits under the 40-byte cap the test used, so it came back as a normal result instead of the size notice the test asserts. CI's shallow clone adds a `shallow` flag and pushed the same answer over 40, which is why the PR's checks passed. A 1-byte cap is below the smallest possible JSON answer, so every tool takes the notice path in any checkout. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01XWLTLwAs9kt9Ac2YvAXV1q --- tests/mcp-output.test.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/mcp-output.test.ts b/tests/mcp-output.test.ts index 126efca..d1c1ee9 100644 --- a/tests/mcp-output.test.ts +++ b/tests/mcp-output.test.ts @@ -255,14 +255,18 @@ describe("SDK conformance of the advertised tool list", () => { }); it("sends a capped response as a tool error without structuredContent, for every schema-declaring tool", async () => { - // A cap this small withholds every payload, so each call exercises the - // notice path. Before, the notice was a non-error result with no - // structuredContent — which an SDK client turns into a thrown -32600. + // A 1-byte cap withholds every payload (the smallest JSON answer, `[]`, + // is 2 bytes), so each call exercises the notice path. A larger cap let a + // small honest answer through: with full git history, `coupling` on the + // fixture is `{"ok": true, "couplings": []}` — 36 bytes, under the 40 this + // test used — while a shallow clone adds a `shallow` flag and went over. + // Before, the notice was a non-error result with no structuredContent — + // which an SDK client turns into a thrown -32600. const names = Object.keys(CASES).filter((n) => !EDIT_TOOLS.includes(n) && n !== "write_memory" && n !== "delete_memory"); const { ordered } = await session( names.map((name) => ({ name, arguments: CASES[name]! })), "2025-11-25", - ["--max-response-bytes", "40"], + ["--max-response-bytes", "1"], ); names.forEach((name, i) => { const res = ordered[i] as Record;