Skip to content

Channel lifecycle v2: RPCAbortedError, core-owned outbound queue, no abortPending#3

Merged
serg-plusplus merged 3 commits into
0.7.0-review-fixesfrom
0.7.0-review-fixes-v2
Jul 11, 2026
Merged

Channel lifecycle v2: RPCAbortedError, core-owned outbound queue, no abortPending#3
serg-plusplus merged 3 commits into
0.7.0-review-fixesfrom
0.7.0-review-fixes-v2

Conversation

@Cyace84

@Cyace84 Cyace84 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Implements the three review points from PR #2.

  1. abortPending removed. client() now returns { api, destroy }. Migration: shared AbortController, pass its signal per call.

  2. New RPCAbortedError extends RPCError. Invariant: class = which side of the wire the request died on, code = what killed it.
    RPCAbortedError (TIMEOUT/ABORTED/SESSION) means the frame was sent and the outcome is unknown: reconcile before retrying. Plain
    RPCError means it provably never left: retry freely. Went one step further than the ask: code TIMEOUT now exists only on
    RPCAbortedError. A still-queued frame that runs out of time (either timer) fails as definite RPCError("CHANNEL") with the last send
    error as cause, so the promise "plain = never left" holds under any config. One-line revert if you disagree.

  3. Queues moved out of channels into the core. Channel contract: send must throw/reject when it can't deliver, no adapter queues.
    wsChannel and socketChannel reworked, maxQueue removed, auto-reconnect stays. Core retries failed sends every 250ms until new
    sendTimeout option (default 10s), then rejects plain RPCError("CHANNEL"). Async sends counted sent optimistically, rolled back to
    the queue on rejection. destroy() splits pending by sent flag: sent gets RPCAbortedError("SESSION"), queued gets plain
    RPCError("SESSION"). Bonus: stale hello is revoked from the queue after handshakeTimeout, no more late flush.

Deviation to flag: session auto-reset narrowed to RPCAbortedError("TIMEOUT") only. Plain CHANNEL no longer resets: the frame never
left, keys are fine, transport failure is not a session event.

Verification: 276/276 tests, tsc and prettier clean. Tests 4-9 pin the class split per rejection path, incl. the
timeout-beats-sendTimeout misconfig. Spec updated: spec-channel-lifecycle.md v2, spec/api.md, README (was still documenting
abortPending).

Cyace84 added 2 commits July 10, 2026 17:03
- Removed abortPending() functionality in favor of handling timeouts with RPCAbortedError.
- Updated tests to reflect new error handling for TIMEOUT and CHANNEL errors.
- Enhanced ws-channel tests to ensure proper error throwing during down states and after close.
- Adjusted createFaultChannelPair to throw errors synchronously when the channel is down.
- Improved session continuity tests to validate genuine client resets and re-handshakes.
@Cyace84
Cyace84 requested a review from serg-plusplus July 10, 2026 18:28
@serg-plusplus
serg-plusplus merged commit b03160b into 0.7.0-review-fixes Jul 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants