Skip to content

fix: convert backed enum tool arguments - #1033

Open
mikemikimike wants to merge 1 commit into
prism-php:mainfrom
mikemikimike:agent/fix-backed-enum-tool-params
Open

fix: convert backed enum tool arguments#1033
mikemikimike wants to merge 1 commit into
prism-php:mainfrom
mikemikimike:agent/fix-backed-enum-tool-params

Conversation

@mikemikimike

Copy link
Copy Markdown

Summary

  • Convert string/integer values returned for tool arguments into backed enum instances expected by the callable.
  • Support both positional and named arguments.
  • Surface invalid enum values as parameter validation errors.
  • Add regression coverage for positional, named, and invalid values.

Closes #1016

Validation

  • git diff --check passed.
  • Local Pest/PHPStan could not be run because this environment has no PHP/Composer installation and no vendor directory.
  • GitHub Actions should run the repository's full Pest matrix and PHPStan checks.

@mikemikimike

Copy link
Copy Markdown
Author

Validation update:

  • git diff --check: passed.
  • Local Pest/PHPStan: not runnable in the current environment because PHP, Composer, and vendor/ are unavailable.
  • Full repository CI: the Formatting, PHPStan, and Tests workflow runs were created, but all are currently action_required because this fork PR requires maintainer approval before workflows execute. No full-context test result is being claimed yet.

The implementation covers positional and named backed-enum arguments, and converts invalid enum values into the existing parameter-validation error path.

@mikemikimike

Copy link
Copy Markdown
Author

Final local validation completed after installing PHP 8.3.33 and Composer 2.10.2 in a temporary project tool directory:

  • Full Pest suite (single-process, memory_limit=-1): 1465 passed, 8 skipped, 4832 assertions.
  • PHPStan: passed, no errors.
  • Pint on changed files (src/Tool.php, tests/ToolTest.php): passed.
  • git diff --check: passed.

The initial parallel Pest run hit the Windows worker's default 128MB PHP memory limit in the existing ArchTest worker; rerunning the same full suite single-process completed successfully. The PR branch remains clean at commit 70a26a7f.

@mikemikimike
mikemikimike deleted the agent/fix-backed-enum-tool-params branch August 2, 2026 02:16
@mikemikimike
mikemikimike restored the agent/fix-backed-enum-tool-params branch August 2, 2026 11:22
@mikemikimike mikemikimike reopened this Aug 2, 2026
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.

Feature request: auto-convert string values to BackedEnum instances when tool handler parameters are typed as enums

1 participant