Fix event type resolver usage mismatch#1946
Open
mpraglowski wants to merge 9 commits into
Open
Conversation
Client#publish routes via event.event_type instead of the configured event_type_resolver, so a resolver whose output differs from event.event_type never matches its own subscriptions. AggregateRoot::DefaultApplyStrategy has the same split: on-DSL registers handlers via event_type_resolver, apply looks them up by event.event_type.
Client#publish and AggregateRoot::DefaultApplyStrategy now resolve the published/applied event's type via the configured event_type_resolver (passing event.class, matching the subscribe/on registration side) instead of reading event.event_type directly. A resolver whose output differs from event.event_type now matches its own subscriptions and aggregate handlers. Default resolver (to_s) is unchanged.
Dispatch routes by event_type_resolver.call(event.class), not by event.event_type (which honors metadata[:event_type]). This documents the deliberate choice: subscribe and dispatch share one key derived from the resolver, so metadata overrides no longer silently misroute published events.
…event_type AggregateRoot now derives the handler key from event.event_type on the apply path and from value.to_s at on-DSL registration, instead of an injected event_type_resolver. The event_type_resolver keyword is kept on AggregateRoot.with and DefaultApplyStrategy.new for backward compat but is ignored and emits a deprecation warning when passed.
Add specs covering the branches mutant found alive: - no deprecation warning on the default path (both AggregateRoot.with and DefaultApplyStrategy.new) - deprecation key is suppressible (locks the warn key, not just the message) - on-DSL registration key derives from the event class name AggregateRoot mutation coverage back to 100%.
Deprecate it instead
fidel
force-pushed
the
event-type-resolver-dispatch-mismatch
branch
from
July 16, 2026 16:19
b392ebc to
3c734e3
Compare
mpraglowski
marked this pull request as ready for review
July 17, 2026 10:51
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.
No description provided.