Skip to content

Make the production editor test independent of test order - #24

Merged
imanimanyara merged 1 commit into
mainfrom
fix/tui-test-prompt-fallback
Oct 12, 2026
Merged

imanimanyara merged 1 commit into
mainfrom
fix/tui-test-prompt-fallback

Conversation

@imanimanyara

Copy link
Copy Markdown
Member

Why

The scheduled Mutation score job on main (c13e7d7, run 38268249858) failed with 1 failed / 538 passed: TuiTest > it persists multiple edits in production with --force-production threw NonInteractiveValidationException: Required. from EditCommand.php:48.

Root cause

The test sets $this->app['env'] = 'production'. That turns off runningUnitTests(), and Laravel's ConfiguresPrompts only routes prompts through the fakeable fallback when runningUnitTests() is true. With the fallback off, select() renders a real prompt; with no TTY it is non-interactive, returns the empty default, and fails required validation.

It passed in the ordinary suite only because Prompt::fallbackWhen() ORs into a static flag, so an earlier TUI test had already switched the fallback on. Reproduced locally: pest tests/Feature/TuiTest.php --filter=force-production </dev/null fails on main.

Fix

The test enables the fallback itself (Prompt::fallbackWhen(true)), so it no longer depends on what ran before it. No source change, and the mutation threshold (--min=85) is untouched.

Verified locally

  • the isolated test: fails on main, passes on this branch
  • full suite: 539 passed; three random-order runs: 539 passed each
  • laranail-pint --test passed, phpstan analyse --debug no errors

The mutation workflow runs on schedule and workflow_dispatch only, so it does not run on this PR. No coverage driver is available locally to run --mutate.

Setting the app environment to production turns off runningUnitTests(),
so Laravel stops routing prompts through its fakeable fallback. The test
only passed because an earlier test had already set the sticky fallback
flag; run alone, or reordered as in the mutation job, select() rendered
a real prompt with no TTY and threw NonInteractiveValidationException.
Copilot AI balanced review requested due to automatic review settings October 12, 2026 20:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@imanimanyara
imanimanyara merged commit 131efdc into main Oct 12, 2026
5 checks passed
@imanimanyara
imanimanyara deleted the fix/tui-test-prompt-fallback branch November 1, 2026 17:23
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.

2 participants