Repository navigation
Add analyser to visualize the event sourced domain - #35
Open
DavidBadura wants to merge 4 commits into
Open
DavidBadura wants to merge 4 commits into
DavidBadura wants to merge 4 commits into
Conversation
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.
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 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
eventSourcingGraphvizandeventSourcingJsonerror 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 foralom/graphvizanymore.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.
srcis now analysed by PHPStan too. There is also a separate fix fornoRecordThatWhenApplying: 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.