Database queue Uris sanitize the queue name like the fluent API does - #3865
Merged
Merged
Conversation
A queue reached only by Uri — e.g. ListenForMessagesFrom(new Uri("sqlserver://my-service-control")),
which is exactly what Wolverine.CritterWatch's systemControlUri does — bypassed the fluent API's
MaybeCorrectName and carried the raw host into SqlServerQueue/PostgresqlQueue/SqliteQueue/MySqlQueue,
where it is interpolated into the wolverine_queue_* table names. A dash in the name then produced
invalid, unquoted DDL at auto-provision time:
CREATE TABLE myapp_cw_control.wolverine_queue_my-service-control ( ... )
findEndpointByUri in all four database transports now runs the host through SanitizeIdentifier,
matching the Oracle transport's GH-3820 correction. SanitizeIdentifier rather than MaybeCorrectName
because a Uri built from an already-corrected name carries any IdentifierPrefix, which
MaybeCorrectName would prepend a second time; SanitizeIdentifier is idempotent, so fluent-registered
queues resolve to the same endpoint they always did (covered by the new resolve-to-same-endpoint
tests). The NServiceBus/MassTransit interop transports keep their own verbatim findEndpointByUri
overrides — foreign endpoint names are matched exactly by design.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Aug 7, 2026
This was referenced Aug 14, 2026
This was referenced Aug 24, 2026
Closed
This was referenced Aug 31, 2026
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.
The bug (field report via CritterWatch)
fails at auto-provision time with invalid SQL — the dash reaches the queue table DDL unbracketed:
Root cause
The fluent API (
ListenToSqlServerQueue/ToSqlServerQueueand siblings) runs queue names throughMaybeCorrectName→SanitizeIdentifier(dash → underscore, lowercase). But a queue reached only by Uri (ListenForMessagesFrom(uri), publish-to-uri, etc.) resolves throughfindEndpointByUri, which did a rawQueues[uri.Host]— and the ctor of each database queue interpolates that raw name straight into thewolverine_queue_*table names. Same asymmetry in the SQL Server, PostgreSQL, SQLite, and MySQL transports.The fix
findEndpointByUriin all four transports now runs the host throughSanitizeIdentifier, extending the Oracle transport's GH-3820 correction (which fixed the same lookup for casing) to its siblings.SanitizeIdentifierrather thanMaybeCorrectName: a Uri built from an already-corrected name carries anyIdentifierPrefix, whichMaybeCorrectNamewould prepend a second time.SanitizeIdentifieris idempotent, so fluent-registered queues resolve to the same endpoint they always did — covered by the new resolve-to-same-endpoint tests in each transport's suite.The NServiceBus/MassTransit interop transports keep their own verbatim
findEndpointByUrioverrides — foreign endpoint names are matched exactly by design, so they are deliberately untouched.Tests
New endpoint-resolution tests (no database needed) in SqlServerTests, PostgresqlTests, SqliteTests, and MySqlTests: a dashed Uri resolves to the sanitized queue name, and the dashed Uri, the fluent-corrected name, and the queue's own round-tripped Uri all resolve to the same endpoint (no second endpoint minted over the same tables). All pass on net9.0 + net10.0.
🤖 Generated with Claude Code