GH-4838: WolverineFx.InMemory - Wolverine over the in-memory prototyping store - #4844
Merged
Merged
Conversation
…Memory prototyping store - New package src/Persistence/Wolverine.InMemory: one frame provider implementing both IPersistenceFrameProvider and IEventSourcingFrameProvider, registered via InsertFirstPersistenceStrategy; session / aggregate / document / query frames - opts.UseInMemoryStoreForPrototyping(...) registers the store and the extension - Store-agnostic usage only: [WriteModel]/[ReadModel]/[DeciderFunction], Storage.StartStream / AppendEvents, [Entity], IStorageAction<T>, [All]/[FirstOrDefault]/[Queryable], sagas; messaging on NullMessageStore (no durable inbox/outbox) - JasperFx pins 2.80.2 -> 2.81.0, plus JasperFx.Events.InMemory 2.81.0 - InMemoryTests (16 tests) run in the CIFisher job; package added to the pack list Closes #4838 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
JasperFx 2.81.0's SourceWriter no longer emits stray blank lines (#956), so the codegen-drift gate saw 43 committed files out of date after the pin bump. Regenerated with `codegen write` from each project's own directory; the diff is blank-line removals only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Closes #4838. Part of JasperFx/jasperfx#962.
This adds a new package, WolverineFx.InMemory (
src/Persistence/Wolverine.InMemory). It runs Wolverine over theJasperFx.Events.InMemoryprototyping store that shipped in JasperFx 2.81.0, so a stub-first application's handlers run before anyone has chosen Marten, Polecat or Fisher.Scope
This follows Jeremy's decisions on #4838 and #962.
Only Wolverine's store-agnostic usage is supported:
[WriteModel],[ReadModel]and[DeciderFunction];Storage.StartStreamandStorage.AppendEvents;[Entity],IStorageAction<T>, and[All]/[FirstOrDefault]/[Queryable];IDocumentSessionOperations,IDocumentWriteOperations,IDocumentReadOperations,IEventStoreOperationsandIEventOperations.Deliberately left out:
[WriteAggregate];NullMessageStore; the session commits on its own and outgoing messages are flushed after it.The JasperFx registration's guardrails carry through. The host logs a warning on start and refuses to start in
Productionunless you opt in.Shape
The package is modelled on
Wolverine.Fisher, but much smaller:InMemoryPersistenceFrameProviderimplements bothIPersistenceFrameProviderandIEventSourcingFrameProvideron one class, registered throughInsertFirstPersistenceStrategy.CanApplymatches the writable contract types andIEventStream<>, but not the read-only ones.SaveChangesAsync,FetchForWriting/FetchForExclusiveWriting/FetchLatest, document load / store / delete, the storage-action applier, and the query frames.InMemorySessionFactoryopens the session for the message's tenant and copies the correlation and causation ids onto it.UseInMemoryStoreForPrototyping(this WolverineOptions, Action<InMemoryStoreOptions>?)callsAddInMemoryStoreForPrototypingand includes the extension. The name is deliberately awkward, to match the JasperFx side.JasperFx pins move 2.80.2 → 2.81.0 (
JasperFx,JasperFx.Events,JasperFx.Events.SourceGenerator,JasperFx.SourceGenerator), andJasperFx.Events.InMemory2.81.0 is added.Tests:
src/Persistence/InMemoryTests, 16 tests, all greenagnostic_model_attributesuses the same handlers asFisherTests,MartenTestsandPolecatTests. It covers:[WriteModel]appends;[DeciderFunction];[ReadModel]not advancing the stream;FetchForWritingfailing and appending nothing;NullMessageStore.storage_side_effectscovers:StartStreamandAppendEvents;[Entity]withStorage.Insert/Update/Delete;[All];IDocumentSessionOperationsand is committed byAutoApplyTransactions.saga_lifecyclecovers start, update, and complete-then-delete.production_guardchecks that the Production refusal still fires throughUseWolverine.The source generator comes only through the package. The test project has no explicit
JasperFx.Events.SourceGeneratorreference: the generator arrives fromJasperFx.Events.InMemory's bundled analyzer throughWolverine.InMemory, which is the path a real application takes.The test project references
Wolverine.RuntimeCompilation, because dynamic codegen needs it (GH-2876). An application prototyping on this store needs it too, and the docs will have to say so.Wiring
wolverine.slnxunder/Persistence/InMemory/.Wolverine_InMemoryis inNugetProjects, whichValidatePackListenforces.CIFisheralso builds and runsInMemoryTests. Both are containerless, and the in-memory suite takes seconds, so it doesn't justify a runner of its own.Not in this PR
ims-swap-gateon the Stoat plan): a stub-first sample green on the in-memory store, then on Marten, with no handler changes.Local verification
dotnet build wolverine.slnx -c Release -f net9.0: succeeded: 229 projects, 0 errors, 0 warningsInMemoryTests: 16/16 on net9.0.🤖 Generated with Claude Code