-
Notifications
You must be signed in to change notification settings - Fork 17
Description
Description
Read sessions on S2 Lite with clamp=true still return 416 Range Not Satisfiable when the requested starting position is beyond the stream tail (e.g., reading from seq_num=0 on an empty stream). According to the docs, clamp should silently adjust the starting point to the stream tail instead of erroring.
Reproduce
- Create a new (empty) stream
- Start a read session with
seq_num=0andclamp=true:GET /v1/streams/{stream_id}/records?seq_num=0&clamp=true - Observe a
416response instead of a clamped read session:RangeNotSatisfiableError: Range not satisfiable: requested position is beyond the stream tail (seq_num=0). Use 'clamp: true' to start from the tail instead.
The error message itself even suggests using clamp: true — which is already set.
Expected Behavior
Per the docs:
When
clampis enabled and the starting point is beyond the stream tail, the session should begin reading from the tail rather than returning an error.
The read session should open successfully, clamped to the current tail, and follow for new records (if unbounded).
Actual Behavior
The clamp parameter is ignored. The server returns 416 Range Not Satisfiable with a response suggesting the caller use clamp: true — the very flag that was already provided.
request{method=GET uri=/v1/streams/HxmuEnT9XeZ7wPfnmk-GE/records?seq_num=0&clamp=true version=HTTP/1.1}:
tower_http::trace::on_response: finished processing request latency=0 ms status=416
SDK trace:
RangeNotSatisfiableError: Range not satisfiable: requested position is beyond the stream tail (seq_num=0).
Use 'clamp: true' to start from the tail instead.
at streamRead (.../node_modules/@s2-dev/streamstore/dist/esm/lib/stream/transport/fetch/shared.js:29:19)
Notes
- Reproduced with
ghcr.io/s2-streamstore/s2:0.29.21.