Repository navigation
GH-6117: describe-routing and describe show the local queues of locally handled messages - #6121
Conversation
…ly handled messages The diagnostic commands start the host lightweight (metadata-only), which forces DurabilityMode.MediatorOnly. That branch of StartAsync never started the messaging transports, so LocalTransport.DiscoverListeners never assigned the local queues and LocalRouting found no route for any message type with a single, unbound handler chain. HandlerGraph.CanHandle was already true; the handler graph was not the problem. The lightweight start now remembers the durability mode the application asked for and, when that mode runs local queues (Balanced or Solo), runs the same listener discovery a real start does and compiles the local queues so endpoint policies such as UseDurableLocalQueues() are described. External transports stay stubbed and nothing starts. An application that is MediatorOnly, or has conventional local routing disabled, still describes no local routes. describe-routing's Resolution column no longer labels every conventional local route as "Explicit local routing": LocalTransport records the message types given a queue with LocalQueueFor<T>() or IConfigureLocalQueue. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟡 Changes recommended
Diagnostics can mislabel convention-generated handler queues as explicitly routed and incorrectly discover local queues using a durability mode captured before async configuration.
2 open issues
What changed in this PR
Addresses #6117 by making Wolverine’s routing diagnostics discover local queues during lightweight startup.
Changes:
- Discovers and compiles local queues so diagnostics reflect routing and endpoint policies.
- Tracks explicit queue configuration separately from conventional routing.
- Adds regression coverage for lightweight diagnostics and routing parity.
| File | Description |
|---|---|
| src/Wolverine/Transports/Local/LocalTransport.cs | Tracks explicitly configured message types. |
| src/Wolverine/Runtime/WolverineRuntime.HostService.cs | Discovers and compiles local queues during lightweight startup. |
| src/Wolverine/Diagnostics/WolverineDiagnosticsCommand.cs | Distinguishes explicit routing from conventions. |
| src/Testing/CoreTests/Diagnostics/WolverineDiagnosticsCommandTests.cs | Updates a comment to reference new coverage. |
| src/Testing/CoreTests/Diagnostics/describe_routing_shows_local_queues_6117.cs | Adds routing diagnostics regression tests. |
Review effort: Balanced
| if (options.LocalRouting.Assignments.TryGetValue(messageType, out _)) | ||
| // Check for explicit local queue assignment. GH-6117: the local routing convention assigns every | ||
| // locally handled message type a queue too, so the assignment alone does not make it explicit | ||
| if (options.LocalRouting.ExplicitlyConfiguredMessageTypes.Contains(messageType)) |
There was a problem hiding this comment.
Fixed in 8690dc0: "Explicit local routing" now also requires the route destination to be the explicitly configured queue, so the handler-type queues of a message with several handler types read "Local handler convention". Test: an_explicit_queue_for_a_message_with_several_handler_types_does_not_make_their_routes_explicit.
|
|
||
| private void applyLightweightMode() | ||
| { | ||
| _applicationDurabilityMode ??= Options.Durability.Mode; |
There was a problem hiding this comment.
Fixed in 8690dc0: during a lightweight start the async extensions run against the application's own mode, the mode they leave is what the description uses, and the start goes back to MediatorOnly afterwards. Tests: an_async_extension_that_chooses_mediator_only_leaves_no_local_routes, an_async_extension_sees_the_application_mode_and_the_lightweight_start_stays_mediator_only (both red before the change).
…p convention routes off "Explicit" Review follow-ups on the lightweight-start routing description: - An IAsyncWolverineExtension may choose the durability mode. In a lightweight start it now sees and changes the application's own mode rather than the forced MediatorOnly; the lightweight start keeps what it chose for describing the routing, then forces MediatorOnly again. An extension that picks MediatorOnly therefore describes no local routes, as a real start of that application gets none. - With several handler types, LocalQueueFor<T>() configures the message type's queue, which nothing routes to. describe-routing's Resolution column only says "Explicit local routing" when the route's destination is that explicitly configured queue. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Closes #6117
Root cause
Not the handler graph:
HandlerGraph.CanHandleis already true when the diagnostics ask (the host is started andHandlerGraph.Compile()has run).describe-routing,codegen-previewanddescribestart the host in metadata-only (lightweight) mode:DynamicCodeBuilder.WithinCodegenCommand, orStartLightweightAsync()fordescribe. That mode forcesDurabilityMode.MediatorOnly, and theMediatorOnlybranch ofWolverineRuntime.StartAsyncnever callsstartMessagingTransportsAsync(), sodiscoverListenersFromConventions()and with itLocalTransport.DiscoverListeners()never ran.LocalTransport.Assignmentsstayed empty, andLocalTransport.DiscoverSenders()-- whatLocalRouting.FindRoutesasks onceCanHandleis true -- returned nothing. Every locally handled message with a single, unbound handler chain described as "No routes". A message type with several handler types already described correctly, because those chains are bound to their own queues during compile; explicitly routed messages (the sample'sToolFinished) were never affected.The existing diagnostics test even recorded the gap ("in MediatorOnly (lightweight) mode, local routing assignments are not populated, so runtime.RoutingFor() returns no routes").
Fix
MediatorOnly.discoverListenersFromConventions()). External transports are stubbed in lightweight mode, so only the local queues are assigned; no listener or sending agent starts.UseDurableLocalQueues()show in the Mode and Outbox columns. Without it the sample's durable queues described asBufferedInMemory.describe-routing's Resolution column labelled any local route whose message type had a queue assignment as "Explicit local routing". Now that the convention assigns queues in lightweight mode too, that would have been every route, soLocalTransportrecords the message types given a queue withLocalQueueFor<T>()orIConfigureLocalQueue, and the rest read "Local handler convention".IAsyncWolverineExtensionmay choose the durability mode. In a lightweight start it now sees and changes the application's own mode instead of the forcedMediatorOnly; the lightweight start keeps what it chose for the description, then forcesMediatorOnlyagain (review follow-up).LocalQueueFor<T>()configures the message type's queue, which nothing routes to, so "Explicit local routing" now also requires the route's destination to be that queue (review follow-up).MediatorOnly, or that disabled conventional local routing, still describes no local routes, because it gets none at run time.describe's Message Routing table anddescribe-routing(including--all,--explainand--json) all go throughIWolverineRuntime.RoutingFor/ExplainRoutingFor, so the one fix covers all of them.Tests
CoreTests.Diagnostics.describe_routing_shows_local_queues_6117, written first and red before the fix:NameQueuesByHandlerType()queues are describedUseDurableLocalQueues(), like the issue's sample)ExplainRoutingForshowsLocalRoutingproducing the local queuedescribe'sStartLightweightAsync()path shows the local queueUseDurableLocalQueues()appliedLocalQueueFor<T>()LocalQueueFor<T>()on a message with several handler types leaves their routes "Local handler convention"MediatorOnlyleaves no local routes; an extension sees the application's mode, and the lightweight start staysMediatorOnlyMediatorOnlyapplication and one with conventional local routing disabled still show no local routesAlso checked by hand against CritterStackSamples
SagasVsDurableWorkflows/SagaWorkflows(the issue's repro, atceea67a) built against this branch:describe-routing BookFlightshowslocal://sagaworkflows.tripbooking.bookflight/, Durable, outbox, "Local handler convention";--explainshowsLocalRoutingproducing it andFINAL ROUTES: 1;--allanddescribe's Message Routing table list the local queues, with "No routes" left only on types nothing handles.6.x
The 6.0 branch has the same code path (
case DurabilityMode.MediatorOnly: break;and the same test note), so 6.x has the same bug. Not backported here.🤖 Generated with Claude Code