docs: improve persistence pages with examples and state store#517
docs: improve persistence pages with examples and state store#517alexeyzimarev merged 2 commits intodevfrom
Conversation
…event streams - Add usage examples to event-store.md: appending, multi-stream append, reading, stream management, and aggregate load/store - Add new state-store.md page documenting LoadState extension methods on IEventReader - Rename "Aggregate stream" to "Event streams" and rewrite to be state-centric rather than aggregate-centric (StreamName.For<T>, StreamName.ForState<TState>, Id instead of deprecated AggregateId) - Fix relative links in next/ version that incorrectly escaped the next/ directory - Apply changes to both v0.16 (stable) and next (preview) versions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Review Summary by QodoEnhance persistence documentation with examples and state store guide
WalkthroughsDescription• Renamed "Aggregate stream" to "Event streams" with state-centric focus • Added comprehensive usage examples to event store documentation • Created new state store page documenting LoadState extension methods • Updated identity references from AggregateId to Id throughout • Applied all changes to both v0.16 stable and next preview versions Diagramflowchart LR
A["Event Streams Page"] -- "renamed & rewritten" --> B["State-centric focus"]
C["Event Store Page"] -- "added examples" --> D["Append/Read/Manage operations"]
E["New State Store Page"] -- "documents" --> F["LoadState extension methods"]
B --> G["StreamName.For & ForState"]
D --> H["Multi-stream append & management"]
F --> I["FoldedEventStream return type"]
File Changes1. docs/src/content/docs/next/persistence/aggregate-stream.md
|
Code Review by Qodo
1. BookingId examples mismatch
|
| var result = await eventReader.LoadState<BookingState, BookingId>( | ||
| streamNameMap, | ||
| new BookingId("123"), | ||
| cancellationToken: cancellationToken | ||
| ); |
There was a problem hiding this comment.
1. Bookingid examples mismatch 🐞 Bug ✓ Correctness
The state-store page shows new BookingId("123"), but the event-streams page defines BookingId
with a (string id, string tenantId) constructor; combining these docs examples won’t compile. This
breaks copy/paste learning paths across the new persistence pages.
Agent Prompt
### Issue description
`BookingId` is shown with a 2-arg constructor in the event-streams doc, but instantiated with a 1-arg call in the state-store doc. Readers combining the examples will hit a compile error.
### Issue Context
These pages are meant to be used together; identity examples should be consistent.
### Fix Focus Areas
- docs/src/content/docs/next/persistence/state-store.md[40-52]
- docs/src/content/docs/persistence/state-store.md[40-52]
- docs/src/content/docs/next/persistence/aggregate-stream.md[38-46]
- docs/src/content/docs/persistence/aggregate-stream.md[38-46]
### Suggested change options
Option A (recommended): In state-store.md, use the same multi-tenant identity shape:
- Change `new BookingId("123")` to `new BookingId("123", "tenant-1")` (and optionally add a comment explaining it).
Option B: Keep state-store.md single-arg identity and adjust aggregate-stream.md to show a simple `BookingId(string value) : Id(value)` example instead, moving multi-tenant identity to a separate explicitly-labeled example.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bca2c71e9f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| | `ReadEvents` | Read events from a stream forwards, from a given start position. | | ||
| | `StreamExists` | Check if a stream exists. | | ||
| | `TruncateStream` | Remove events from a stream up to a given position. | | ||
| | `DeleteStream` | Delete a stream entirely. | |
There was a problem hiding this comment.
Mark DeleteStream as unsupported on SQL-backed stores
This row documents DeleteStream as a normal event-store operation, but the SQL stores listed as supported on the same page (PostgresStore, SqlServerStore, SqliteStore) inherit SqlEventStoreBase.DeleteStream, which currently throws NotImplementedException (src/Relational/src/Eventuous.Sql.Base/SqlEventStoreBase.cs:253-254) and do not override it. Users following this guidance on those backends will hit runtime failures, so the docs should call out that DeleteStream is store-specific (or not yet available for SQL stores).
Useful? React with 👍 / 👎.
Summary
StreamExists,TruncateStream,DeleteStream), and aggregate load/store via extension methodsLoadStateextension methods onIEventReader— loading state by stream name, loading by typed identity withStreamNameMap, theFoldedEventStream<TState>return type, and how it underpins both command service variantsStreamName.For<T>(unconstrained),StreamName.ForState<TState>, usesIdinstead of deprecatedAggregateId, notes applicability to both aggregate-based and functional command servicesnext/version that incorrectly escaped thenext/directoryAll changes applied to both v0.16 (stable) and next (preview).
Test plan
pnpm buildpasses (140 pages)🤖 Generated with Claude Code