Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce $kind as a pivot point for uncaught errors #254

Introduce $kind as a pivot point for uncaught errors

0a8e35e
Select commit
Loading
Failed to load commit list.
Sign in for the full log view
Closed

Introduce $kind as a pivot point for uncaught errors #254

Introduce $kind as a pivot point for uncaught errors
0a8e35e
Select commit
Loading
Failed to load commit list.
GitHub Actions / Test Report (ubuntu-latest) succeeded Aug 14, 2024 in 0s

263 passed, 0 failed and 0 skipped

Tests passed successfully

✅ ./test-results.xml

263 tests were completed in 6s with 263 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
tests/cleanup.test.ts 14✅ 599ms
tests/context.test.ts 2✅ 72ms
tests/disconnects.test.ts 8✅ 215ms
tests/e2e.test.ts 42✅ 2s
tests/fixtures/observable.test.ts 4✅ 5ms
tests/handler.test.ts 11✅ 11ms
tests/negative.test.ts 6✅ 87ms
tests/serialize.test.ts 4✅ 6ms
tests/typescript-stress.test.ts 9✅ 11ms
codec/codec.test.ts 14✅ 13ms
tracing/tracing.test.ts 4✅ 53ms
transport/events.test.ts 5✅ 8ms
transport/impls/ws/ws.test.ts 5✅ 660ms
transport/message.test.ts 7✅ 6ms
transport/rateLimit.test.ts 8✅ 6ms
transport/sessionStateMachine/stateMachine.test.ts 70✅ 97ms
transport/transforms/messageFraming.test.ts 6✅ 15ms
transport/transport.test.ts 44✅ 4s

✅ tests/cleanup.test.ts

✅ procedures should clean up after themselves ('ws' transport, 'naive' codec) > closing a transport from the client cleans up connection on the server
✅ procedures should clean up after themselves ('ws' transport, 'naive' codec) > closing a transport from the server cleans up connection on the client
✅ procedures should clean up after themselves ('ws' transport, 'naive' codec) > rpc
✅ procedures should clean up after themselves ('ws' transport, 'naive' codec) > stream
✅ procedures should clean up after themselves ('ws' transport, 'naive' codec) > subscription
✅ procedures should clean up after themselves ('ws' transport, 'naive' codec) > upload
✅ procedures should clean up after themselves ('ws' transport, 'naive' codec) > shouldn't send messages across stale sessions
✅ procedures should clean up after themselves ('ws' transport, 'binary' codec) > closing a transport from the client cleans up connection on the server
✅ procedures should clean up after themselves ('ws' transport, 'binary' codec) > closing a transport from the server cleans up connection on the client
✅ procedures should clean up after themselves ('ws' transport, 'binary' codec) > rpc
✅ procedures should clean up after themselves ('ws' transport, 'binary' codec) > stream
✅ procedures should clean up after themselves ('ws' transport, 'binary' codec) > subscription
✅ procedures should clean up after themselves ('ws' transport, 'binary' codec) > upload
✅ procedures should clean up after themselves ('ws' transport, 'binary' codec) > shouldn't send messages across stale sessions

✅ tests/context.test.ts

✅ should handle incompatabilities > should pass extended context to procedure
✅ should handle incompatabilities > should pass extended context to initializeState

✅ tests/disconnects.test.ts

✅ procedures should handle unexpected disconnects ('ws' transport, 'naive' codec) > rpc
✅ procedures should handle unexpected disconnects ('ws' transport, 'naive' codec) > stream
✅ procedures should handle unexpected disconnects ('ws' transport, 'naive' codec) > subscription
✅ procedures should handle unexpected disconnects ('ws' transport, 'naive' codec) > upload
✅ procedures should handle unexpected disconnects ('ws' transport, 'binary' codec) > rpc
✅ procedures should handle unexpected disconnects ('ws' transport, 'binary' codec) > stream
✅ procedures should handle unexpected disconnects ('ws' transport, 'binary' codec) > subscription
✅ procedures should handle unexpected disconnects ('ws' transport, 'binary' codec) > upload

✅ tests/e2e.test.ts

✅ client <-> server integration test ('ws' transport, 'naive' codec) > rpc
✅ client <-> server integration test ('ws' transport, 'naive' codec) > fallible rpc
✅ client <-> server integration test ('ws' transport, 'naive' codec) > rpc with binary (uint8array)
✅ client <-> server integration test ('ws' transport, 'naive' codec) > stream
✅ client <-> server integration test ('ws' transport, 'naive' codec) > stream empty
✅ client <-> server integration test ('ws' transport, 'naive' codec) > stream idempotent close
✅ client <-> server integration test ('ws' transport, 'naive' codec) > stream with init message
✅ client <-> server integration test ('ws' transport, 'naive' codec) > fallible stream
✅ client <-> server integration test ('ws' transport, 'naive' codec) > subscription
✅ client <-> server integration test ('ws' transport, 'naive' codec) > subscription idempotent close
✅ client <-> server integration test ('ws' transport, 'naive' codec) > upload
✅ client <-> server integration test ('ws' transport, 'naive' codec) > upload empty
✅ client <-> server integration test ('ws' transport, 'naive' codec) > upload with init message
✅ client <-> server integration test ('ws' transport, 'naive' codec) > message order is preserved in the face of disconnects
✅ client <-> server integration test ('ws' transport, 'naive' codec) > concurrent rpcs
✅ client <-> server integration test ('ws' transport, 'naive' codec) > concurrent streams
✅ client <-> server integration test ('ws' transport, 'naive' codec) > eagerlyConnect should actually eagerly connect
✅ client <-> server integration test ('ws' transport, 'naive' codec) > client reconnects even after session grace
✅ client <-> server integration test ('ws' transport, 'naive' codec) > client doesn't reconnect after session grace if connectOnInvoke is false
✅ client <-> server integration test ('ws' transport, 'naive' codec) > works with non-object schemas
✅ client <-> server integration test ('ws' transport, 'naive' codec) > procedure can use metadata
✅ client <-> server integration test ('ws' transport, 'binary' codec) > rpc
✅ client <-> server integration test ('ws' transport, 'binary' codec) > fallible rpc
✅ client <-> server integration test ('ws' transport, 'binary' codec) > rpc with binary (uint8array)
✅ client <-> server integration test ('ws' transport, 'binary' codec) > stream
✅ client <-> server integration test ('ws' transport, 'binary' codec) > stream empty
✅ client <-> server integration test ('ws' transport, 'binary' codec) > stream idempotent close
✅ client <-> server integration test ('ws' transport, 'binary' codec) > stream with init message
✅ client <-> server integration test ('ws' transport, 'binary' codec) > fallible stream
✅ client <-> server integration test ('ws' transport, 'binary' codec) > subscription
✅ client <-> server integration test ('ws' transport, 'binary' codec) > subscription idempotent close
✅ client <-> server integration test ('ws' transport, 'binary' codec) > upload
✅ client <-> server integration test ('ws' transport, 'binary' codec) > upload empty
✅ client <-> server integration test ('ws' transport, 'binary' codec) > upload with init message
✅ client <-> server integration test ('ws' transport, 'binary' codec) > message order is preserved in the face of disconnects
✅ client <-> server integration test ('ws' transport, 'binary' codec) > concurrent rpcs
✅ client <-> server integration test ('ws' transport, 'binary' codec) > concurrent streams
✅ client <-> server integration test ('ws' transport, 'binary' codec) > eagerlyConnect should actually eagerly connect
✅ client <-> server integration test ('ws' transport, 'binary' codec) > client reconnects even after session grace
✅ client <-> server integration test ('ws' transport, 'binary' codec) > client doesn't reconnect after session grace if connectOnInvoke is false
✅ client <-> server integration test ('ws' transport, 'binary' codec) > works with non-object schemas
✅ client <-> server integration test ('ws' transport, 'binary' codec) > procedure can use metadata

✅ tests/fixtures/observable.test.ts

✅ Observable > should set initial value correctly
✅ Observable > should update value correctly
✅ Observable > should notify listeners when value changes
✅ Observable > should unsubscribe from notifications

✅ tests/handler.test.ts

✅ server-side test > rpc basic
✅ server-side test > rpc initial state
✅ server-side test > fallible rpc
✅ server-side test > stream basic
✅ server-side test > stream empty
✅ server-side test > stream with initialization
✅ server-side test > fallible stream
✅ server-side test > subscriptions
✅ server-side test > uploads
✅ server-side test > uploads empty
✅ server-side test > uploads with initialization

✅ tests/negative.test.ts

✅ should handle incompatabilities > throws when sending after close
✅ should handle incompatabilities > retrying single connection attempt should hit retry limit reached
✅ should handle incompatabilities > calling connect consecutively should reuse the same connection
✅ should handle incompatabilities > incorrect client handshake
✅ should handle incompatabilities > seq number in the future should close connection
✅ should handle incompatabilities > mismatched protocol version

✅ tests/serialize.test.ts

✅ serialize server to jsonschema > serialize entire service schema
✅ serialize service to jsonschema > serialize basic service
✅ serialize service to jsonschema > serialize service with binary
✅ serialize service to jsonschema > serialize service with errors

✅ tests/typescript-stress.test.ts

✅ ensure typescript doesn't give up trying to infer the types for large services > service with many procedures hits typescript limit
✅ ensure typescript doesn't give up trying to infer the types for large services > server client should support many services with many procedures
✅ Output<> type > it unwraps rpc outputs correctly
✅ Output<> type > it unwraps stream outputs correctly
✅ Output<> type > it unwraps subscription outputs correctly
✅ Output<> type > it unwraps upload outputs correctly
✅ ResultUwrap types > it unwraps Ok correctly
✅ ResultUwrap types > it unwraps Err correctly
✅ Handshake > custom handhshake types should work

✅ codec/codec.test.ts

✅ codec -- 'naive' > empty object
✅ codec -- 'naive' > simple test
✅ codec -- 'naive' > encodes null properly
✅ codec -- 'naive' > skips optional fields
✅ codec -- 'naive' > deeply nested test
✅ codec -- 'naive' > buffer test
✅ codec -- 'naive' > invalid json returns null
✅ codec -- 'binary' > empty object
✅ codec -- 'binary' > simple test
✅ codec -- 'binary' > encodes null properly
✅ codec -- 'binary' > skips optional fields
✅ codec -- 'binary' > deeply nested test
✅ codec -- 'binary' > buffer test
✅ codec -- 'binary' > invalid json returns null

✅ tracing/tracing.test.ts

✅ Basic tracing tests > createSessionTelemetryInfo
✅ Basic tracing tests > createHandlerSpan
✅ Integrated tracing tests ('ws' transport, 'naive' codec) > Traces sessions and connections across network boundary
✅ Integrated tracing tests ('ws' transport, 'binary' codec) > Traces sessions and connections across network boundary

✅ transport/events.test.ts

✅ EventDispatcher > notifies all handlers in order they were registered
✅ EventDispatcher > does not notify removed handlers
✅ EventDispatcher > does not notify handlers added while notifying another handler
✅ EventDispatcher > does notify handlers removed while notifying another handler
✅ EventDispatcher > removes all listeners

✅ transport/impls/ws/ws.test.ts

✅ sending and receiving across websockets works > basic send/receive
✅ sending and receiving across websockets works > sending respects to/from fields
✅ sending and receiving across websockets works > hanging ws connection with no handshake is cleaned up after grace
✅ sending and receiving across websockets works > ws connection is recreated after unclean disconnect
✅ sending and receiving across websockets works > ws connection always calls the close callback

✅ transport/message.test.ts

✅ message helpers > ack
✅ message helpers > streamOpen
✅ message helpers > streamClose
✅ message helpers > handshakeRequestMessage
✅ message helpers > handshakeResponseMessage
✅ message helpers > default message has no control flags set
✅ message helpers > combining control flags works

✅ transport/rateLimit.test.ts

✅ LeakyBucketRateLimit > should return 0 backoff time for new user
✅ LeakyBucketRateLimit > should return 0 budget consumed for new user
✅ LeakyBucketRateLimit > should consume budget correctly
✅ LeakyBucketRateLimit > keeps growing until startRestoringBudget
✅ LeakyBucketRateLimit > stops restoring budget when we consume budget again
✅ LeakyBucketRateLimit > respects maximum backoff time
✅ LeakyBucketRateLimit > backoff increases
✅ LeakyBucketRateLimit > reports remaining budget correctly

✅ transport/sessionStateMachine/stateMachine.test.ts

✅ session state machine > initial state > no connection
✅ session state machine > initial state > connecting
✅ session state machine > initial state > handshaking
✅ session state machine > initial state > connected
✅ session state machine > initial state > pending identification
✅ session state machine > state transitions > no connection -> backing off
✅ session state machine > state transitions > backing off -> connecting
✅ session state machine > state transitions > connecting -> handshaking
✅ session state machine > state transitions > handshaking -> connected
✅ session state machine > state transitions > waiting (no existing session) -> connected
✅ session state machine > state transitions > waiting (existing session) -> connected
✅ session state machine > state transitions > backing off -> no connection
✅ session state machine > state transitions > connecting (conn failed) -> no connection
✅ session state machine > state transitions > connecting (conn ok) -> no connection
✅ session state machine > state transitions > handshaking -> no connection
✅ session state machine > state transitions > connected -> no connection
✅ session state machine > state transitions preserve buffer, seq, ack > no connection -> backing off
✅ session state machine > state transitions preserve buffer, seq, ack > backing off -> connecting
✅ session state machine > state transitions preserve buffer, seq, ack > connecting -> handshaking
✅ session state machine > state transitions preserve buffer, seq, ack > handshaking -> connected
✅ session state machine > state transitions preserve buffer, seq, ack > backing off -> no connection
✅ session state machine > state transitions preserve buffer, seq, ack > connecting -> no connection
✅ session state machine > state transitions preserve buffer, seq, ack > handshaking -> no connection
✅ session state machine > state transitions preserve buffer, seq, ack > connected -> no connection
✅ session state machine > state transitions deal with session grace period appropriately > no connection -> backing off: partially consumed grace period
✅ session state machine > state transitions deal with session grace period appropriately > no connection -> backing off -> connecting: partially consumed grace period
✅ session state machine > state transitions deal with session grace period appropriately > no connection -> backing off -> connecting -> handshaking: partially consumed grace period
✅ session state machine > state transitions deal with session grace period appropriately > no connection -> backing off -> connecting -> handshaking -> connected: partially consumed grace period
✅ session state machine > state transitions deal with session grace period appropriately > backing off -> no connection: partially consumed grace period
✅ session state machine > state transitions deal with session grace period appropriately > connecting -> no connection: partially consumed grace period
✅ session state machine > state transitions deal with session grace period appropriately > handshaking -> no connection: partially consumed grace period
✅ session state machine > state transitions deal with session grace period appropriately > handshaking -> connected: connected should clear grace timer
✅ session state machine > stale handles post-transition > no connection -> backing off: stale handle
✅ session state machine > stale handles post-transition > backing off -> connecting: stale handle
✅ session state machine > stale handles post-transition > connecting -> handshaking: stale handle
✅ session state machine > stale handles post-transition > handshaking -> connected: stale handle
✅ session state machine > stale handles post-transition > waiting -> connected: stale handle
✅ session state machine > stale handles post-transition > backing off -> no connection: stale handle
✅ session state machine > stale handles post-transition > connecting -> no connection: stale handle
✅ session state machine > stale handles post-transition > handshaking -> no connection: stale handle
✅ session state machine > stale handles post-transition > connected -> no connection: stale handle
✅ session state machine > close cleanup > no connection
✅ session state machine > close cleanup > backing off
✅ session state machine > close cleanup > connecting
✅ session state machine > close cleanup > connecting finish after close
✅ session state machine > close cleanup > handshaking
✅ session state machine > close cleanup > connected
✅ session state machine > close cleanup > pending identification
✅ session state machine > event listeners > no connection event listeners: onSessionGracePeriodElapsed
✅ session state machine > event listeners > backing off event listeners: onBackoffFinished
✅ session state machine > event listeners > backing off event listeners: onSessionGracePeriodElapsed
✅ session state machine > event listeners > connecting event listeners: connectionEstablished
✅ session state machine > event listeners > connecting event listeners: connectionFailed
✅ session state machine > event listeners > connecting event listeners: connectionTimeout
✅ session state machine > event listeners > connecting event listeners: sessionGracePeriodElapsed
✅ session state machine > event listeners > handshaking event listeners: connectionErrored
✅ session state machine > event listeners > handshaking event listeners: connectionClosed
✅ session state machine > event listeners > handshaking event listeners: onHandshakeData
✅ session state machine > event listeners > handshaking event listeners: handshakeTimeout
✅ session state machine > event listeners > handshaking event listeners: sessionGracePeriodElapsed
✅ session state machine > event listeners > pending identification event listeners: connectionErrored
✅ session state machine > event listeners > pending identification event listeners: connectionClosed
✅ session state machine > event listeners > pending identification event listeners: onHandshakeData
✅ session state machine > event listeners > pending identification event listeners: handshakeTimeout
✅ session state machine > event listeners > connected event listeners: connectionErrored
✅ session state machine > event listeners > connected event listeners: connectionClosed
✅ session state machine > event listeners > connected event listeners: onMessageData
✅ session state machine > heartbeats > active heartbeating works and is cleared on state transition
✅ session state machine > heartbeats > passive heartbeating echoes back acks
✅ session state machine > heartbeats > does not dispatch acks

✅ transport/transforms/messageFraming.test.ts

✅ MessageFramer > basic transform
✅ MessageFramer > handles partial messages across chunks
✅ MessageFramer > multiple messages in a single chunk
✅ MessageFramer > max buffer size exceeded
✅ MessageFramer > incomplete message at stream end
✅ MessageFramer > consistent byte length calculation with emojis and unicode

✅ transport/transport.test.ts

✅ transport connection behaviour tests ('ws' transport, 'naive' codec) > connection is recreated after clean client disconnect
✅ transport connection behaviour tests ('ws' transport, 'naive' codec) > misbehaving clients get their sessions recreated after reconnect
✅ transport connection behaviour tests ('ws' transport, 'naive' codec) > idle transport cleans up nicely
✅ transport connection behaviour tests ('ws' transport, 'naive' codec) > idle transport stays alive
✅ transport connection behaviour tests ('ws' transport, 'naive' codec) > heartbeats should not interrupt normal operation
✅ transport connection behaviour tests ('ws' transport, 'naive' codec) > sending right after session event should not cause invalid handshake
✅ transport connection behaviour tests ('ws' transport, 'naive' codec) > seq numbers should be persisted across transparent reconnects
✅ transport connection behaviour tests ('ws' transport, 'naive' codec) > both client and server transport get connect/disconnect notifs
✅ transport connection behaviour tests ('ws' transport, 'naive' codec) > transport connection is not recreated after destroy
✅ transport connection behaviour tests ('ws' transport, 'naive' codec) > multiple connections works
✅ transport connection behaviour tests ('ws' transport, 'binary' codec) > connection is recreated after clean client disconnect
✅ transport connection behaviour tests ('ws' transport, 'binary' codec) > misbehaving clients get their sessions recreated after reconnect
✅ transport connection behaviour tests ('ws' transport, 'binary' codec) > idle transport cleans up nicely
✅ transport connection behaviour tests ('ws' transport, 'binary' codec) > idle transport stays alive
✅ transport connection behaviour tests ('ws' transport, 'binary' codec) > heartbeats should not interrupt normal operation
✅ transport connection behaviour tests ('ws' transport, 'binary' codec) > sending right after session event should not cause invalid handshake
✅ transport connection behaviour tests ('ws' transport, 'binary' codec) > seq numbers should be persisted across transparent reconnects
✅ transport connection behaviour tests ('ws' transport, 'binary' codec) > both client and server transport get connect/disconnect notifs
✅ transport connection behaviour tests ('ws' transport, 'binary' codec) > transport connection is not recreated after destroy
✅ transport connection behaviour tests ('ws' transport, 'binary' codec) > multiple connections works
✅ transport disabling transparent reconnect ('ws' transport, 'naive' codec) > reconnecting with grace period of 0 should result in hard reconnect
✅ transport disabling transparent reconnect ('ws' transport, 'binary' codec) > reconnecting with grace period of 0 should result in hard reconnect
✅ transport handshake grace period tests ('ws' transport, 'naive' codec) > handshake grace period of 0 should lead to closed connections
✅ transport handshake grace period tests ('ws' transport, 'binary' codec) > handshake grace period of 0 should lead to closed connections
✅ transport connection edge cases ('ws' transport, 'naive' codec) > reconnecting before grace period ends should leave session intact
✅ transport connection edge cases ('ws' transport, 'naive' codec) > session grace elapses during long reconnect loop
✅ transport connection edge cases ('ws' transport, 'naive' codec) > messages should not be resent when the client loses all state and reconnects to the server
✅ transport connection edge cases ('ws' transport, 'naive' codec) > messages should not be resent when client reconnects to a different instance of the server
✅ transport connection edge cases ('ws' transport, 'naive' codec) > recovers from phantom disconnects
✅ transport connection edge cases ('ws' transport, 'binary' codec) > reconnecting before grace period ends should leave session intact
✅ transport connection edge cases ('ws' transport, 'binary' codec) > session grace elapses during long reconnect loop
✅ transport connection edge cases ('ws' transport, 'binary' codec) > messages should not be resent when the client loses all state and reconnects to the server
✅ transport connection edge cases ('ws' transport, 'binary' codec) > messages should not be resent when client reconnects to a different instance of the server
✅ transport connection edge cases ('ws' transport, 'binary' codec) > recovers from phantom disconnects
✅ transport handshake tests ('ws' transport, 'naive' codec) > handshakes and stores parsed metadata in session
✅ transport handshake tests ('ws' transport, 'naive' codec) > client checks request schema on construction
✅ transport handshake tests ('ws' transport, 'naive' codec) > server checks request schema on receive
✅ transport handshake tests ('ws' transport, 'naive' codec) > server gets previous parsed metadata on reconnect
✅ transport handshake tests ('ws' transport, 'naive' codec) > parse can reject connection
✅ transport handshake tests ('ws' transport, 'binary' codec) > handshakes and stores parsed metadata in session
✅ transport handshake tests ('ws' transport, 'binary' codec) > client checks request schema on construction
✅ transport handshake tests ('ws' transport, 'binary' codec) > server checks request schema on receive
✅ transport handshake tests ('ws' transport, 'binary' codec) > server gets previous parsed metadata on reconnect
✅ transport handshake tests ('ws' transport, 'binary' codec) > parse can reject connection