feat: event upcaster registration extension point (ADR-010 follow-up, ADR-090) - #268
Merged
Merged
Conversation
… ADR-090) Ships the consumer-side mechanism ADR-010 promised: IEventUpcaster<TSource, TTarget> + AddEventUpcaster<...>() (TryAddEnumerable idiom) assembled into a chaining EventUpcasterRegistry that walks retired contracts to their terminal type, preserves MessageId/DateOccurred across every hop, and fails startup on duplicate sources, self-maps or cycles. Both delivery paths consult it: DomainEventDispatcher upcasts before selecting integration handlers, and broker hosts drain retired types via RegisterUpcastedIntegrationEventConsumer backed by the new UpcastingIntegrationEventConsumer. Two new fitness functions on EventConventionTestsBase gate upcaster shape (unique source types; strictly increasing SchemaVersion). 35 new tests; FACTS regenerated. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016usKhixm2drfHmwmmmqwbn
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.
Ships the consumer-side mechanism ADR-010 named as follow-up work: the event upcaster registration extension point.
What's new
IEventUpcaster/IEventUpcaster<TSource, TTarget>(Application): a pure payload mapping from a retired integration-event contract to its successor; the non-generic members come from default interface implementations so authors write one method.EventUpcasterRegistry: indexes by source type, follows chains (V1 -> V2 -> V3) by declared target type, preservesMessageId/DateOccurredacross every hop (inbox dedup keys survive by construction), and throws at construction, naming the offenders, on duplicate sources, self-maps, or cycles. An internal hosted service resolves it at host start so misconfiguration fails startup, not the first message.services.AddEventUpcaster<TSource, TTarget, TUpcaster>(): TryAddEnumerable idiom (same shape asAddScheduledJob), accumulates across modules.DomainEventDispatcherupcasts before selectingIIntegrationEventHandler<>(covers monolith mode and pre-upgrade outbox rows; domain-handler dispatch untouched), and broker hosts drain a retired contract viaRegisterUpcastedIntegrationEventConsumer<TOld>()backed by the new dedicatedUpcastingIntegrationEventConsumer<TOld>(existing consumer hot path and shipped ctor untouched).EventConventionTestsBase, inherited by every consumer tree with no edit: unique upcaster source types, and targetSchemaVersionstrictly higher than source. Pass trivially at zero upcasters.Deliberately out of scope (recorded in ADR-090)
Outbox type-name aliasing for prematurely deleted types; producer-side rewriting of old rows.
Verification
dotnet build MMCA.Common.slnx -c Release: 0 warnings, 0 errors (TWAE + five analyzers + PublicAPI gate; all new public symbols baselined in PublicAPI.Unshipped).--checkclean.Companion docs PR: ivanball/ivanball.github.io#120 (ADR-090 + ADR-010 addendum). Additive change; release + consumer pin sweep will follow later via the normal /push-release flow (minor bump).
🤖 Generated with Claude Code
https://claude.ai/code/session_016usKhixm2drfHmwmmmqwbn