From b55521d50dc91c00587d48eab8d5cef323d1d2f9 Mon Sep 17 00:00:00 2001 From: soul Date: Mon, 9 Nov 2026 15:50:10 +0000 Subject: [PATCH] cultmesh-ts test: observe queued provider registers from creation so a client timeout is not an unhandled rejection Co-Authored-By: Claude Sonnet 5.5 --- .../cultmesh-ts/test/provider-rudp-transport.test.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/cultmesh-ts/test/provider-rudp-transport.test.ts b/packages/cultmesh-ts/test/provider-rudp-transport.test.ts index aa4db341..577acc8a 100644 --- a/packages/cultmesh-ts/test/provider-rudp-transport.test.ts +++ b/packages/cultmesh-ts/test/provider-rudp-transport.test.ts @@ -287,18 +287,21 @@ test("a replaced RUDP generation drops operations queued behind an active handle runtimeId: identity.serviceInstanceId, connectionId, sessionToken: "signed-provider-token", - operationTimeoutMs: 100, + operationTimeoutMs: 1, // expires long before the test ends: the settle-by-timeout path is always exercised socketFactory: () => socket, }).connect(identity, new AbortController().signal); try { + // The handler is held open and the closed generation never answers, so these two settle only by the + // client's operation timeout or by connection.close(). Observe them from the start: whichever fires + // first is a legitimate end of the call, and this test asserts on server-side handler calls, not on it. const first = connection.register( { identity, requestedLeaseDurationMs: 10_000 }, new AbortController().signal, - ); + ).then(() => undefined, () => undefined); const second = connection.register( { identity, requestedLeaseDurationMs: 10_000 }, new AbortController().signal, - ); + ).then(() => undefined, () => undefined); await waitFor(() => handlerCalls === 1, "first queued provider operation"); const replacement = new CultNetRudpSession({ connectionId }); @@ -318,7 +321,7 @@ test("a replaced RUDP generation drops operations queued behind an active handle assert.equal(handlerCalls, 1, "transport-queued work from the closed generation must be dropped"); connection.close(); - await Promise.allSettled([first, second]); + await Promise.all([first, second]); } finally { connection.close(); server.close();