feat(worker,gateway): report record-info pin outcome in WorkerReady; drain-thread completion tests

The worker logged its MXSTATUS_PROXY record-info pin outcome only to its own
stderr, which the gateway's launcher does not capture, so operators never saw
whether the pin took.

- Contract (additive, internal IPC): WorkerReady.record_info_pin_status = 5.
  No protocol version bump; an older peer ignores it or sends it empty.
  Regenerated Contracts/Generated, the client protoset, the Rust vendored
  proto, and the Go/Python/Java worker bindings (real delta only).
- Worker: the handshake copies MxStatusProxyRecordInfoPin.Status into
  WorkerReady unless the runtime already set it.
- Gateway: WorkerClient records it (IWorkerClient.RecordInfoPinStatus, default
  null) and logs it at Information when pinned, Warning otherwise; empty is
  not logged. Shown as "Record-info pin" in the dashboard session details
  Worker table via DashboardSessionSummary.WorkerRecordInfoPinStatus.
- Tests: drain-thread cancellation (task ends Canceled; RunAsync cancels,
  runtime disposed, thread exits, no EventDrain stop-failure log) and fault
  (exception on the thread faults RunAsync with the same instance) paths;
  WorkerReady carries the pin status; gateway logging/recording and the
  dashboard projection.
- Docs: gateway.md STA thread model (drain thread, pin step in COM lifetime),
  MxAccessWorkerInstanceDesign, GatewayProcessDesign, GatewayDashboardDesign,
  WorkerFrameProtocol.
This commit is contained in:
Joseph Doherty
2026-11-21 08:11:31 -05:00
parent 659bb831a2
commit 30ac3f3225
23 changed files with 878 additions and 145 deletions
@@ -182,6 +182,31 @@ public sealed class DashboardSnapshotServiceTests
Assert.Equal("worker pipe disconnected", fault.Message);
}
/// <summary>
/// The worker's record-info pin outcome, reported in <c>WorkerReady</c>, reaches the session
/// summary the session-details page renders, since the worker's own log line is not captured.
/// </summary>
[Fact]
public void GetSnapshot_ProjectsWorkerRecordInfoPinStatus()
{
const string pinStatus = "LoadRegTypeLib failed (HRESULT 0x8002801D)";
SessionRegistry registry = new();
GatewaySession session = CreateSession(
"session-pin",
"client-one",
DateTimeOffset.Parse("2026-04-26T10:00:00Z", CultureInfo.InvariantCulture));
session.AttachWorkerClient(
new FakeWorkerClient("session-pin", 1301, WorkerClientState.Ready) { RecordInfoPinStatus = pinStatus });
session.MarkReady();
registry.TryAdd(session);
using GatewayMetrics metrics = new();
DashboardSnapshotService service = CreateService(registry, metrics);
DashboardSessionSummary summary = Assert.Single(service.GetSnapshot().Sessions);
Assert.Equal(pinStatus, summary.WorkerRecordInfoPinStatus);
}
/// <summary>
/// Verifies snapshot metrics include the cumulative alarm provider switch count.
/// </summary>
@@ -929,6 +954,9 @@ public sealed class DashboardSnapshotServiceTests
/// <inheritdoc />
public WorkerClientState State { get; private set; } = state;
/// <inheritdoc />
public string? RecordInfoPinStatus { get; init; }
/// <inheritdoc />
public DateTimeOffset LastHeartbeatAt { get; } = DateTimeOffset.Parse("2026-04-26T10:02:00Z", CultureInfo.InvariantCulture);