Repository navigation
Upgrade to event-sourcing 4.0 and infer state types of Decision::read() - #34
Merged
Merged
Conversation
The 2.0 line targets event-sourcing 4.0, the 1.x line stays for 3.x. Child aggregates are gone in 4.0, so the rules only check aggregate roots now, and the identifiers moved to the Identifier namespace.
patchlevel/event-sourcing#937 added the Decision for the dynamic consistency boundary. Reading an array of projections now becomes an array shape with the state type of each projection, a single projection its state type. The state type is taken from the projection generic and falls back to the return type of initialState(). ProjectionBuilder::build() is typed the same way again, it was dropped together with the other DCB parts while they only existed in 4.0.
DavidBadura
force-pushed
the
decision-read
branch
from
October 18, 2026 07:27
b6167e4 to
2a21243
Compare
DanielBadura
approved these changes
Oct 18, 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.
This moves the 2.0 line to event-sourcing 4.0 (the 1.x line stays for 3.x) and brings the DCB parts back, which were removed from 2.0.x while they only existed in 4.0.
The first commit is the upgrade itself. Child aggregates are gone in 4.0, so the rules only look at aggregate roots now and the child aggregate fixtures are removed. The identifiers moved to the
Identifiernamespace, which touches the fixtures and the docs samples.The second commit adds the type inference for patchlevel/event-sourcing#937, which replaced the decision model builder with a
Decision:Without the extension the array form is only
array<K, mixed>. A single projection is already typed natively through the projection generic, the extension covers it too and falls back to the return type ofinitialState(), so projections without@extends BasicProjection<...>get their type as well.ProjectionBuilder::build()is typed the same way. Both are always on, they don't report anything, so they have no configuration switch. The docs get a "Typed decisions" section.