Skip to content

[4.x] Arguments resolution issue in testing#19193

Merged
danharrin merged 4 commits intofilamentphp:4.xfrom
dmason30:assert-action-exists-record-arguments-schema-bug
Feb 5, 2026
Merged

[4.x] Arguments resolution issue in testing#19193
danharrin merged 4 commits intofilamentphp:4.xfrom
dmason30:assert-action-exists-record-arguments-schema-bug

Conversation

@dmason30
Copy link
Contributor

@dmason30 dmason30 commented Feb 4, 2026

Description

Dan Harrin requested this PR to show a failing test. It demonstrates a regression where assertActionExists() and assertActionVisible() fail to pass provided arguments to an action before its schema is resolved.

In Filament v4, when an action is defined with a record() closure that depends on $arguments, and that record is subsequently used within a schema() closure, testing assertions throw an ErrorException: Undefined array key because the arguments are not yet merged into the action instance during the assertion's resolution phase.

ErrorException: Undefined array key "post_id"
at vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:258
at tests/src/Fixtures/Pages/Actions.php:224
at packages/support/src/Concerns/EvaluatesClosures.php:36
at packages/actions/src/Concerns/InteractsWithRecord.php:97
at packages/actions/src/Action.php:528
at packages/support/src/Concerns/EvaluatesClosures.php:58
at packages/support/src/Concerns/EvaluatesClosures.php:33
at packages/actions/src/Concerns/HasSchema.php:47
at packages/actions/src/Concerns/InteractsWithActions.php:669
at packages/actions/src/Concerns/InteractsWithActions.php:517
at packages/actions/src/Concerns/InteractsWithActions.php:643
at packages/actions/src/Testing/TestsActions.php:145
at vendor/laravel/framework/src/Illuminate/Macroable/Traits/Macroable.php:126
at vendor/livewire/livewire/src/Features/SupportTesting/Testable.php:398
at tests/src/Actions/ActionTest.php:565

Visual changes

N/A (Testing/Internal logic)

Functional changes

  • Code style has been fixed by running the composer cs command.
  • Changes have been tested to not break existing functionality.
  • Documentation is up-to-date.

@github-project-automation github-project-automation bot moved this to Todo in Roadmap Feb 4, 2026
@dmason30 dmason30 changed the title Add failing test replicating arguments resolution issue [4.x] Add failing test replicating arguments resolution issue Feb 4, 2026
@danharrin danharrin added bug Something isn't working pending review labels Feb 4, 2026
@danharrin danharrin added this to the v4 milestone Feb 4, 2026
@danharrin danharrin changed the title [4.x] Add failing test replicating arguments resolution issue [4.x] Arguments resolution issue in testing Feb 5, 2026
@danharrin danharrin marked this pull request as ready for review February 5, 2026 09:01
@github-project-automation github-project-automation bot moved this from Todo to In Progress in Roadmap Feb 5, 2026
@danharrin danharrin merged commit 58e92c2 into filamentphp:4.x Feb 5, 2026
19 of 23 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Roadmap Feb 5, 2026
@dmason30 dmason30 deleted the assert-action-exists-record-arguments-schema-bug branch February 5, 2026 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants