[Repo Assist] improve: add GetStringArrayArg helper and expand test coverage#161
Merged
shanselman merged 1 commit intomasterfrom Apr 10, 2026
Conversation
9 tasks
Adds the GetStringArrayArg helper for node capabilities, simplifies system.which to use it, preserves the existing trim semantics for bin names, and expands Shared test coverage for both the helper and WindowsNodeClient behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2440c68 to
05cdd46
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 This is an automated pull request from Repo Assist.
Summary
This PR covers two improvements:
Task 5 – Coding Improvement: Adds a
GetStringArrayArgprotected helper toNodeCapabilityBaseand uses it to simplifySystemCapability.HandleWhich.Task 9 – Testing Improvements: Adds 8 new unit tests for
WindowsNodeClientand 6 new tests for the newGetStringArrayArghelper (14 net-new tests).Changes
NodeCapabilityBase.GetStringArrayArg(new helper)NodeCapabilityBasealready hasGetStringArg,GetIntArg, andGetBoolArghelpers. This PR adds the natural companion:Array.Empty(string)()when the property is absent, the args element is default, or the property is not a JSON array.nulland whitespace-only strings from the array.SystemCapability.HandleWhichsimplifiedReplaces 22 lines of manual JSON array parsing (with verbose
System.Text.Json.JsonValueKind.*references) with a single call toGetStringArrayArg:Behaviour is identical; the helper uses
string[]instead ofList(string)sobins.Lengthreplacesbins.Countin the guard.New Tests
NodeCapabilitiesTests– 6 new tests forGetStringArrayArg:JsonElementWindowsNodeClientTests– 8 new tests:SetPermission_UpdatesRegistrationPermissions– verifies permissions dictionary is populated correctlySetPermission_OverwritesPreviousValue– verifies overwrite semanticsDisconnectAsync_RaisesDisconnectedStatus– verifiesStatusChangedfiresDisconnectedProcessMessageAsync_InvalidJson_DoesNotThrow– resilience to malformed inputProcessMessageAsync_NoTypeField_DoesNotThrow– resilience to missingtypefieldProcessMessageAsync_UnknownMessageType_DoesNotThrow– resilience to unknown message typesGatewayUrl_ReturnsDisplayUrl– property returns normalized URLNodeId_IsNullBeforeConnection–NodeIdis null before a handshake completesTrade-offs
string[]instead ofList(string)means callers use.Lengthinstead of.Count. This is consistent with other helpers and avoids unnecessary list allocation.HandleWhichchanged.Test Status
OpenClaw.Shared.TestsOpenClaw.Tray.TestsBuild:
./build.ps1requires Windows — run was on Linux CI (expected❌ This project requires Windowsmessage — infrastructure-only limitation).