[Repo Assist] improve: SearchValues in GatewayUrlHelper + 10 SystemCapability tests#209
Draft
github-actions[bot] wants to merge 1 commit intomasterfrom
Conversation
…lity coverage Task 5 (Coding Improvements): - GatewayUrlHelper.s_authorityTerminators: char[] → SearchValues<char> matching the SIMD-optimized pattern already used in ShellQuoting.cs - Span-based IndexOfAny avoids the start-offset overload Task 9 (Testing Improvements): - Add 10 new SystemCapability tests covering previously-untested paths: - system.run.prepare: array command, string command, plan structure, missing-command error - system.execApprovals.get: no-policy (disabled), with-policy (enabled + rules) - system.execApprovals.set: no-policy error, updates rules + ruleCount - system.run: blocked env var (PATH) → error; allowed env var passes through All 660 Shared tests pass (↑10), 122 Tray tests pass. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
13 tasks
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 PR from Repo Assist.
Two targeted improvements across Task 5 (Coding) and Task 9 (Testing).
Task 5 — Coding:
SearchValues<char>inGatewayUrlHelperGatewayUrlHelper.s_authorityTerminatorswas achar[]passed tostring.IndexOfAny(char[], int). This is now aSearchValues<char>used with a span-basedIndexOfAny, consistent with the pattern already established inShellQuoting.cs.Before:
After:
SearchValues<char>builds an optimized SIMD lookup structure at startup (SSE2/AVX2 on x64), giving faster character scanning than the legacy overload. The logic is unchanged — same three terminator characters, same semantics.Task 9 — Testing: SystemCapability coverage for untested command paths
Three command handlers had zero test coverage:
system.run.prepare,system.execApprovals.get, andsystem.execApprovals.set. The env-sanitization guard insystem.runwas also untested. Added 10 new tests:RunPrepare_ReturnsCommandText_ForArraycmdTextfield populated from argv arrayRunPrepare_ReturnsCommandText_ForStringcmdTextusesrawCommandwhen providedRunPrepare_ReturnsPlan_WithArgvAndCwdplanobject carriesargv,cwd,agentIdRunPrepare_ReturnsError_WhenMissingCommand"Missing command"errorExecApprovalsGet_WhenNoPolicyConfigured_ReturnsDisabledenabled: falsewith no policy setExecApprovalsGet_WhenPolicySet_ReturnsRulesenabled: true+rulesarray when policy wiredExecApprovalsSet_WhenNoPolicyConfigured_ReturnsError"No exec policy configured"errorExecApprovalsSet_UpdatesRulesupdated: true,ruleCount: 1after setRun_BlockedEnvVar_ReturnsErrorPATHenv override → blocked error responseRun_AllowedEnvVar_PassesTest Status
dotnet test OpenClaw.Shared.Tests— 670 passed, 20 skipped (↑10 from 660)dotnet test OpenClaw.Tray.Tests— 122 passed (unchanged)