Skip to content

Add analyser to visualize the event sourced domain - #35

Open
DavidBadura wants to merge 4 commits into
2.0.xfrom
analyser
Open

DavidBadura wants to merge 4 commits into
2.0.xfrom
analyser

Conversation

@DavidBadura

Copy link
Copy Markdown
Member

This moves the event-sourcing-analyser into the extension instead of keeping it as a separate package. It renders the domain as a Graphviz diagram inspired by Event Storming or exports it as JSON, via the new eventSourcingGraphviz and eventSourcingJson error formatters.

The analyser is disabled by default and enabled with patchlevelEventSourcing.analyser: true, so the collectors don't slow down regular runs or bloat the result cache. On top of what the old package did, it now understands handlers of the dynamic consistency boundary, linking commands to the events appended to the decision and the projections read from it. The DOT output is written by a small internal writer, so there is no need for alom/graphviz anymore.

While at it, the detection of aggregates, apply methods and property writes that was duplicated across the rules moved into shared helpers with unit tests, which needed PHPUnit as a new dev dependency. src is now analysed by PHPStan too. There is also a separate fix for noRecordThatWhenApplying: false, which had no effect because the service was tagged unconditionally.

Once this is released, the analyser package can be marked as abandoned in favour of this one.

The extension was tagged as restricted method usage extension in the
service definition as well, so the conditional tag never had an effect
and the rule stayed active with noRecordThatWhenApplying: false.
The rules each had their own copy of detecting aggregates, apply methods
and property writes. This moves that into two internal helpers, without
changing what the rules report, and covers them with unit tests. For that
PHPUnit is added, and src is now part of the PHPStan analysis as well.
This brings the event-sourcing-analyser into the extension. Collectors
gather aggregates, events, commands, subscribers, projections and Symfony
controllers, and two error formatters render them as a Graphviz diagram
inspired by Event Storming or as JSON. It is disabled by default, since
the collectors would otherwise run in every analysis, and is enabled with
the new analyser parameter.

Compared to the standalone package it also understands handlers of the
dynamic consistency boundary, so commands handled by a service are linked
to the events they append and the projections they read. The Graphviz
output no longer needs alom/graphviz.
The tests mixed stderr into the compared output, so the JIT warning the
PHP setup of the CI prints on startup ended up in front of the snapshot.
@DavidBadura DavidBadura added this to the 2.0.0 milestone Oct 18, 2026
@DavidBadura DavidBadura added the enhancement New feature or request label Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant