Skip to content

Comments

fix: multiple detail-reported issues#133

Merged
sgbalogh merged 19 commits intomainfrom
bug-fixes
Feb 13, 2026
Merged

fix: multiple detail-reported issues#133
sgbalogh merged 19 commits intomainfrom
bug-fixes

Conversation

@sgbalogh
Copy link
Member

@sgbalogh sgbalogh commented Feb 13, 2026

Fixes #115, fixes #114, fixes #117, fixes #116, fixes #119, fixes #118, fixes #120.

sgbalogh and others added 18 commits February 12, 2026 14:41
Now that headers are always array-of-tuples at runtime (fixed in #114),
the Object.entries fallback in meteredBytes and the Record<string, string>
type in isCommandRecord are dead code.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
… is undefined

When record.body was undefined, the fallback checked typeof record.body
=== 'string' which is false for undefined, so it always fell back to
new Uint8Array() regardless of format. Now passes the format explicitly
so string reads get '' and bytes reads get new Uint8Array().

Also extracts S2S convertRecord as exported convertProtoRecord for
testability.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
…ack tests

- S2S convertProtoRecord: duplicate headers, bigint safety, string/bytes decode
- Cross-transport: fetch/proto and S2S produce matching ReadRecord shapes
- RetryReadSession: undefined body defaults to '' for string, Uint8Array for bytes

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Keeps the S2S transport's export surface private. The function now lives
alongside related helpers (decodeProtoReadBatch, fromProtoSequencedRecord)
in proto.ts, imported by both S2S and tests.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
…ecord to proto.ts

Addresses review feedback: convertProtoRecord is no longer exported from
the S2S production module. It now lives in the shared proto.ts alongside
related helpers. Also fixes TS strict-null errors in test array accesses.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Instead of silently defaulting to 0 via ?? 0n, convertProtoRecord now
throws an S2Error if seqNum or timestamp is undefined. A record without
these fields is malformed and should not be silently accepted.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@sgbalogh sgbalogh marked this pull request as ready for review February 13, 2026 04:11
@sgbalogh sgbalogh requested a review from a team as a code owner February 13, 2026 04:11
@greptile-apps
Copy link

greptile-apps bot commented Feb 13, 2026

Greptile Overview

Greptile Summary

This PR addresses 7 distinct bug fixes across error handling, data parsing, and pagination logic. The changes prevent data loss from duplicate HTTP headers, fix uint64 overflow issues, resolve browser-specific network error detection, correct SSE boundary parsing to handle all newline combinations, and fix pagination logic that stopped early when filtering deleted resources. All fixes include comprehensive regression tests.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • All changes are well-tested bug fixes with comprehensive regression test coverage. The code is defensive, handles edge cases properly, and improves reliability without breaking existing behavior
  • No files require special attention

Important Files Changed

Filename Overview
packages/streamstore/src/lib/stream/transport/proto.ts Added convertProtoRecord function and bigintToSafeNumber export to handle protobuf record conversion with proper uint64 overflow detection and duplicate header preservation
packages/streamstore/src/error.ts Enhanced browser network error detection to recognize Chrome, Firefox, and Safari error messages (case-insensitive matching)
packages/streamstore/src/lib/event-stream.ts Rewrote findBoundary to detect all 8 SSE boundary combinations (CRLF+CRLF, LF+LF, CR+CR, LF+CR, etc.) using token-based parsing
packages/streamstore/src/lib/paginate.ts Added filterAsync utility function to enable filtering outside pagination, preventing early termination when entire pages are filtered
packages/streamstore/src/lib/retry.ts Simplified toSDKReadRecord to treat headers as arrays uniformly across transports; removed debug log parameter and pendingBytes decrement logic
packages/streamstore/src/lib/stream/transport/fetch/shared.ts Added !response.response.ok checks and optional chaining for error properties to handle cases where error object is undefined

Last reviewed commit: 9bfc41c

@sgbalogh sgbalogh merged commit d9a5707 into main Feb 13, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment