Continue AZM-02 messaging topology validation - #887
Conversation
Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds the AZM-02 foundation for transport-neutral messaging topology validation by introducing new messaging contract/participant/network attributes, a runtime options type, and an Azure Functions source generator that validates topology and emits deterministic metadata.
Changes:
- Add public messaging API surface (attributes/enums) for contracts, participants, capabilities, compression, and retry policy shape.
- Introduce
Ark.Tools.MediatorFramework.Messagingruntime project withMessagingNetworkOptionsplus accompanying tests. - Add
MessagingNetworkGenerator(Azure Functions generators) to validate topology rules and emit compile-time metadata + analyzer release notes.
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/Ark.Tools.MediatorFramework.Tests/packages.lock.json | Updates lockfile to include the new messaging runtime project. |
| tests/Ark.Tools.MediatorFramework.Tests/MessagingNetworkOptionsTests.cs | Adds unit tests for MessagingNetworkOptions identity resolution and capability validation. |
| tests/Ark.Tools.MediatorFramework.Tests/Ark.Tools.MediatorFramework.Tests.csproj | References the new messaging runtime project from the test project. |
| src/mediator-framework/Ark.Tools.MediatorFramework/SerializationProtocol.cs | Introduces supported serialization protocol enum for participants. |
| src/mediator-framework/Ark.Tools.MediatorFramework/MessagingParticipantAttribute.cs | Adds participant declaration attribute for processes/publishes/subscribes + serializer/retry/compression settings. |
| src/mediator-framework/Ark.Tools.MediatorFramework/MessagingNetworkAttribute.cs | Adds network declaration attribute for members/capabilities/shared limits and lifecycle. |
| src/mediator-framework/Ark.Tools.MediatorFramework/MessagingCapabilities.cs | Adds capabilities flags used by networks and validation. |
| src/mediator-framework/Ark.Tools.MediatorFramework/MessageAttribute.cs | Adds [Message] contract marker with normalized names and aliases. |
| src/mediator-framework/Ark.Tools.MediatorFramework/IMessagingRetryPolicy.cs | Introduces retry policy shape interface. |
| src/mediator-framework/Ark.Tools.MediatorFramework/EventAttribute.cs | Adds [Event] contract marker with normalized names and aliases. |
| src/mediator-framework/Ark.Tools.MediatorFramework/CompressionAlgorithm.cs | Adds compression algorithm enum for participants. |
| src/mediator-framework/Ark.Tools.MediatorFramework.Messaging/packages.lock.json | Adds lockfile for the new messaging runtime project. |
| src/mediator-framework/Ark.Tools.MediatorFramework.Messaging/MessagingNetworkOptions.cs | Adds runtime immutable options + transport capability validation. |
| src/mediator-framework/Ark.Tools.MediatorFramework.Messaging/Ark.Tools.MediatorFramework.Messaging.csproj | Introduces new messaging runtime project. |
| src/mediator-framework/Ark.Tools.MediatorFramework.AzureFunctions.Generators/MessagingNetworkGenerator.cs | Adds generator to validate messaging topology and emit network metadata. |
| src/mediator-framework/Ark.Tools.MediatorFramework.AzureFunctions.Generators/AnalyzerReleases.Unshipped.md | Documents newly introduced ARKMSG*** diagnostics. |
| samples/Ark.MediatorFramework.Sample/src/Ark.MediatorFramework.Sample.Application/Messages/ProcessBookPrintProcessRequest.cs | Marks a sample request as a transport-neutral [Message]. |
| samples/Ark.MediatorFramework.Sample/src/Ark.MediatorFramework.Sample.Application/Messages/MessagingDeclarations.cs | Adds sample participant + network declarations using new attributes. |
| docs/mediator-framework/progress/tasks/README.md | Marks AZM-01 as complete in the task board. |
| docs/mediator-framework/progress/tasks/azure-functions/AZM-01-shared-network-configuration.md | Updates AZM-01 acceptance checklist to completed state. |
| docs/mediator-framework/guide/azure-functions.md | Documents how to declare networks/participants/contracts for Azure Functions. |
| Ark.Tools.slnx | Adds the new messaging runtime project to the solution. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 24 out of 24 changed files in this pull request and generated no new comments.
Suppressed comments (2)
src/mediator-framework/Ark.Tools.MediatorFramework.AzureFunctions.Generators/MessagingNetworkGenerator.cs:112
- MessagingNetworkGenerator introduces substantial new validation + metadata emission, but the MediatorFramework generator snapshot tests don’t appear to cover it (no tests mention ARKMSG* diagnostics or ArkMessagingMetadata.g.cs). Add at least one generator snapshot test that runs MessagingNetworkGenerator and asserts a couple of diagnostics and the generated metadata output so regressions are caught.
public void Initialize(IncrementalGeneratorInitializationContext context)
{
var networks = context.SyntaxProvider
.ForAttributeWithMetadataName(
_networkAttribute,
static (_, _) => true,
static (attributeContext, _) => (INamedTypeSymbol)attributeContext.TargetSymbol)
.Collect();
context.RegisterSourceOutput(networks, static (productionContext, symbols) =>
_emit(productionContext, symbols.Distinct(SymbolEqualityComparer.Default).Cast<INamedTypeSymbol>()));
}
src/mediator-framework/Ark.Tools.MediatorFramework.Messaging/MessagingNetworkOptions.cs:20
- MessagingNetworkOptions uses Type.FullName for NetworkIdentity, while MessagingNetworkGenerator emits network names using symbol.ToDisplayString(). These differ for nested types (FullName uses '+', ToDisplayString uses '.'); if anything later correlates runtime options with generated metadata, nested network types will not match. Consider defining a single canonical identity format and using it consistently in both runtime and generator code.
NetworkType = networkType;
NetworkIdentity = networkType.FullName ?? networkType.Name;
Members = new ReadOnlyCollection<Type>((declaration.Members ?? Array.Empty<Type>()).ToArray());
Requires = declaration.Requires;
Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 24 out of 24 changed files in this pull request and generated no new comments.
Suppressed comments (1)
src/mediator-framework/Ark.Tools.MediatorFramework.Messaging/MessagingNetworkOptions.cs:5
MessagingNetworkOptionsusesCultureInfo.InvariantCulturebut the file doesn't importSystem.Globalization, so this won't compile (implicit usings don't includeSystem.Globalization).
using System.Collections.ObjectModel;
Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 24 out of 24 changed files in this pull request and generated no new comments.
Suppressed comments (2)
src/mediator-framework/Ark.Tools.MediatorFramework.AzureFunctions.Generators/MessagingNetworkGenerator.cs:360
- _readIntProperty only extracts literal integer expressions. If a retry policy uses a const field (e.g.
public const int DefaultMaximumDeliveryCount = 5;+public int MaximumDeliveryCount => DefaultMaximumDeliveryCount;), this returns null and the retry policy validation is silently skipped. Consider also resolving IdentifierNameSyntax that refers to a const int member on the same type so compile-time validation remains effective for common patterns.
if (expression is LiteralExpressionSyntax literal
&& int.TryParse(literal.Token.ValueText, NumberStyles.Integer, CultureInfo.InvariantCulture, out var value))
return value;
src/mediator-framework/Ark.Tools.MediatorFramework.AzureFunctions.Generators/MessagingNetworkGenerator.cs:388
- _readBoolProperty only handles literal
true/false. If a retry policy uses a const bool field (e.g.public const bool EnableSecondLevelRetries = true;+public bool SecondLevelRetriesEnabled => EnableSecondLevelRetries;), this returns null and defaults to false, potentially skipping the stricter retry validation path. Consider resolving IdentifierNameSyntax that refers to a const bool member on the same type.
if (expression is LiteralExpressionSyntax literal
&& bool.TryParse(literal.Token.ValueText, out var value))
return value;
Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
AZM-02 requires transport-neutral message/event contracts, participant declarations, and compile-time network topology validation.
[Message]and[Event]with normalized names and aliases.