Commit aa7335e
perf: reduce remote-comms e2e test execution time (#906)
## Summary
Makes timing constants in the remote communications stack configurable
via `RemoteCommsOptions`, allowing e2e tests to use fast values instead
of the production defaults (500ms–10s backoff, 10s ACK/handshake/write
timeouts). Also restructures the e2e test lifecycle for efficiency.
- Add `reconnectionBaseDelayMs`, `reconnectionMaxDelayMs`,
`handshakeTimeoutMs`, `writeTimeoutMs`, and `ackTimeoutMs` to
`RemoteCommsOptions`
- Thread new options through the full stack: types → RPC spec →
transport → `ReconnectionManager` / `HandshakeDeps` / `RemoteHandle`,
plus browser runtime `comms-query-string`
- Move relay server to `beforeAll`/`afterAll` (was per-test), removing
~2.5s overhead per test
- Remove unnecessary `delay()` calls and reduce `waitUntilQuiescent`
intervals
- Set `fileParallelism: false` in e2e vitest config to prevent port
conflicts between relay-dependent test files
- Derive URL redemption timeout from `ackTimeoutMs * (MAX_RETRIES + 1)`
instead of hardcoded 30s
## Test plan
All 21 remote-comms e2e tests pass with the optimized timing. The full
e2e suite (10 files, 63 tests) passes with no port conflicts. Unit tests
for `ReconnectionManager` (77 tests), `initializeRemoteComms` RPC
handler (54 tests), and `comms-query-string` (18 tests) all pass. The
build succeeds with `exactOptionalPropertyTypes: true`.
Closes #904
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Touches core remote-communications retry/timeout behavior and
propagates new options through transport/handshake/ACK and RPC
boundaries; misconfiguration could change reconnection and message
delivery timing in production.
>
> **Overview**
> Remote comms now accepts configurable timing parameters via
`RemoteCommsOptions` (reconnection backoff base/max, handshake/write
timeouts, and ACK timeout), threads them through RPC
(`initializeRemoteComms`), transport/handshake, reconnection backoff
calculation, browser worker query-string serialization, and into
`RemoteHandle`.
>
> `RemoteHandle.redeemOcapURL` timeout is no longer hardcoded; it’s
derived from `ackTimeoutMs * (MAX_RETRIES + 1)`, and ACK retransmission
uses the injected `ackTimeoutMs`.
>
> Node E2E tests are reworked for speed and stability: relay is started
once per suite, restart helpers accept forwarded remote-comms options,
delays/quiescence waits are reduced, and Vitest E2E disables file-level
parallelism to avoid relay port conflicts.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
bdb3a4a. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 4f6a067 commit aa7335e
13 files changed
Lines changed: 329 additions & 70 deletions
File tree
- packages
- kernel-browser-runtime/src/utils
- kernel-node-runtime
- test
- e2e
- helpers
- ocap-kernel/src
- remotes
- kernel
- platform
- rpc/platform-services
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
55 | 60 | | |
56 | 61 | | |
57 | 62 | | |
| |||
0 commit comments