Skip to content

[tests] Structure agent-driven PHPUnit JSON results#329

Merged
coisa merged 35 commits intomainfrom
feature/248-structured-tool-json
May 2, 2026
Merged

[tests] Structure agent-driven PHPUnit JSON results#329
coisa merged 35 commits intomainfrom
feature/248-structured-tool-json

Conversation

@coisa
Copy link
Copy Markdown
Contributor

@coisa coisa commented May 1, 2026

Related Issue

Part of #248

Motivation / Context

  • Keep --json and --pretty-json parseable across the DevTools command surface while reducing context consumption for agent-driven runs.
  • Reuse the packaged PHPUnit agent reporter instead of maintaining a parallel structured-output integration.
  • Normalize command orchestration so JSON-capable runs emit one final document instead of mixing intermediary log records into the output stream.

Changes

  • register ergebnis/phpunit-agent-reporter in the packaged phpunit.xml
  • force the PHPUnit subprocess into the same reporter path during structured tests runs so DevTools captures a stable nested PHPUnit payload
  • expose the structured PHPUnit payload under context.output, preserve prelude text as output.raw_output, and append output.coverage when minimum-coverage validation is active
  • suppress intermediary Running... records during structured command runs so --json and --pretty-json emit one final JSON document
  • normalize orchestrated subprocess payloads so nested JSON output is decoded instead of surfacing as escaped strings
  • simplify command logging to go through generic PSR-3 log() calls and align command tests with the new contract
  • move trait-level logger and runtime resolution toward ContainerFactory fallbacks and clean up related command/test plumbing
  • remove the redundant ServiceProvider\DevToolsServiceProvider alias wrapper and use the container service-provider namespace directly
  • replace the improvised anonymous DevTools object in DevToolsCommandProviderTest with a proper test double stored in ContainerFactory
  • update lifecycle handling in UsesContainerFactory to use PHPUnit lifecycle attributes instead of legacy setUpBeforeClass / tearDownAfterClass
  • refresh README, testing docs, command docs, and changelog copy to match the final structured-output behavior and guide-only repository support

Verification

  • composer dev-tools
  • Focused command(s):
    • composer dev-tools tests -- --filter='(DevToolsCommandProviderTest|HasJsonOptionTest|TestsCommandTest|ContainerFactoryTest|FundingCommandTest)'
    • composer dev-tools tests -- --filter='(CodeStyleCommandTest|DependenciesCommandTest|DocsCommandTest|FundingCommandTest|GitAttributesCommandTest|GitHooksCommandTest|GitIgnoreCommandTest|LicenseCommandTest|MetricsCommandTest|PhpDocCommandTest|RefactorCommandTest|ReportsCommandTest|StandardsCommandTest|SyncCommandTest|TestsCommandTest|UpdateComposerJsonCommandTest|WikiCommandTest)'
    • composer dev-tools changelog:check -- --file=CHANGELOG.md --against=origin/main
  • Manual verification:
    • confirmed tests --json and tests --pretty-json keep the standard DevTools envelope and surface the bundled PHPUnit reporter payload in context.output
    • confirmed reports --pretty-json emits one final structured document with nested subprocess payloads decoded into structured data

Documentation / Generated Output

  • README updated
  • docs/ updated
  • Generated or synchronized output reviewed

Changelog

  • Added a notable CHANGELOG.md entry

Reviewer Notes

  • This branch started from the PHPUnit slice of Support colored pretty JSON and structured tool result payloads #248 and then absorbed the supporting work needed to make structured output consistent across orchestrated commands, command logging, documentation, and test infrastructure.
  • .github/wiki local preview drift was intentionally kept out of all commits.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 860f47d77a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Console/Command/TestsCommand.php
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 37b5ba1f1b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Console/Command/TestsCommand.php Outdated
Comment thread src/Console/Command/TestsCommand.php
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4a228a21bd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread bin/dev-tools.php Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a40c792eb6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Console/Input/HasJsonOption.php Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 28aba82952

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Console/Command/TestsCommand.php Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c5181d6141

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Console/Command/TestsCommand.php Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 35380c1c4c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Console/Command/Traits/LogsCommandResults.php
@coisa coisa merged commit adb8f61 into main May 2, 2026
33 checks passed
@coisa coisa deleted the feature/248-structured-tool-json branch May 2, 2026 05:32
@github-project-automation github-project-automation Bot moved this from Backlog to Released in PHP Fast Forward Project May 2, 2026
github-actions Bot added a commit that referenced this pull request May 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Released

Development

Successfully merging this pull request may close these issues.

1 participant