Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
193 commits
Select commit Hold shift + click to select a range
5a2d176
Permit emitting pydantic inputs in snapshot tests
blast-hardcheese Apr 8, 2025
1a099fe
Converting TypedDict<->pydantic parity tests over to snapshot testing
blast-hardcheese Apr 8, 2025
8b683c3
Address error message
blast-hardcheese Mar 22, 2025
35ae452
Making input and init types optional, gating on protocol version
blast-hardcheese Mar 22, 2025
d884d2e
Moving library call render method out to reduce local scope
blast-hardcheese Mar 22, 2025
bbe78dd
v2 client
blast-hardcheese Mar 22, 2025
2055562
Adding and threading through protocol_version
blast-hardcheese Mar 22, 2025
5beda8e
Conditionally emit v2 Clients
blast-hardcheese Mar 22, 2025
25d3585
Expose protocol-version to CLI
blast-hardcheese Mar 22, 2025
1b5ae12
Pivoting rendered parameters based on protocol_version
blast-hardcheese Mar 22, 2025
b3dc162
Relax the RiverProcedure field requirements so we can parse v2
blast-hardcheese Mar 22, 2025
2121661
Missing render
blast-hardcheese Mar 22, 2025
d241780
Moving type ascriptions down to the method level
blast-hardcheese Mar 22, 2025
9fa548d
Just avoid calling add_msg_to_stream if it should not be called
blast-hardcheese Mar 22, 2025
231f1a3
Adding missing STREAM_CLOSED_BIT
blast-hardcheese Mar 22, 2025
6a71888
v2 closed bit
blast-hardcheese Mar 22, 2025
8bced2d
v2 cancel bit
blast-hardcheese Mar 22, 2025
656da90
Reflowing v2 send_stream to have modern semantics
blast-hardcheese Mar 22, 2025
8628a3c
v2 send_stream codegen
blast-hardcheese Mar 22, 2025
1efbb3a
Reflowing v2 send_upload to have modern semantics
blast-hardcheese Mar 22, 2025
6d92145
v2 send_upload codegen
blast-hardcheese Mar 22, 2025
f0f2482
Distribute PROTOCOL_VERSION constant
blast-hardcheese Mar 22, 2025
41c1c49
Describing the control packet structures
blast-hardcheese Mar 22, 2025
66f0e36
Translating a little more of PROTOCOL into code
blast-hardcheese Mar 23, 2025
9a46e26
These are all self calls
blast-hardcheese Mar 23, 2025
b43f2e6
Typing all self parameters
blast-hardcheese Mar 23, 2025
d39aafc
WIP
blast-hardcheese Mar 23, 2025
3e7bc4e
:thinking: Avoid sending more messages when we know we are closed
blast-hardcheese Mar 24, 2025
7a577c8
Skipping heartbeats when we know we're closed
blast-hardcheese Mar 24, 2025
bca134f
One more I think
blast-hardcheese Mar 24, 2025
61b8b7f
Unsure, was ws unset by this point?
blast-hardcheese Mar 24, 2025
0fba294
Missing parameter in v1 client
blast-hardcheese Mar 24, 2025
d1702ac
Upgrade to the new websocket impl
blast-hardcheese Mar 24, 2025
5cb47e2
Removing transport_options parameter
blast-hardcheese Mar 24, 2025
f9aba7a
Formatting
blast-hardcheese Mar 24, 2025
736c3cd
Switch to raw bytes recv() call to avoid round-tripping through str
blast-hardcheese Mar 24, 2025
b2f6582
wat
blast-hardcheese Mar 24, 2025
1068f12
Bite the bullet and merge client_session and session together
blast-hardcheese Mar 24, 2025
ebf3bf8
This is what Semaphores are for
blast-hardcheese Mar 24, 2025
62143d3
Inline ws creation
blast-hardcheese Mar 24, 2025
e905499
Goodbye session_lock
blast-hardcheese Mar 24, 2025
c0a4f44
Moving throw over into rate_limiter
blast-hardcheese Mar 24, 2025
736c4e8
More lifecycle management
blast-hardcheese Mar 24, 2025
046e770
Just use _state instead of having two
blast-hardcheese Mar 24, 2025
c457944
Patch circular import
blast-hardcheese Mar 24, 2025
37b0187
Block ensure_connected until connected
blast-hardcheese Mar 25, 2025
c3e8b86
Do our best to avoid contention on ensure_connected
blast-hardcheese Mar 25, 2025
6a3d63e
Fix bugs
blast-hardcheese Mar 25, 2025
d0c0835
Stripping WIP logging
blast-hardcheese Mar 25, 2025
4ed787a
Adding a missing debug log
blast-hardcheese Mar 25, 2025
e8c2417
More logging around message receipt
blast-hardcheese Mar 25, 2025
8107ab6
Prevent _handle_messages_from_ws from terminating early
blast-hardcheese Mar 25, 2025
2bc50c3
Break out _serve from Session
blast-hardcheese Mar 25, 2025
4fd76e7
Merging _handle_messages_from_ws
blast-hardcheese Mar 25, 2025
0be9267
Flattening try:while:try:
blast-hardcheese Mar 25, 2025
cb21664
Colocating functions from common_session
blast-hardcheese Mar 25, 2025
bb9edda
Flip while:try: to try:while:
blast-hardcheese Mar 25, 2025
551f908
Compartmentalize initializers
blast-hardcheese Mar 25, 2025
49ae2a0
Boom
blast-hardcheese Mar 25, 2025
877ea12
Deprecated
blast-hardcheese Mar 25, 2025
3e691be
try:try:
blast-hardcheese Mar 25, 2025
85b778a
Fix state transition logic
blast-hardcheese Mar 25, 2025
df36d35
REVERTME
blast-hardcheese Mar 25, 2025
0184369
Missing state transition
blast-hardcheese Mar 25, 2025
3ddff34
We have a new enumeration state for this!
blast-hardcheese Mar 25, 2025
eea25bd
Gotcha
blast-hardcheese Mar 25, 2025
8ddf591
Readability reordering
blast-hardcheese Mar 25, 2025
e7bd18b
c-style strings work with format strings as well
blast-hardcheese Mar 25, 2025
b21a99b
Wake up tasks pending connected state so they can exit cleanly
blast-hardcheese Mar 25, 2025
7d4912f
Migrating all background tasks to just use block_until_connected
blast-hardcheese Mar 25, 2025
ee8d065
Redundant
blast-hardcheese Mar 25, 2025
5735ce9
Allow _check_to_close_session to exit normally if we are done
blast-hardcheese Mar 25, 2025
e18b544
Abort if the session is rejected by the server
blast-hardcheese Mar 25, 2025
fbe8b30
Expand CONNECTING to the various ConnectingStates
blast-hardcheese Mar 25, 2025
d18c6f0
More lifecycle tweaks during shutdown so we exit cleanly.
blast-hardcheese Mar 25, 2025
9fd39e1
More logging
blast-hardcheese Mar 25, 2025
424baae
try:try:
blast-hardcheese Mar 26, 2025
2abe730
more state logging
blast-hardcheese Mar 26, 2025
9ff6aca
Switch from active heartbeat to passive heartbeat
blast-hardcheese Mar 26, 2025
74b7133
Whoops
blast-hardcheese Mar 26, 2025
80dcd72
Avoid circular awaits
blast-hardcheese Mar 26, 2025
54bfe47
Permit method filtering based on supplied file
blast-hardcheese Mar 26, 2025
1a5a3e9
Updating snapshots
blast-hardcheese Mar 26, 2025
e9aded6
nit
blast-hardcheese Mar 26, 2025
0139bbe
Type error instead of runtime error
blast-hardcheese Mar 26, 2025
e7069e3
Avoid explosions when given incorrect input
blast-hardcheese Mar 26, 2025
278b274
Document
blast-hardcheese Mar 26, 2025
e6fa6b2
Inline add_msg_to_stream
blast-hardcheese Mar 26, 2025
e29c8fd
4da3dbb192b7476fae8e930c0544ecfb1d523d72
blast-hardcheese Mar 28, 2025
6ae70d8
These are part of the codegen serdes that point at the v1 client, the…
blast-hardcheese Mar 26, 2025
7de9283
Unused
blast-hardcheese Mar 26, 2025
864090c
_ws_unwrapped -> _ws, we never wrap it
blast-hardcheese Mar 26, 2025
cd735a1
Dead code
blast-hardcheese Mar 26, 2025
1a9ab87
We have nanoid types
blast-hardcheese Mar 26, 2025
399348a
Avoid double close
blast-hardcheese Mar 26, 2025
ee6ac68
Debugging code
blast-hardcheese Mar 26, 2025
f9d34ed
Avoid using logging directly
blast-hardcheese Mar 26, 2025
c26812f
No sense threading this all the way through
blast-hardcheese Mar 26, 2025
3401587
Break out _do_ensure_connected
blast-hardcheese Mar 26, 2025
3c655d7
send_message -> _send_message
blast-hardcheese Mar 26, 2025
39630e9
noqa
blast-hardcheese Mar 26, 2025
312e207
Just use asyncio.Event to represent "connected"
blast-hardcheese Mar 27, 2025
215ec79
Terminate _serve early if we are terminal
blast-hardcheese Mar 27, 2025
dd371bb
Switch from "queue_full Lock to space_available Event
blast-hardcheese Mar 27, 2025
05a1f3c
Switch message_enqueued semaphore to Event to avoid out-of-sync bugs
blast-hardcheese Mar 27, 2025
14df5c2
Better background task management
blast-hardcheese Mar 27, 2025
c0e835b
v2 ack payload type
blast-hardcheese Mar 27, 2025
480e6da
Tweaking debug logs
blast-hardcheese Mar 27, 2025
817b4c9
Avoid exceptions for flow control
blast-hardcheese Mar 27, 2025
4fdbdbc
Renaming PENDING to NO_CONNECTION to match TS
blast-hardcheese Mar 27, 2025
096200e
Update dead code to be the place where this method lives
blast-hardcheese Mar 27, 2025
290393c
None of these were async either
blast-hardcheese Mar 27, 2025
d8a9887
v2 avoid message ordering issues
blast-hardcheese Mar 27, 2025
7bbc2a9
Permit sensible message_buffer state transitions
blast-hardcheese Mar 27, 2025
ef53cc8
Clarify SessionClosedRiverServiceException
blast-hardcheese Mar 30, 2025
a9cf61e
Private method
blast-hardcheese Mar 31, 2025
0d90020
Add span to send_close_stream
blast-hardcheese Mar 31, 2025
6798a94
Break out send_cancel_stream
blast-hardcheese Mar 31, 2025
fa66288
Increment seq immediately
blast-hardcheese Mar 31, 2025
c2cbe70
Useless comments
blast-hardcheese Mar 31, 2025
345b7b2
Cancel streams on exception
blast-hardcheese Mar 31, 2025
03a0d67
Alter send_message to be generic over return value
blast-hardcheese Mar 31, 2025
ab223e1
Introduce backpressure for emitters
blast-hardcheese Mar 31, 2025
ce934af
Making space for v2 tests
blast-hardcheese Mar 31, 2025
f96d61b
Cleaning up budget exhausted errors in do_ensure_connected
blast-hardcheese Mar 31, 2025
c7b7f8e
Transitioning back to NO_CONNECTION needs to start blocking connectio…
blast-hardcheese Apr 1, 2025
6231e24
Adding more debug messages
blast-hardcheese Apr 1, 2025
b0646f9
Clarifying "output" channel type
blast-hardcheese Apr 1, 2025
ad0d683
Avoid sending service/procedure names on CLOSE
blast-hardcheese Apr 1, 2025
862eca9
event -> backpressure_waiter name clarification
blast-hardcheese Apr 1, 2025
682de58
Wake up backpressured writers on commit()
blast-hardcheese Apr 1, 2025
2a7a094
Tighter controls around lifecycle management
blast-hardcheese Apr 1, 2025
3591e49
Wait for graceful shutdown
blast-hardcheese Apr 2, 2025
79f5c6f
Add v2 stream tests
blast-hardcheese Mar 31, 2025
2ec2cb5
Codegen should provide useful errors
blast-hardcheese Apr 2, 2025
5ca64c3
Ensure that the whole test state has been consumed
blast-hardcheese Apr 2, 2025
9e803d6
Add v2 rpc tests
blast-hardcheese Apr 2, 2025
9e5ded0
Add capacity for self-closing messages
blast-hardcheese Apr 2, 2025
4b52339
Unique names for tests
blast-hardcheese Apr 2, 2025
7d16324
Avoid waking up streams that are not waiting
blast-hardcheese Apr 2, 2025
91bdf2e
We still need to be awake to catch heartbeat timeouts even if we know…
blast-hardcheese Apr 3, 2025
c94e0df
Ripping out all the heartbeat stuff in favor of server-directed signa…
blast-hardcheese Apr 3, 2025
caa2f4a
Transition connecting
blast-hardcheese Apr 3, 2025
a55b07c
Make ensure_connected callable based on our own internal state
blast-hardcheese Apr 3, 2025
8bf1de4
Exploratory, just transition_no_connection from close checker
blast-hardcheese Apr 3, 2025
c5633ae
Renaming _serve to _recv_from_ws
blast-hardcheese Apr 3, 2025
72de1e9
# type: ignore is no longer necessary
blast-hardcheese Apr 3, 2025
6fb1796
Establish symmetry between ConnectingStates and TerminalStates for Ac…
blast-hardcheese Apr 3, 2025
e21e5c4
Shoring up state transitions
blast-hardcheese Apr 3, 2025
d4d0c82
Avoid renaming parameters
blast-hardcheese Apr 3, 2025
bfc2392
Avoid redundant exceptions
blast-hardcheese Apr 3, 2025
14ae1e2
check_to_close_connection is irrelevant
blast-hardcheese Apr 3, 2025
6b12256
Add missing "else" for clarity
blast-hardcheese Apr 3, 2025
db6ff5c
Pushing error metadata into the exception
blast-hardcheese Apr 3, 2025
36d9b2b
Clarify finalize_attempt()
blast-hardcheese Apr 3, 2025
79fe8ef
Only one exception can be raised from putting on an aiochannel
blast-hardcheese Apr 3, 2025
75399d6
naming
blast-hardcheese Apr 3, 2025
17c149e
Unused extra_control_flags
blast-hardcheese Apr 3, 2025
684e7d6
Clarify _with_stream semantics
blast-hardcheese Apr 3, 2025
27bb8e6
Taking a stand on request nullability in river v2
blast-hardcheese Apr 3, 2025
0c6301f
Pretty sure this is handled now
blast-hardcheese Apr 3, 2025
a8bb9d3
stream -> output for consistency
blast-hardcheese Apr 4, 2025
9ab4d19
Clarify enqueue vs send semantics
blast-hardcheese Apr 4, 2025
bb4b652
Avoid breaking in buffered_message_sender
blast-hardcheese Apr 4, 2025
bf2c7e6
Permit errors from buffered_message_sender to bubble back to the call…
blast-hardcheese Apr 4, 2025
2a8a32f
clarify client/transport/session_id parameters
blast-hardcheese Apr 4, 2025
2e43b74
Send CANCEL correctly
blast-hardcheese Apr 4, 2025
919a5fa
Dunno
blast-hardcheese Apr 4, 2025
f73237d
Forgot the last part, which is reconnect immediately instead of waiting.
blast-hardcheese Apr 4, 2025
1af2915
Whoops.
blast-hardcheese Apr 4, 2025
2813fe6
Missing wait_for_connected.clear()
blast-hardcheese Apr 4, 2025
014248d
Turns out the new hotness is not available in 12.0
blast-hardcheese Apr 4, 2025
b872d21
Deleting dead code
blast-hardcheese Apr 5, 2025
8b7d2a7
Delete dead parameters
blast-hardcheese Apr 5, 2025
e3daed3
Didn't actually use watchdog
blast-hardcheese Apr 5, 2025
58affb0
Dangling unnecessary #ignore
blast-hardcheese Apr 5, 2025
3758ce9
session_id -> stream_id, as well as close error_channel
blast-hardcheese Apr 5, 2025
dd76d11
Adding Span to _streams
blast-hardcheese Apr 5, 2025
8b9d6cd
Push exception emission up into close_session directly
blast-hardcheese Apr 5, 2025
0c44357
Communicate handshake errors back to callers as well
blast-hardcheese Apr 5, 2025
7acb9a1
Just describe StreamMeta instead of ever-embiggening tuples
blast-hardcheese Apr 5, 2025
230f6a6
Decouple error channel from backpressure channel
blast-hardcheese Apr 7, 2025
08a0acd
PR feedback
blast-hardcheese Apr 8, 2025
502c055
Fix a bug where we were over-emitting encoder_ members for pydantic
blast-hardcheese Apr 8, 2025
9b40d6a
Line length lint
blast-hardcheese Apr 8, 2025
59e8d0f
Typing the output channel slightly
blast-hardcheese Apr 8, 2025
0c030b5
Use handshake_timeout_ms
blast-hardcheese Apr 8, 2025
395f7bb
Removing overly-broad "except"
blast-hardcheese Apr 8, 2025
efe17ca
PR feedback
blast-hardcheese Apr 8, 2025
e6812a7
Avoid deadlocking client if streams don't clean up after themselves
blast-hardcheese Apr 8, 2025
7123e82
Missed that sessions should send close at the end of input
blast-hardcheese Apr 8, 2025
e0fac3e
Missing "continue"s
blast-hardcheese Apr 8, 2025
4820ef8
Trying to debug hanging messages during disconnect
blast-hardcheese Apr 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ dependencies = [
"nanoid>=2.0.0",
"protobuf>=5.28.3",
"pydantic-core>=2.20.1",
"websockets>=12.0",
"websockets>=13.0,<14",
"opentelemetry-sdk>=1.28.2",
"opentelemetry-api>=1.28.2",
]
Expand Down
40 changes: 0 additions & 40 deletions scripts/parity.sh

This file was deleted.

295 changes: 0 additions & 295 deletions scripts/parity/check_parity.py

This file was deleted.

2 changes: 2 additions & 0 deletions src/replit_river/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from . import v2
from .client import Client
from .error_schema import RiverError
from .rpc import (
Expand All @@ -20,4 +21,5 @@
"subscription_method_handler",
"upload_method_handler",
"stream_method_handler",
"v2",
]
3 changes: 2 additions & 1 deletion src/replit_river/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,11 @@ def _trace_procedure(
span_handle = _SpanHandle(span)
try:
yield span_handle
span_handle.set_status(StatusCode.OK)
except GeneratorExit:
# This error indicates the caller is done with the async generator
# but messages are still left. This is okay, we do not consider it an error.
span_handle.set_status(StatusCode.OK)
raise
except RiverException as e:
span.record_exception(e, escaped=True)
Expand All @@ -239,7 +241,6 @@ def _trace_procedure(
span_handle.set_status(StatusCode.ERROR, f"{type(e).__name__}: {e}")
raise e
finally:
span_handle.set_status(StatusCode.OK)
span.end()


Expand Down
Loading
Loading