Skip to content

[4.x] Add an observer for the exit code after output plugins - #1906

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

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

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,289 passed; existing skipped, todo, incomplete and issue-producing tests remain.
  • Parallel suite: exit 0, 1,288 passed; 2,943 assertions.
  • Integration suite: 23 passed, 63 assertions.
  • PHPStan, Pint, changed-file Rector checks, type coverage 100%, and whitespace checks passed. The complete 4.x Rector check still reports two pre-existing transformations in unchanged src/Preset.php and src/Repositories/SnapshotRepository.php; the modified files pass Rector.
  • 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. This is the matching 4.x backport of #1905. It is kept in draft while the new plugin contract is reviewed on 5.x.

Prepared with AI assistance.

@nunomaduro

Copy link
Copy Markdown
Member

thank you! can you target 5.x + add a test? 4.x only gets security fixes now.

@fouteox

fouteox commented Oct 11, 2026

Copy link
Copy Markdown
Author

Makes sense! #1905 is the 5.x version of this one, with the tests in tests/Unit/Plugins/Actions/CallsAddsOutput.php, and it is now rebased. Closing this one.

@fouteox fouteox closed this Oct 11, 2026
@fouteox
fouteox deleted the feat/observe-final-exit-code-4x branch October 11, 2026 11:08
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