Skip to content

XS✔ ◾ Change Exec Interface from String to String Array#782

Merged
muiriswoulfe merged 4 commits intomainfrom
refactor/exec-string-array
Apr 10, 2026
Merged

XS✔ ◾ Change Exec Interface from String to String Array#782
muiriswoulfe merged 4 commits intomainfrom
refactor/exec-string-array

Conversation

@muiriswoulfe
Copy link
Copy Markdown
Member

@muiriswoulfe muiriswoulfe commented Apr 10, 2026

Summary

  • Fix defect where args.split(" ") in gitHubRunnerWrapper.exec() would incorrectly split arguments containing spaces (e.g., file paths or values with embedded spaces).
  • Change the exec interface from args: string to args: string[] across the entire runner invoker chain, passing arrays directly to the underlying @actions/exec and azure-pipelines-task-lib APIs.
  • Update all callers (gitInvoker.ts, tokenManager.ts) and all corresponding test files to use string arrays.

@muiriswoulfe
Copy link
Copy Markdown
Member Author

muiriswoulfe commented Apr 10, 2026

PR Metrics

Thanks for keeping your pull request small.
Thanks for adding tests.

Lines
Product Code 43
Test Code 133
Subtotal 176
Ignored Code -
Total 176

Metrics computed by PR Metrics. Add it to your Azure DevOps and GitHub PRs!

@muiriswoulfe muiriswoulfe changed the title Change Exec Interface from String to String Array XS✔ ◾ Change Exec Interface from String to String Array Apr 10, 2026
@muiriswoulfe
Copy link
Copy Markdown
Member Author

Super-linter summary

Language Validation result
BIOME_LINT Pass ✅
CHECKOV Pass ✅
EDITORCONFIG Pass ✅
GITHUB_ACTIONS Pass ✅
GITHUB_ACTIONS_ZIZMOR Pass ✅
GITLEAKS Pass ✅
GIT_MERGE_CONFLICT_MARKERS Pass ✅
JSCPD Pass ✅
JSON_PRETTIER Pass ✅
MARKDOWN Pass ✅
MARKDOWN_PRETTIER Pass ✅
NATURAL_LANGUAGE Pass ✅
POWERSHELL Pass ✅
PRE_COMMIT Pass ✅
SPELL_CODESPELL Pass ✅
TRIVY Pass ✅
TYPESCRIPT_PRETTIER Pass ✅
XML Pass ✅
YAML Pass ✅
YAML_PRETTIER Pass ✅

All files and directories linted successfully

For more information, see the GitHub Actions workflow run

Powered by Super-linter

@muiriswoulfe
Copy link
Copy Markdown
Member Author

Super-linter summary

Language Validation result
BIOME_LINT Pass ✅
CHECKOV Pass ✅
EDITORCONFIG Pass ✅
GITHUB_ACTIONS Pass ✅
GITHUB_ACTIONS_ZIZMOR Pass ✅
GITLEAKS Pass ✅
GIT_MERGE_CONFLICT_MARKERS Pass ✅
JSCPD Pass ✅
JSON_PRETTIER Pass ✅
MARKDOWN Pass ✅
MARKDOWN_PRETTIER Pass ✅
NATURAL_LANGUAGE Pass ✅
POWERSHELL Pass ✅
PRE_COMMIT Pass ✅
SPELL_CODESPELL Pass ✅
TRIVY Pass ✅
TYPESCRIPT_PRETTIER Pass ✅
XML Pass ✅
YAML Pass ✅
YAML_PRETTIER Pass ✅

All files and directories linted successfully

For more information, see the GitHub Actions workflow run

Powered by Super-linter

@muiriswoulfe
Copy link
Copy Markdown
Member Author

Super-linter summary

Language Validation result
BIOME_LINT Pass ✅
CHECKOV Pass ✅
EDITORCONFIG Pass ✅
GITHUB_ACTIONS Pass ✅
GITHUB_ACTIONS_ZIZMOR Pass ✅
GITLEAKS Pass ✅
GIT_MERGE_CONFLICT_MARKERS Pass ✅
JSCPD Pass ✅
JSON_PRETTIER Pass ✅
MARKDOWN Pass ✅
MARKDOWN_PRETTIER Pass ✅
NATURAL_LANGUAGE Pass ✅
POWERSHELL Pass ✅
PRE_COMMIT Pass ✅
SPELL_CODESPELL Pass ✅
TRIVY Pass ✅
TYPESCRIPT_PRETTIER Pass ✅
XML Pass ✅
YAML Pass ✅
YAML_PRETTIER Pass ✅

All files and directories linted successfully

For more information, see the GitHub Actions workflow run

Powered by Super-linter

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes argument tokenization issues in command execution by changing the runner execution contract from a single space-delimited string to a string[] passed end-to-end through the runner abstraction (GitHub Actions + Azure Pipelines). This aligns the internal interfaces with the underlying execution APIs and prevents incorrect splitting for arguments containing spaces.

Changes:

  • Update runner exec APIs (RunnerInvokerInterface, RunnerInvoker, GitHub/Azure runner invokers, and wrappers) to accept args: string[].
  • Migrate key call sites (GitInvoker, TokenManager) to construct argument arrays directly.
  • Update unit tests to pass/verify argument arrays (using ts-mockito deepEqual([...]) where appropriate).

Reviewed changes

Copilot reviewed 12 out of 14 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/task/src/wrappers/gitHubRunnerWrapper.ts Removes args.split(" "); passes string[] directly to @actions/exec.
src/task/src/wrappers/azurePipelinesRunnerWrapper.ts Updates execSync wrapper signature to args: string[] and forwards to task-lib.
src/task/src/runners/runnerInvokerInterface.d.ts Changes exec signature to (tool: string, args: string[]).
src/task/src/runners/runnerInvoker.ts Forwards string[] args through the invoker selection layer.
src/task/src/runners/gitHubRunnerInvoker.ts Updates exec signature and forwards arrays to the GitHub runner wrapper.
src/task/src/runners/azurePipelinesRunnerInvoker.ts Updates exec signature and forwards arrays to the Azure runner wrapper.
src/task/src/repos/tokenManager.ts Converts Azure CLI invocations from strings to argument arrays.
src/task/src/git/gitInvoker.ts Converts git invocations to argument arrays; updates invokeGit to accept string[].
src/task/tests/runners/runnerInvoker.spec.ts Updates exec tests to use string[] args and deepEqual for matching.
src/task/tests/runners/gitHubRunnerInvoker.spec.ts Updates wrapper expectations to match argument arrays via deepEqual.
src/task/tests/runners/azurePipelinesRunnerInvoker.spec.ts Updates wrapper expectations to match argument arrays via deepEqual.
src/task/tests/repos/tokenManager.spec.ts Updates mocked Azure CLI calls to match argument arrays via deepEqual.
src/task/tests/git/gitInvoker.spec.ts Imports deepEqual and updates git exec expectations to argument arrays.

@microsoft microsoft deleted a comment from muiriswoulfe Apr 10, 2026
@muiriswoulfe muiriswoulfe self-assigned this Apr 10, 2026
@muiriswoulfe muiriswoulfe added enhancement New feature or request dependencies Updates to dependencies and removed dependencies Updates to dependencies labels Apr 10, 2026
@muiriswoulfe muiriswoulfe enabled auto-merge (squash) April 10, 2026 10:45
@muiriswoulfe
Copy link
Copy Markdown
Member Author

Super-linter summary

Language Validation result
BIOME_LINT Pass ✅
CHECKOV Pass ✅
EDITORCONFIG Pass ✅
GITHUB_ACTIONS Pass ✅
GITHUB_ACTIONS_ZIZMOR Pass ✅
GITLEAKS Pass ✅
GIT_MERGE_CONFLICT_MARKERS Pass ✅
JSCPD Pass ✅
JSON_PRETTIER Pass ✅
MARKDOWN Pass ✅
MARKDOWN_PRETTIER Pass ✅
NATURAL_LANGUAGE Pass ✅
POWERSHELL Pass ✅
PRE_COMMIT Pass ✅
SPELL_CODESPELL Pass ✅
TRIVY Pass ✅
TYPESCRIPT_PRETTIER Pass ✅
XML Pass ✅
YAML Pass ✅
YAML_PRETTIER Pass ✅

All files and directories linted successfully

For more information, see the GitHub Actions workflow run

Powered by Super-linter

@microsoft microsoft deleted a comment from muiriswoulfe Apr 10, 2026
@muiriswoulfe muiriswoulfe merged commit 10df8ba into main Apr 10, 2026
35 checks passed
@muiriswoulfe muiriswoulfe deleted the refactor/exec-string-array branch April 10, 2026 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants