chore(comm): delete dead IntegrationCallRequest routing (Gitea #32)

'Pattern 4: Integration Routing' — RouteIntegrationCallAsync →
SiteEnvelope(IntegrationCallRequest) → SiteCommunicationActor integration
handler — was plumbed end to end but connected at neither end: no
producer (zero callers) and no handler (AkkaHostedService never
registered LocalHandlerType.Integration). It was an early scaffold the
architecture routed around — the brokered External→Central→Site→Central
round-trip is served by the Inbound API's routed-site-script path (the
RouteTo* verbs, driven from CommunicationServiceInstanceRouter), which is
live, tested, and shares IntegrationTimeout.

Decision (#32): delete. Removed the IntegrationCall{Request,Response}
messages, RouteIntegrationCallAsync, the SiteCommunicationActor receive
block + _integrationHandler field + LocalHandlerType.Integration, and the
four tests that covered them (2 actor, 2 message-contract, 1 dispatcher-
reject, 1 mapper-reject). KEPT IntegrationTimeout — it is the live
timeout for the RouteTo* verbs. Updated the exclusion-narrative comments
(proto/mapper/dispatcher), design §4, the components doc timeout table,
and marked the known-issue RESOLVED.

Full solution build clean (0/0); Communication 634 + Host 421 green.
Net -172/+20 across 14 files. Not in the gRPC proto (was deliberately
excluded there), so no wire-format change.
This commit is contained in:
Joseph Doherty
2026-07-23 14:27:32 -04:00
parent e0f105c3b3
commit a5256e9b12
14 changed files with 20 additions and 172 deletions
@@ -1,14 +0,0 @@
namespace ZB.MOM.WW.ScadaBridge.Commons.Messages.Integration;
/// <summary>
/// Request routed from central to site to invoke an integration method
/// (external system call or notification) on behalf of the central UI or API.
/// </summary>
public record IntegrationCallRequest(
string CorrelationId,
string SiteId,
string InstanceUniqueName,
string TargetSystemName,
string MethodName,
IReadOnlyDictionary<string, object?> Parameters,
DateTimeOffset Timestamp);
@@ -1,12 +0,0 @@
namespace ZB.MOM.WW.ScadaBridge.Commons.Messages.Integration;
/// <summary>
/// Response for an integration call routed through central-site communication.
/// </summary>
public record IntegrationCallResponse(
string CorrelationId,
string SiteId,
bool Success,
string? ResultJson,
string? ErrorMessage,
DateTimeOffset Timestamp);
@@ -35,11 +35,6 @@ namespace ZB.MOM.WW.ScadaBridge.Communication.Actors;
/// singleton proxy (design §7.3). This is the same target the actor used; the
/// extraction does not "fix" it.
/// </para>
/// <para>
/// <b>Excluded by design:</b> <c>IntegrationCallRequest</c> — the 29th command, dead at
/// both ends. It never enters this dispatcher; the actor keeps its own vestigial handler
/// for it (28 of 29 migrate).
/// </para>
/// </remarks>
public sealed class SiteCommandDispatcher
{
@@ -61,12 +61,6 @@ public class SiteCommunicationActor : ReceiveActor, IWithTimers
/// <summary>The transport supplied by the Host (null falls back to <see cref="NoOpCentralTransport"/>).</summary>
private readonly ICentralTransport? _injectedTransport;
/// <summary>
/// Handler for the vestigial <see cref="IntegrationCallRequest"/> — the one command NOT
/// migrated to the dispatcher (dead at both ends), so it still routes on the actor.
/// </summary>
private IActorRef? _integrationHandler;
/// <summary>Akka timer scheduler injected by the framework via <see cref="IWithTimers"/>.</summary>
public ITimerScheduler Timers { get; set; } = null!;
@@ -158,20 +152,6 @@ public class SiteCommunicationActor : ReceiveActor, IWithTimers
Receive<RetryParkedOperation>(cmd => DispatchCommand(cmd));
Receive<DiscardParkedOperation>(cmd => DispatchCommand(cmd));
// Integration Routing — the 29th command, NOT migrated to the dispatcher (dead at
// both ends; no production code registers the handler). Kept on the actor so the
// dispatcher's command surface stays the 28 that actually migrate.
Receive<IntegrationCallRequest>(msg =>
{
if (_integrationHandler != null)
_integrationHandler.Forward(msg);
else
{
Sender.Tell(new IntegrationCallResponse(
msg.CorrelationId, _siteId, false, null, "Integration handler not available", DateTimeOffset.UtcNow));
}
});
// Central→site manual failover relay. Central and the site are separate clusters,
// so central can only ask — this node performs the graceful Leave locally, scoped to
// the SITE-SPECIFIC role, because that is what site singletons (the Deployment
@@ -281,9 +261,6 @@ public class SiteCommunicationActor : ReceiveActor, IWithTimers
case LocalHandlerType.ParkedMessages:
_dispatcher.RegisterParkedMessageHandler(msg.Handler);
break;
case LocalHandlerType.Integration:
_integrationHandler = msg.Handler;
break;
case LocalHandlerType.Artifacts:
_dispatcher.RegisterArtifactHandler(msg.Handler);
break;
@@ -364,6 +341,5 @@ public enum LocalHandlerType
{
EventLog,
ParkedMessages,
Integration,
Artifacts
}
@@ -224,21 +224,13 @@ public class CommunicationService
}
// ── Pattern 4: Integration Routing ──
/// <summary>
/// Routes an integration call to a site.
/// </summary>
/// <param name="siteId">The target site identifier.</param>
/// <param name="request">The integration call request.</param>
/// <param name="cancellationToken">Cancellation token.</param>
/// <returns>The integration call response.</returns>
public async Task<IntegrationCallResponse> RouteIntegrationCallAsync(
string siteId, IntegrationCallRequest request, CancellationToken cancellationToken = default)
{
var envelope = new SiteEnvelope(siteId, request);
return await GetActor().Ask<IntegrationCallResponse>(
envelope, _options.IntegrationTimeout, cancellationToken);
}
// The brokered "External System → Central → Site → Central → External System"
// round-trip (design §4) is served by the Inbound API's routed-site-script
// path — the RouteTo* verbs below (RouteToCall / RouteToGetAttributes /
// RouteToSetAttributes / RouteToWaitForAttribute), driven from
// InboundAPI/CommunicationServiceInstanceRouter and sharing IntegrationTimeout.
// The earlier generic IntegrationCallRequest primitive was never wired to a
// producer or a site handler and was removed as dead code (Gitea #32).
// ── Pattern 5: Debug View ──
@@ -34,13 +34,6 @@ namespace ZB.MOM.WW.ScadaBridge.Communication.Grpc;
/// server (T1B.2) and the central transport (T1B.3) can share one implementation
/// without a project-reference cycle.
/// </para>
/// <para>
/// <b>Excluded by design:</b> <c>IntegrationCallRequest</c>. It is the 29th
/// command on <c>SiteCommunicationActor</c>'s receive table but is dead at both
/// ends — no production code registers the integration handler, so the site
/// always answers "Integration handler not available". See
/// <c>docs/known-issues/2026-07-22-integration-call-routing-is-dead-code.md</c>.
/// </para>
/// <para><b>Null conventions.</b> proto3 has no presence for scalars, so:</para>
/// <list type="bullet">
/// <item>
@@ -17,10 +17,6 @@ import "google/protobuf/wrappers.proto";
// place on the client and one dispatch switch on the server. A `oneof` request
// / reply envelope preserves per-command typing inside the group.
//
// IntegrationCallRequest (the 29th command) is deliberately NOT here — it is
// dead code at both ends; see
// docs/known-issues/2026-07-22-integration-call-routing-is-dead-code.md.
//
// EVOLUTION RULE (same as sitestream.proto): field numbers are never reused and
// changes are additive only. New commands take the next free oneof tag; an
// older peer simply sees an unset oneof and answers with a clean error.