Skip to content

Add stable URN identities for various components in Mocha - #10035

Merged
PascalSenn merged 5 commits into
mainfrom
pse/improve-mocha-identities
Jul 6, 2026
Merged

PascalSenn merged 5 commits into
mainfrom
pse/improve-mocha-identities

Conversation

@PascalSenn

Copy link
Copy Markdown
Member
  • Introduced URN properties for ReceiveEndpoint, InboundRoute, OutboundRoute, MessageType, and Saga classes to provide stable identifiers.
  • Implemented HostInfoExtensions to derive effective service names.
  • Updated MochaUrn utility to generate URNs for new components.
  • Enhanced Saga initialization to assign URNs to states and transitions.
  • Added tests to validate URN generation and descriptions for various components.
  • Updated project dependencies to include System.IO.Hashing.

- Introduced URN properties for ReceiveEndpoint, InboundRoute, OutboundRoute, MessageType, and Saga classes to provide stable identifiers.
- Implemented HostInfoExtensions to derive effective service names.
- Updated MochaUrn utility to generate URNs for new components.
- Enhanced Saga initialization to assign URNs to states and transitions.
- Added tests to validate URN generation and descriptions for various components.
- Updated project dependencies to include System.IO.Hashing.
Copilot AI review requested due to automatic review settings July 2, 2026 09:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request introduces stable URN-based identities across Mocha’s messaging description model (transports, endpoints, routes, message types, consumers, saga states/transitions, and topology entities/links) so diagnostics/visualization can rely on consistent IDs across runs and environments.

Changes:

  • Add Urn/Id fields and propagate them through description records for transports, endpoints, routes, message types, consumers, sagas, and topology entities/links.
  • Introduce HostInfoExtensions.EffectiveServiceName and use it to scope URNs and (for in-memory) topology addresses to a stable service name.
  • Add a mediator description/URN model and snapshot tests validating URN generation across components.

Reviewed changes

Copilot reviewed 56 out of 56 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/Mocha/test/Mocha.Transport.RabbitMQ.Tests/Topology/RabbitMQMessagingTopologyTests.cs Adds test coverage for address-based topology entity/link IDs in RabbitMQ transport description.
src/Mocha/test/Mocha.Transport.Postgres.Tests/Topology/PostgresMessagingTopologyTests.cs Adds test coverage for address-based topology entity/link IDs in Postgres transport description.
src/Mocha/test/Mocha.Transport.Postgres.Tests/PostgresTransportTests.cs Updates transport description assertions for renamed/repurposed transport fields.
src/Mocha/test/Mocha.Transport.InMemory.Tests/Topology/InMemoryMessagingTopologyTests.cs Adds test coverage for address-based topology entity/link IDs in in-memory transport description.
src/Mocha/test/Mocha.Transport.InMemory.Tests/InMemoryTransportTests.cs Adds test verifying in-memory topology address/queue addresses are scoped by configured service name; updates describe assertions.
src/Mocha/test/Mocha.Tests/MessageTypes/OutboundRouteTests.cs Extends outbound route tests to assert stable URN generation (explicit + implicit destinations).
src/Mocha/test/Mocha.Tests/MessageBusChangeTokenSourceTests.cs Updates mutable test transport TransportDescription construction to match new signature and include URN ID.
src/Mocha/test/Mocha.Tests/Descriptions/MochaUrnTests.cs Adds unit tests validating URN formats and stability properties.
src/Mocha/test/Mocha.Tests/Consumers/snapshots/ConsumerBehaviorTests.Describe_Should_ReturnConsumerDescription_When_EventHandlerRegistered.snap Updates snapshot to include consumer Id URN.
src/Mocha/test/Mocha.Sagas.Tests/SagaInitializationTests.cs Adds saga initialization/description tests validating state/transition URN assignment and propagation.
src/Mocha/test/Mocha.Sagas.TestHelpers/TestMessagingSetupContext.cs Provides a usable Host for saga test initialization (instead of throwing).
src/Mocha/test/Mocha.Mediator.Tests/Mocha.Mediator.Tests.csproj Adds CookieCrumble test dependencies for mediator snapshots.
src/Mocha/test/Mocha.Mediator.Tests/MediatorDescriptionTests.cs Adds snapshot test for mediator description output.
src/Mocha/test/Mocha.Mediator.Tests/snapshots/MediatorDescriptionTests.Describe_Should_ReturnMediatorDescription_When_HandlersRegistered.snap Introduces mediator description snapshot including mediator/handler/message URNs.
src/Mocha/src/Mocha/Transport/MessagingTransport.Lifecyle.cs Assigns stable transport URN during initialization (scoped by effective service name).
src/Mocha/src/Mocha/Transport/MessagingTransport.cs Extends base transport description with URN ID and topology entity IDs.
src/Mocha/src/Mocha/Sagas/SagaTransition.cs Adds transition URN to saga transition model.
src/Mocha/src/Mocha/Sagas/SagaState.cs Adds state URN to saga state model.
src/Mocha/src/Mocha/Sagas/SagaEventListener.cs Ensures saga event listener consumer description includes URN ID.
src/Mocha/src/Mocha/Sagas/Saga.Initialization.cs Assigns saga URN and generates URNs for states/transitions during initialization.
src/Mocha/src/Mocha/Sagas/Saga.cs Propagates saga/state/transition URNs into SagaDescription.
src/Mocha/src/Mocha/Mocha.csproj Adds System.IO.Hashing dependency to support URN hashing.
src/Mocha/src/Mocha/MessageTypes/OutboundRoute.cs Adds outbound route URN generation and includes it in descriptions.
src/Mocha/src/Mocha/MessageTypes/MessageType.cs Adds message type URN (identity passthrough) and includes it in descriptions.
src/Mocha/src/Mocha/MessageTypes/InboundRoute.cs Adds inbound route URN generation (with hashed condition) and includes it in descriptions.
src/Mocha/src/Mocha/Extensions/HostInfoExtensions.cs Adds EffectiveServiceName derivation to consistently scope URNs/addresses.
src/Mocha/src/Mocha/Endpoints/ReceiveEndpoint.cs Adds receive endpoint URN generation and includes it in descriptions.
src/Mocha/src/Mocha/Endpoints/DispatchEndpoint.cs Adds dispatch endpoint URN generation and includes it in descriptions.
src/Mocha/src/Mocha/Descriptions/TransportDescription.cs Updates transport description record to include stable Id URN and explicit Address.
src/Mocha/src/Mocha/Descriptions/TopologyLinkDescription.cs Adds stable Id URN to topology link description model.
src/Mocha/src/Mocha/Descriptions/TopologyEntityDescription.cs Adds stable Id URN to topology entity description model.
src/Mocha/src/Mocha/Descriptions/SagaTransitionDescription.cs Adds stable Id URN to saga transition description model.
src/Mocha/src/Mocha/Descriptions/SagaStateDescription.cs Adds stable Id URN to saga state description model.
src/Mocha/src/Mocha/Descriptions/SagaDescription.cs Adds stable Id URN to saga description model.
src/Mocha/src/Mocha/Descriptions/ReceiveEndpointDescription.cs Adds stable Id URN to receive endpoint description model.
src/Mocha/src/Mocha/Descriptions/OutboundRouteDescription.cs Adds stable Id URN to outbound route description model.
src/Mocha/src/Mocha/Descriptions/MochaUrn.cs Introduces central URN builder (including hashed route condition support).
src/Mocha/src/Mocha/Descriptions/MessageTypeDescription.cs Adds stable Id URN to message type description model.
src/Mocha/src/Mocha/Descriptions/MessageBusDescriptionBuilder.cs Adds stable host URN ID to the overall bus description.
src/Mocha/src/Mocha/Descriptions/InboundRouteDescription.cs Adds stable Id URN to inbound route description model.
src/Mocha/src/Mocha/Descriptions/HostDescription.cs Adds stable Id URN to host description model.
src/Mocha/src/Mocha/Descriptions/DispatchEndpointDescription.cs Adds stable Id URN to dispatch endpoint description model.
src/Mocha/src/Mocha/Descriptions/ConsumerDescription.cs Adds stable Id URN to consumer description model.
src/Mocha/src/Mocha/Consumers/Implementations/BatchConsumer.cs Updates batch consumer description to include URN ID.
src/Mocha/src/Mocha/Consumers/Consumer.cs Adds consumer URN generation and includes it in descriptions.
src/Mocha/src/Mocha.Transport.RabbitMQ/RabbitMQMessagingTransport.cs Adds topology entity/link URN IDs in RabbitMQ transport description output.
src/Mocha/src/Mocha.Transport.Postgres/PostgresMessagingTransport.cs Adds topology entity/link URN IDs in Postgres transport description output.
src/Mocha/src/Mocha.Transport.InMemory/InMemoryMessagingTransport.cs Scopes in-memory topology addresses by effective service name; adds topology entity/link URN IDs.
src/Mocha/src/Mocha.Mediator/MediatorRuntime.cs Adds Describe() support via cached mediator description.
src/Mocha/src/Mocha.Mediator/MediatorOptions.cs Adds mediator ServiceName option for URN scoping with documented fallbacks.
src/Mocha/src/Mocha.Mediator/IMediatorRuntime.cs Extends mediator runtime interface to expose mediator description.
src/Mocha/src/Mocha.Mediator/Descriptions/MediatorUrn.cs Introduces mediator URN builder for mediator/handler/message identities.
src/Mocha/src/Mocha.Mediator/Descriptions/MediatorHandlerDescription.cs Adds mediator handler description model including URN IDs.
src/Mocha/src/Mocha.Mediator/Descriptions/MediatorDescriptionHelpers.cs Adds helper for stable readable type names in mediator description output.
src/Mocha/src/Mocha.Mediator/Descriptions/MediatorDescription.cs Introduces mediator description model including mediator URN ID.
src/Mocha/src/Mocha.Mediator/DependencyInjection/MediatorBuilder.cs Builds mediator description (deterministic ordering) and injects it into runtime at build time.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Mocha/src/Mocha/Transport/MessagingTransport.cs Outdated
Comment thread src/Mocha/src/Mocha/Transport/MessagingTransport.cs Outdated
@PascalSenn
PascalSenn merged commit 8c8f3ec into main Jul 6, 2026
142 of 146 checks passed
@PascalSenn
PascalSenn deleted the pse/improve-mocha-identities branch July 6, 2026 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants