Skip to content

fix(resources:get): skip remote container selection for array options#58

Merged
miguelsanchez-upsun merged 2 commits intomainfrom
fix-resources-get-array-options
Apr 29, 2026
Merged

fix(resources:get): skip remote container selection for array options#58
miguelsanchez-upsun merged 2 commits intomainfrom
fix-resources-get-array-options

Conversation

@pjcdawkins
Copy link
Copy Markdown
Contributor

Summary

resources:get failed with Worker not found: Array (in app: Array) (preceded by several Array to string conversion warnings) when run without --app or --worker.

ResourcesGetCommand defines those options as VALUE_IS_ARRAY (they are filters, not selectors). The empty default [] reached Selector::selectRemoteContainer, where it cleared the !== null guard and was then cast to a string.

The fix is in Selector::getSelection: when --app is array-typed, skip the whole remote-container block. The calling command filters services itself via ResourcesUtil::filterServices, so no per-container selection is needed.

Adds an integration test that runs resources:get against a mocked API and asserts the command exits successfully with no array-cast warnings.

🤖 Generated with Claude Code

ResourcesGetCommand defines --app and --worker as VALUE_IS_ARRAY (filters,
not selectors). When the command is run without those options the empty
default ([]) reached Selector::selectRemoteContainer, where it cleared
the !== null check and was cast to a string, producing several "Array to
string conversion" warnings followed by:

  Worker not found: Array (in app: Array)

In Selector::getSelection, treat array-typed --app as a signal to skip
the whole remote container block. The calling command filters services
itself via ResourcesUtil::filterServices, so no per-container selection
is needed.

Add an integration test that runs resources:get against a mocked API
and asserts the command exits successfully with no array-cast warnings.
Copilot AI review requested due to automatic review settings April 29, 2026 11:05
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

Fixes a regression where resources:get could fail when --app / --worker are defined as VALUE_IS_ARRAY filters, by preventing the selector’s remote-container selection logic from treating the default empty array as a string worker/app name.

Changes:

  • Update Selector::getSelection() to skip remote-container selection when --app is array-typed.
  • Add an integration test that runs resources:get against the mock API and asserts successful execution without array-cast warnings.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
legacy/src/Selector/Selector.php Avoids remote-container selection when --app is an array (filter-style) option, preventing array-to-string casting and downstream selection errors.
integration-tests/resources_get_test.go Regression test covering resources:get execution with mocked endpoints and asserting no “Array to string conversion” / “Worker not found” errors.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread legacy/src/Selector/Selector.php
@miguelsanchez-upsun miguelsanchez-upsun merged commit 07f6351 into main Apr 29, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants