Repository navigation
Improve validations for explicit topologies - #9986
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR strengthens “explicit topology/bind” behavior in Mocha by adding centralized validation for unbound inbound routes, improving exception diagnostics, and refining transport routing/topology discovery (notably for RabbitMQ) to better honor explicit binding semantics.
Changes:
- Add a build-time validator that aggregates and formats all unbound inbound routes into a single actionable
InvalidOperationException(with transport/endpoint hints), plus snapshot coverage. - Ensure reply inbound routes are bound to the reply receive endpoint during endpoint discovery.
- Refine RabbitMQ topology discovery to avoid declaring convention publish/send exchange chains when endpoints are in explicit bind mode; improve endpoint bind-mode inheritance behavior.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Mocha/test/Mocha.Transport.RabbitMQ.Tests/Descriptors/RabbitMQHandlerBindingTests.cs | Tighten explicit-bind failure assertions to validate the new aggregated error message content. |
| src/Mocha/test/Mocha.Transport.Postgres.Tests/Descriptors/PostgresHandlerBindingTests.cs | Same as RabbitMQ: validate explicit-bind failures include the expected diagnostics. |
| src/Mocha/test/Mocha.Tests/MessageTypes/MessageBusConfigurationValidationTests.cs | New test coverage for aggregated validation messaging + saga reply route binding behavior (with snapshots). |
| src/Mocha/test/Mocha.Tests/MessageTypes/snapshots/MessageBusConfigurationValidationTests.Build_Should_ReportNoTransportHint_When_HandlerRegisteredWithoutTransport.snap | Snapshot for “no transport configured” validation hint. |
| src/Mocha/test/Mocha.Tests/MessageTypes/snapshots/MessageBusConfigurationValidationTests.Build_Should_ReportAlsoBoundElsewhere_When_SameMessageHasAnotherBoundRoute.snap | Snapshot for “also bound elsewhere” hint. |
| src/Mocha/test/Mocha.Tests/MessageTypes/snapshots/MessageBusConfigurationValidationTests.Build_Should_ReportAllUnboundInboundRoutes_When_ExplicitBindLeavesHandlersUnbound.snap | Snapshot for multiple unbound routes under explicit bind mode. |
| src/Mocha/test/Mocha.Tests/MessageTypes/snapshots/MessageBusConfigurationValidationTests.Build_Should_NotUseReplyRouteAsDuplicate_When_NormalRouteWithSameMessageIsUnbound.snap | Snapshot ensuring reply routes don’t count as duplicates for validation hints. |
| src/Mocha/src/Mocha/Transport/RoutingStrategy.cs | Bind all existing reply inbound routes to the reply receive endpoint when available. |
| src/Mocha/src/Mocha/ThrowHelper.cs | Improve route-not-connected exceptions with richer context; remove the RabbitMQ-specific auto-bind helper. |
| src/Mocha/src/Mocha/MessageTypes/OutboundRoute.cs | Use the new contextual ThrowHelper.RouteEndpointNotConnected(OutboundRoute) overload. |
| src/Mocha/src/Mocha/MessageTypes/InboundRoute.cs | Use the new contextual ThrowHelper.RouteEndpointNotConnected(InboundRoute) overload. |
| src/Mocha/src/Mocha/Builder/MessageBusBuilder.Validation.cs | New centralized validator + formatted diagnostics for unbound inbound routes. |
| src/Mocha/src/Mocha/Builder/MessageBusBuilder.cs | Invoke the new validator during build prior to completing inbound routes. |
| src/Mocha/src/Mocha.Transport.RabbitMQ/Topology/RabbitMQRoutingStrategy.cs | Adjust convention topology discovery to better respect explicit bind mode; update dispatch provisioning behavior. |
| src/Mocha/src/Mocha.Transport.RabbitMQ/Descriptors/RabbitMQReceiveEndpointDescriptor.cs | Stop forcing receive endpoint bind mode to implicit (allow inheritance). |
| src/Mocha/src/Mocha.Transport.RabbitMQ/Descriptors/RabbitMQMessagingTransportDescriptor.cs | Stop defaulting queue bind mode to implicit; allow null to inherit from transport bind mode. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…r explicit binding - Updated snapshots to reflect changes in RabbitMQ topology behavior when explicit bindings are used. - Removed unnecessary exchanges and bindings from snapshots to align with the new explicit binding logic. - Adjusted test descriptions for clarity regarding the behavior of explicit bindings and their impact on convention entities. - Ensured that tests accurately reflect the expected state of the RabbitMQ topology when using explicit configurations.
This was referenced Jul 7, 2026
This was referenced Jul 14, 2026
This was referenced Jul 23, 2026
This was referenced Sep 1, 2026
[nuget][SUI_Matcher]- Bump the sui-package-updates group with 18 updates
DFE-Digital/SUI_Matcher#397
Closed
Closed
This was referenced Sep 15, 2026
Closed
[nuget][SUI_Matcher]- Bump the sui-package-updates group with 20 updates
DFE-Digital/SUI_Matcher#405
Closed
This was referenced Sep 22, 2026
Closed
Closed
[nuget][SUI_Matcher]- Bump the sui-package-updates group with 20 updates
DFE-Digital/SUI_Matcher#410
Merged
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.