fix(clients): resolve 2026-06-18 array-write review findings

- Client.Dotnet-030: add advise-supervisory to IsKnownGatewayCommand (was dead/unreachable, exit 2)
- Client.Go-035/036/037: usage+README list advise-supervisory; add session-id guard test; fix write2 README wording
- Client.Python-037/038: drop regressed 'scaffold' from pyproject; add advise-supervisory CLI tests
- Client.Rust-039/040: document write_array_elements/advise-supervisory in design doc; pin outer MxValue data_type==0
- Client.Java-049/050/051: sync CLIENT_VERSION to 0.1.2; add advise-supervisory test; guard negative uint32 inputs (pending windev gradle verification)

Client READMEs also updated for Server-057 add-family normalization wording.
.NET/Go/Python/Rust verified green locally; Java pending windev.
This commit is contained in:
Joseph Doherty
2026-06-18 10:58:33 -04:00
parent 85ef453d0d
commit 6c853b43af
22 changed files with 404 additions and 43 deletions
+3 -2
View File
@@ -189,8 +189,9 @@ array before forwarding to the worker. Indices not listed in `elements` are
written as the element type's default — this is a **reset**, not a preserve;
current values at those positions are discarded. `totalLength` is required and
must match the declared length of the array attribute. Bare-name array items
(`Area001.Pump001.Speed`) are auto-normalized to the `[]` form at `AddItem`
so the array attribute accepts the write.
(`Area001.Pump001.Speed`) are auto-normalized to the `[]` form across the whole
add family — `AddItem`, `AddItem2`, `AddItemBulk`, and `AddBufferedItem` — so the
array attribute accepts the write.
## CLI Usage
@@ -2028,6 +2028,7 @@ public static class MxGatewayClientCli
or "register"
or "add-item"
or "advise"
or "advise-supervisory"
or "subscribe-bulk"
or "unsubscribe-bulk"
or "read-bulk"
@@ -82,6 +82,53 @@ public sealed class MxGatewayClientCliTests
Assert.Equal(string.Empty, error.ToString());
}
/// <summary>
/// Client.Dotnet-030: <c>advise-supervisory</c> was present in the command
/// dispatch table but absent from <see cref="MxGatewayClientCli"/>'s
/// <c>IsKnownGatewayCommand</c> guard, so the guard intercepted it first and
/// returned exit code 2 "Unknown command" before dispatch could run. This
/// test asserts the command is recognized (exit ≠ 2, stderr contains no
/// "Unknown command") and reaches the dispatch handler (exit 0, reply written
/// to stdout).
/// </summary>
[Fact]
public async Task RunAsync_AdviseSupervisory_IsRecognizedAndReachesDispatch()
{
using var output = new StringWriter();
using var error = new StringWriter();
FakeCliClient fakeClient = new();
fakeClient.InvokeReplies.Enqueue(new MxCommandReply
{
SessionId = "session-fixture",
Kind = MxCommandKind.AdviseSupervisory,
ProtocolStatus = new ProtocolStatus { Code = ProtocolStatusCode.Ok },
});
int exitCode = await MxGatewayClientCli.RunAsync(
[
"advise-supervisory",
"--endpoint",
"http://localhost:5000",
"--api-key",
"test-api-key",
"--session-id",
"session-fixture",
"--server-handle",
"12",
"--item-handle",
"34",
"--json",
],
output,
error,
_ => fakeClient);
Assert.DoesNotContain("Unknown command", error.ToString());
Assert.Equal(0, exitCode);
Assert.Contains("MX_COMMAND_KIND_ADVISE_SUPERVISORY", output.ToString());
Assert.Equal(string.Empty, error.ToString());
}
/// <summary>Verifies that error output redacts sensitive API key values.</summary>
[Fact]
public async Task RunAsync_ErrorOutput_RedactsApiKey()