Merge branch 'fix/archreview-p2' into main (P2 tier: completeness & polish)

# Conflicts:
#	archreview/remediation/00-tracking.md
#	clients/dotnet/ZB.MOM.WW.MxGateway.Client.Cli/MxGatewayCliSecretRedactor.cs
#	clients/dotnet/ZB.MOM.WW.MxGateway.Client.Cli/MxGatewayClientCli.cs
#	src/ZB.MOM.WW.MxGateway.Worker.Tests/Ipc/WorkerFrameProtocolTests.cs
This commit is contained in:
Joseph Doherty
2026-07-12 22:12:41 -04:00
91 changed files with 7680 additions and 681 deletions
@@ -76,4 +76,35 @@ public sealed class MxAccessGrpcMapperTests
Assert.Equal(ProtocolStatusCode.ProtocolViolation, publicReply.ProtocolStatus.Code);
}
/// <summary>
/// Verifies MapEvent transfers ownership of the inner MxEvent (GWC-07 / IPC-05): the
/// returned reference is the same instance carried by the WorkerEvent, not a clone. The
/// WorkerEvent is discarded after mapping and the distributor pump is its single consumer,
/// so moving the inner event out is safe and avoids a per-event deep copy.
/// </summary>
[Fact]
public void MapEvent_TransfersOwnershipOfInnerEventWithoutCloning()
{
MxEvent innerEvent = new()
{
Family = MxEventFamily.OnDataChange,
RawStatus = "OK",
};
WorkerEvent workerEvent = new() { Event = innerEvent };
MxEvent mapped = new MxAccessGrpcMapper().MapEvent(workerEvent);
Assert.Same(innerEvent, mapped);
}
/// <summary>Verifies that a worker event with no public payload maps to the unspecified-family sentinel.</summary>
[Fact]
public void MapEvent_WhenEventMissing_ReturnsUnspecifiedFamilySentinel()
{
MxEvent mapped = new MxAccessGrpcMapper().MapEvent(new WorkerEvent());
Assert.Equal(MxEventFamily.Unspecified, mapped.Family);
Assert.Equal("Worker event did not contain a public event payload.", mapped.RawStatus);
}
}