Repository navigation
Strong-typed aggregate ids in a Native AOT image, on JasperFx 2.80.2 (#412) - #427
Merged
Merged
Conversation
…412) The last item of #412. A projection over a strong-typed aggregate id used to be closed with MakeGenericType, which has no native code for a readonly record struct, and JasperFx's projection base then compiled the wrapper's accessors with FastExpressionCompiler. - Projections.Snapshot<T, TId>(), a composite Snapshot<T, TId>() and Projections.LiveStreamAggregation<T, TId>() record a statically closed factory on the event graph (SingleStreamProjectionFactory.Declare). Live aggregation, Snapshot<T> and composites consult it before falling back to MakeGenericType. The id type is checked against the identity member. An undeclared wrapper is still refused by name in a native image, now naming the two registrations. - JasperFx 2.80.2 carries jasperfx#950 (written and verified from here), which stops IEvent / StreamAction.CreateAggregateIdentitySource from CompileFast()ing for a wrapper id. Together with jasperfx#942 that is what JasperFxSingleStreamProjectionBase needed. - smoke/aot-consumer snapshots, live-aggregates and FetchForWritings a PodId aggregate, and folds a live-only ShoalId aggregate, natively. On 2.80.1 the same image threw from the projection constructor. - docs/configuration/native-aot.md gets a compiled sample. Live aggregation leaving a strong-typed Id at its default is pre-existing and not AOT-specific; filed as #426. Closes #412 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
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 #412, finishing its last item (items 2 and 3 shipped in #421).
What changed
Projections.Snapshot<T, TId>(), a compositeSnapshot<T, TId>(), andProjections.LiveStreamAggregation<T, TId>()close a strong-typed aggregate's projection while both types are still generic arguments. Each records a factory on the event graph that live aggregation,Snapshot<T>and composites all consult before falling back toMakeGenericType. This is Native AOT: strong-typed id wrappers and document hierarchies still build their storage reflectively #386's pattern for documents, one layer over.readonly record structhas no shared instantiation forMakeGenericType. The message now names the two registrations.native-aot.md, plus CLAUDE.md and HANDOFF.Verification
PodIdaggregate snapshots inline, live-aggregates, andFetchForWritings byPodId, and a live-onlyShoalIdaggregate folds. On 2.80.1 the same image threwPlatformNotSupportedExceptionfrom the projection constructor.check_scoreboard.pyagrees for both TFMs; leak check clean.Not in scope: live aggregation leaves a strong-typed
Idat its default. It's pre-existing (it reproduces on 2.80.1 under the JIT), filed as #426. The smoke asserts the folded state only.🤖 Generated with Claude Code