GH-3627: document [StreamState] and [StreamEvents] - #4121
Merged
Conversation
These shipped in 6.30 with no documentation at all. Adds the store-agnostic treatment to the persistence helpers guide, an HTTP-side section next to [ReadAggregate], and worked samples. The identity convention gets a callout because it is genuinely surprising: [Entity] Order infers "OrderId" from the parameter's own type, but the parameter type here is StreamState -- the store's vocabulary, not the aggregate -- so the "<ParameterType>Id" rule looks for "StreamStateId" and only a member literally named "Id" resolves without help. Verified: a miss throws InvalidEntityLoadUsageException at bootstrap. Also adds the message-handler test coverage that path never had. Only the HTTP side was tested, and the handler side is where the identity convention bites. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This was referenced Aug 27, 2026
Open
This was referenced Sep 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[StreamState]and[StreamEvents]shipped in 6.30 with no documentation anywhere — nothing underdocs/guidementioned them. This fills that in.What's added
docs/guide/handlers/persistence.md— a### Raw Stream Readssection under Event Sourced Models, which is where the store-agnostic vocabulary lives. Two new rows in the vocabulary table at the top.docs/guide/http/marten.md— a section next to[ReadAggregate], reusing thesample_using_streamstate_and_streamevents_in_httpregion that already existed inOrders.cs.EventSourcedModelSamples.cs— three new worked samples.MartenTests/stream_state_and_events_handlers_3627.cs— message-handler coverage this path never had.The identity convention gets a callout
This is the part worth reviewing.
[Entity] Order ordercan infer an identity member namedOrderId, because the parameter's own type names your entity. The parameter type for these attributes isStreamState— the store's vocabulary, not your aggregate — sotryFindIdentityVariablelooks for"StreamStateId", and in practice only a member literally namedIdresolves without help.Verified rather than reasoned about. A handler taking
ProbeFindByOrderId(Guid OrderId)with a bare[StreamState]fails at bootstrap:Fails fast rather than silently, which is the important part. (Minor observation, not addressed here: the message renders the variable name as empty quotes, so it does not name the member it looked for.)
Why a test came with the docs
Only the HTTP path had coverage (
Wolverine.Http.Tests/Marten/stream_state_and_events_3627.cs), and its endpoints use a{id}route argument — which happens to be exactly the case the convention handles. The handler path, where the convention bites, had none. The new test pins both theIdconvention and the explicit[StreamState("AggregateId")]form.Verification
dotnet build wolverine.slnx -c Release -f net9.0— clean, 0 warningsmdsnippetsrun; unrelated pre-existing snippet drift in 84 other files was reverted rather than swept into this PR🤖 Generated with Claude Code