Skip to content

Continue AZM-02 messaging topology validation - #887

Merged
AndreaCuneo merged 28 commits into
masterfrom
copilot/azm
Aug 19, 2026
Merged

Continue AZM-02 messaging topology validation#887
AndreaCuneo merged 28 commits into
masterfrom
copilot/azm

Conversation

Copilot AI commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

AZM-02 requires transport-neutral message/event contracts, participant declarations, and compile-time network topology validation.

  • Contract metadata
    • Supports [Message] and [Event] with normalized names and aliases.
    • Rejects dual attribution, invalid event shapes, duplicate names, alias collisions, and unwired contracts.
  • Participant topology
    • Adds deterministic participant identity normalization and validation.
    • Validates ownership, duplicate membership, cross-network contracts, subscriptions, serializer compatibility, retry policies, and reserved names.
  • Network capabilities
    • Derives participant capability requirements and validates them against network declarations.
    • Diagnoses duplicate processors/publishers and oversized event topics.
  • Source generation
    • Emits deterministic messaging network metadata descriptors.
    • Records diagnostics in analyzer release metadata.
[MessagingParticipant(
    Processes = new[] { typeof(ProcessBookPrintProcessRequest) },
    Serializers = new[] { SerializationProtocol.Json },
    DefaultSerializer = SerializationProtocol.Json)]
public sealed class PrintingParticipant;

Copilot AI and others added 19 commits August 19, 2026 11:13
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>
@AndreaCuneo
AndreaCuneo marked this pull request as ready for review August 19, 2026 14:22
Copilot AI lite review requested due to automatic review settings August 19, 2026 14:22
@AndreaCuneo
AndreaCuneo requested a review from a team as a code owner August 19, 2026 14:22

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

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.Messaging runtime project with MessagingNetworkOptions plus 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.

Comment thread docs/mediator-framework/guide/azure-functions.md Outdated
Comment thread docs/mediator-framework/progress/tasks/README.md Outdated

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

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>
Copilot AI review requested due to automatic review settings August 19, 2026 18:22
Copilot AI and others added 2 commits August 19, 2026 18:26
Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>

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

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

  • MessagingNetworkOptions uses CultureInfo.InvariantCulture but the file doesn't import System.Globalization, so this won't compile (implicit usings don't include System.Globalization).
using System.Collections.ObjectModel;

Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>

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

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;

Copilot AI and others added 4 commits August 19, 2026 18:57
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>
@AndreaCuneo
AndreaCuneo merged commit 73a0b6e into master Aug 19, 2026
8 checks passed
@AndreaCuneo
AndreaCuneo deleted the copilot/azm branch August 19, 2026 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants