Skip to content

Commit bdb3a4a

Browse files
sirtimidclaude
andcommitted
fix: update RemoteHandle timeout tests for dynamic redemption timeout
The redemption timeout is now derived from ackTimeoutMs * (MAX_RETRIES + 1) instead of a hardcoded 30s, so the expected value changes from 30_000 to 40_000 (default ACK timeout 10s × 4) and the error message format changes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c8d3112 commit bdb3a4a

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

packages/ocap-kernel/src/remotes/kernel/RemoteHandle.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ describe('RemoteHandle', () => {
818818
vi.restoreAllMocks();
819819
});
820820

821-
it('sets up 30-second timeout using AbortSignal.timeout', async () => {
821+
it('sets up redemption timeout derived from ACK timeout and max retries', async () => {
822822
const remote = makeRemote();
823823
const mockOcapURL = 'ocap:test@peer';
824824

@@ -830,9 +830,9 @@ describe('RemoteHandle', () => {
830830

831831
const urlPromise = remote.redeemOcapURL(mockOcapURL);
832832

833-
// Verify AbortSignal.timeout was called with 30 seconds
834-
expect(AbortSignal.timeout).toHaveBeenCalledWith(30_000);
835-
expect(mockSignal?.timeoutMs).toBe(30_000);
833+
// Default: ACK_TIMEOUT_MS (10_000) * (MAX_RETRIES (3) + 1) = 40_000
834+
expect(AbortSignal.timeout).toHaveBeenCalledWith(40_000);
835+
expect(mockSignal?.timeoutMs).toBe(40_000);
836836

837837
// Wait for sendRemoteMessage to be called
838838
await new Promise<void>((resolve) => queueMicrotask(() => resolve()));
@@ -922,9 +922,9 @@ describe('RemoteHandle', () => {
922922
// Wait for the abort handler to execute
923923
await new Promise<void>((resolve) => queueMicrotask(() => resolve()));
924924

925-
// Verify the promise rejects
925+
// Verify the promise rejects with dynamic timeout message
926926
await expect(urlPromise).rejects.toThrow(
927-
'URL redemption timed out after 30 seconds',
927+
'URL redemption timed out after 40000ms',
928928
);
929929

930930
// Verify cleanup happened - trying to handle a reply with the same key should fail

0 commit comments

Comments
 (0)