fix(galaxy): Pending/Warning status rows map to Uncertain; detail 8001 to BadTypeMismatch (#872)
v2-ci / unit-tests (push) Has been cancelled

Owner decision 2026-11-13 on #872 item 1. StatusCodeMap.FromMxStatus now maps a
Pending or Warning row to Uncertain (0x40000000) for any detail, ahead of the
detail vocabulary, keeping the once-per-(detail, category) warning. MXAccess sets
success = -1 on Pending (accepted, in progress); neither category is a failure.

Detail 8001 (automation-object ConfigurationError, write rejected for type
conversion, live-captured on windev 2026-11-13) maps to BadTypeMismatch. 8018
stays BadUserAccessDenied via its SecurityError category, now pinned by a test.

Data change: the value is published Uncertain. Write reply: the result is
Uncertain, never Good, so the server (which commits only Good) reports the write
not committed and reverts the node; a later MXAccess commit arrives as a data
change. Host status is unchanged (probe decode treats Uncertain and Bad alike,
quality < 192 -> Unknown); no alarm path calls the map.

Claude-Session: https://claude.ai/code/session_01GT67ACmpMR7b9LGRPLijMi
This commit is contained in:
Joseph Doherty
2026-11-13 02:01:07 -05:00
parent 35576485b1
commit 2470f82eea
7 changed files with 158 additions and 7 deletions
@@ -583,7 +583,8 @@ internal sealed class EventPump : IAsyncDisposable
// the value. The gateway fills Statuses on every data change, so keying on "any statuses present" meant
// Quality was never read and an off-scan / Bad / Uncertain attribute with an OK status row was
// published Good (#866 review). Every gateway path (live OnDataChange, value-cache replay, session
// snapshot) carries Quality.
// snapshot) carries Quality. A Pending or Warning row (not IsSuccess, which is category == Ok) publishes
// the decoded value as Uncertain, not Bad (#872).
var statusCode = ev.Statuses.Count > 0 && !ev.Statuses[0].IsSuccess()
? StatusCodeMap.FromMxStatus(ev.Statuses[0], _logger)
: StatusCodeMap.FromQualityByte((byte)(ev.Quality & 0xFF), _logger);
@@ -411,6 +411,14 @@ public sealed class GatewayGalaxyDataWriter : IGalaxyDataWriter
// MX-side status — the worker's WriteCompleteEvent rolls into the reply's
// statuses array. Use the first row (single-write contract).
// A Pending or Warning row maps to Uncertain (#872), deliberately NOT Good: Pending means MXAccess
// accepted the write but has not confirmed the commit, and a Warning is not a clean commit either. The
// server commits only a Good write result (DriverInstanceActor.IsGoodStatus), so an Uncertain one is
// reported to the client as not committed and the node's optimistic value is reverted; if MXAccess
// does commit, the value arrives on the data-change path like any other change. This differs from the
// empty-statuses provisional Good below on purpose: there no verdict arrived at all, here MXAccess
// said "not confirmed". No live capture has shown either category on a write reply (mxaccessgw
// docs/LiveCaptures-2026-11-13.md §3); the once-per-pair warning in StatusCodeMap flags the first one.
if (reply.Statuses.Count > 0)
{
var status = reply.Statuses[0];
@@ -126,8 +126,8 @@ internal static class StatusCodeMap
// byte. It used to be routed through the quality table whenever it was <= 0xFF, which mis-named
// every low code: MX_E_PlatformCommunicationError (2) logged as "quality byte 0x02" and fell to
// generic Bad (#866, a stopped platform's ScanState on VD03), MX_E_InvalidObjectId (8) surfaced as
// BadNotConnected, MX_E_Overflow (20) as BadCommunicationError. A failure row is also never Good or
// Uncertain, whatever its detail.
// BadNotConnected, MX_E_Overflow (20) as BadCommunicationError. A non-Ok row is never Good, whatever
// its detail; only a Pending or Warning row is Uncertain (FromCategory), every other category is Bad.
//
// Detail 0 routes the same way. It used to become BadCommunicationError whenever raw_detected_by != 0, on
// the belief that a non-zero source meant a pre-MXAccess transport failure — but every detected_by value
@@ -146,6 +146,19 @@ internal static class StatusCodeMap
/// </summary>
private static uint FromCategory(MxStatusProxy status, ILogger? logger)
{
// Pending and Warning are not failures (#872, owner decision 2026-11-13): MXAccess sets success = -1
// (VARIANT_TRUE) on a Pending row — accepted, still in progress — and a Warning is degraded-but-usable.
// Neither is confirmed Good, so both map to Uncertain for ANY detail, ahead of the detail vocabulary (a
// Warning row's detail qualifies the warning, it does not turn it into a failure). Live capture
// (mxaccessgw docs/LiveCaptures-2026-11-13.md §3) saw Pending only as the synchronous Suspend/Activate
// return with detail 0, and no Warning row at all — so this stays logged once per (detail, category)
// until a data-change or write-reply capture shows what these rows mean there.
if (status.Category is MxStatusCategory.Pending or MxStatusCategory.Warning)
{
LogCategoryLevelOnce(status, Uncertain, logger);
return Uncertain;
}
switch (status.Detail)
{
case 1: return BadTimeout; // MX_E_RequestTimedOut
@@ -176,6 +189,12 @@ internal static class StatusCodeMap
case 1017: return BadUserAccessDenied; // MX_E_VerifierNotHavingVerifyRights
case 1010: // MX_E_ObjectInitializing (transient)
case 1011: return BadOutOfService; // MX_E_EngineInitializing (transient)
// Automation-object-specific codes (8000+), live-captured on windev 2026-11-13 (mxaccessgw
// docs/LiveCaptures-2026-11-13.md §3). 8001 arrives as a ConfigurationError row when the object
// rejects a write for type conversion (a string written to a double). 8018 (SecurityError, a
// verified write naming the writer as verifier) has no case: its category already gives
// BadUserAccessDenied.
case 8001: return BadTypeMismatch;
}
// Everything else — resolving (11/12), repository/engine busy (7/25/26), version/command mismatches,
@@ -188,14 +207,21 @@ internal static class StatusCodeMap
MxStatusCategory.ConfigurationError => BadConfigurationError,
_ => Bad,
};
// Once per (detail, category) per process: these rows arrive on the data-change path, so a stopped
// engine's tags would otherwise log on every update.
LogCategoryLevelOnce(status, code, logger);
return code;
}
/// <summary>
/// Once per (detail, category) per process: these rows arrive on the data-change path, so a stopped
/// engine's tags would otherwise log on every update.
/// </summary>
private static void LogCategoryLevelOnce(MxStatusProxy status, uint code, ILogger? logger)
{
if (logger is not null && UnmappedDetailsLogged.TryAdd((status.Detail, status.Category), 0))
logger.LogWarning(
"MxStatus failure row category {Category} detail {Detail} ({DiagnosticText}) mapped to 0x{Code:X8} at " +
"MxStatus non-Ok row category {Category} detail {Detail} ({DiagnosticText}) mapped to 0x{Code:X8} at " +
"category level. Field capture welcome — extend StatusCodeMap.FromCategory with the detail code.",
status.Category, status.Detail, status.DiagnosticText, code);
return code;
}
private static readonly System.Collections.Concurrent.ConcurrentDictionary<(int, MxStatusCategory), byte>