Add stream reading guidance: ReadStreamToEnd and memory semantics - #2
Add stream reading guidance: ReadStreamToEnd and memory semantics#2alexeyzimarev wants to merge 1 commit into
Conversation
Document the IEventReader read semantics (KurrentDB streams events as they arrive, relational stores buffer up to count) and steer agents to ReadStreamToEnd for whole-stream reads instead of ReadEvents with int.MaxValue. Matches Eventuous/eventuous#568. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
PR Summary by QodoDocument streaming read semantics and recommend ReadStreamToEnd for whole streams
AI Description
Diagram
High-Level Assessment
Files changed (3)
|
Code Review by Qodo
1. ReadStream memory cost unclear
|
| } | ||
| ``` | ||
|
|
||
| Options: `pageSize` tunes the page size; `failIfNotFound: false` yields nothing instead of throwing `StreamNotFound`. The `ReadStream` extension method does the same paged read and returns `StreamEvent[]` if you need the whole stream as an array. |
There was a problem hiding this comment.
1. Readstream memory cost unclear 🐞 Bug ⚙ Maintainability
The new docs say ReadStream "does the same paged read" but don’t explicitly warn that returning StreamEvent[] necessarily materializes the entire stream in memory (memory grows with stream length, regardless of page size). This can lead users to inadvertently load very large streams into memory when they only needed streaming iteration.
Agent Prompt
### Issue description
The docs mention that `ReadStream` performs a paged read and returns `StreamEvent[]`, but they don’t clearly state that the returned array requires holding the whole stream in memory (page size only bounds the fetch buffer, not the final result).
### Issue Context
This is in the newly added "Reading Event Streams" section, immediately after recommending `ReadStreamToEnd` for bounded-memory streaming.
### Fix Focus Areas
- skills/eventuous-dotnet/SKILL.md[253-266]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Follows Eventuous/eventuous#568 (fixes Eventuous/eventuous#567), which made KurrentDB reads truly streaming and added the
ReadStreamToEndextension.skills/eventuous-dotnet: new "Reading Event Streams" section — read semantics per store,ReadStreamToEndexample,pageSize/failIfNotFoundoptions,ReadStreamas the array variantskills/eventuous-dotnet-kurrentdb: note thatKurrentDBEventStorereads hold at most one deserialized event at a time, pointer toReadStreamToEndagents/eventuous-expert: new opinionated default — read whole streams withReadStreamToEnd, neverReadEventswithint.MaxValueLeft the plugin version in
.claude-plugin/plugin.jsonuntouched — bump it if this should ship as a release.🤖 Generated with Claude Code