Skip to content

Add an observer for the exit code after output plugins - #1905

Open
fouteox wants to merge 1 commit into
pestphp:5.xfrom
fouteox:feat/observe-final-exit-code
Open

fouteox wants to merge 1 commit into
pestphp:5.xfrom
fouteox:feat/observe-final-exit-code

Conversation

@fouteox

@fouteox fouteox commented Sep 11, 2026 •

Copy link
Copy Markdown

What:

  • Bug Fix
  • New Feature

Description:

Output plugins can change the exit code after another plugin has already observed it, so a reporter can announce success while a later coverage check fails the command. Add the ObservesExitCode plugin contract and notify its observers after every AddsOutput plugin has run. Observers receive the same resulting code and do not return a replacement value; the shared action covers sequential and parallel execution.

Seven tests cover output-plugin ordering, multiple observers, unchanged codes including custom codes, runs without observers, and output-plugin exceptions. The suite-output snapshots and parallel summary are updated for those additional tests.

Validation on macOS / PHP 8.5.10:

  • Unit suite: exit 0, 1,589 passed; existing skipped, todo, incomplete and issue-producing tests remain.
  • Parallel suite: exit 0, 1,588 passed; 3,445 assertions.
  • Integration suite: 244 passed, one skipped, 734 assertions.
  • PHPStan, Pint, Rector dry-run, type coverage 100%, and whitespace checks passed.
  • PAO consumer qualification passes minimum and exact coverage thresholds in sequential and parallel runs, along with its complete 292-test passing suite.

The full upstream PHP/OS matrix has not been run.

Prepared with AI assistance.

@nunomaduro

Copy link
Copy Markdown
Member

thank you! can you rebase this?

@fouteox
fouteox force-pushed the feat/observe-final-exit-code branch from 292f16f to 33c11b7 Compare October 11, 2026 10:56
@fouteox

fouteox commented Oct 11, 2026

Copy link
Copy Markdown
Author

Done, rebased on 5.x. The only conflict was the test count in the suite snapshot.

Heads up while running it locally: paratest v7.26.1 added a fifth $tmpDir argument to WrapperWorker::__construct(), and WrapperRunner::startWorker() still passes four, so every parallel run crashes with an ArgumentCountError once 7.26.1 is installed. I pinned 7.26.0 locally to validate this PR.

@fouteox
fouteox force-pushed the feat/observe-final-exit-code branch from 33c11b7 to 1e01dd6 Compare October 13, 2026 06:07
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