Produce assertion suggestions about missing aggregate "apply" logic.
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 1
- Forks
- 1
- Avg merge
- 2m
- Merged PRs (30d)
- 1
Description
This change is about suggesting to the user that they confirm that a given message type is properly handled in an implementation of dogma.AggregateRoot.ApplyEvent().
On more than one occasion @koden-km has encountered legitimate bugs due to missing code paths in this method.
Some of the ways such bugs manifest themselves include:
- Events with missing or incorrect data - This happens when a value from the aggregate's state is in some produced event, but the value had never been set in the first place.
- Unexpected events being produced - This happens when an event is conditionally produced based on some state within the aggregate root, but that state has not been set.
- Expected events not being produced - As above with inverted logic.
This branch has been retained as an example of broken tests that fail due to such an issue.
The logic for deciding when to suggest that a user check their ApplyEvent() logic could be as follows:
- one of the assertion failures describe above has occurred
- events of that type are expected to come from an aggregate
- that aggregate type has been engaged during the test
- any call to
ApplyEvent()for that aggregate did not actually alter the aggregate state
This may require additional new features allowing the user to configure how aggregate roots are compared.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the issue's conditions for suggesting missing ApplyEvent() logic and inspect the retained broken example at customer/customer.go on the linked branch. Trace how assertion failures, expected event types, aggregate engagement, and ApplyEvent() state changes can be observed. Done means the testkit provides appropriate suggestions for these cases, with any required aggregate-root comparison configuration covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100