test(mesh): keep T2's refused body inside the socket buffer (#120)
CI / dco (pull_request) Successful in 5s
CI / runtimes (bun) (pull_request) Successful in 20s
CI / build (pull_request) Successful in 28s
CI / runtimes (edge) (pull_request) Successful in 18s
CI / runtimes (deno) (pull_request) Successful in 32s

T2 sent a 1,000,001-byte body against the 1 MB default. The teacup answers
413 with `connection: close` while the client is still uploading, so the
client sometimes saw EPIPE instead of the 413: about 1 run in 10, on
develop too. That is the transport racing the answer, not a different
answer.

Run it against a 1,000-byte limit, the way the edge suite already does.
CARD-24's T2 asks only for "body > maxBodyBytes". 0 failures in 30 runs,
against 2 in 20 before.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
chrnx committed 2026-10-24 14:11:01 -05:00
1 parent bb3d759f3a
commit 957513ffb6
1 file changed
+5 -2
+5 -2
View File
@@ -105,9 +105,12 @@ describe('mesh RPC body near maxBodyBytes (#120)', () => {
});
it('a body over maxBodyBytes is refused 413 by the teacup, and the channel stays open (T2)', async () => {
const { post, close } = await pair();
// A small limit, so the refused body fits in the socket buffer. Over the 1 MB default, the 413
// and its `connection: close` land mid-upload and the client can see EPIPE instead: the
// transport racing the answer, not a different answer (the edge suite does the same).
const { post, close } = await pair(1_000);
try {
expect((await post(json(1_000_001))).status).toBe(413);
expect((await post(json(1_001))).status).toBe(413);
expect((await post(json(1_000))).status).toBe(200);
} finally {
await close();