Skip to content

Fix #24: test PHP AI Client 1.3.1 compatibility - #34

Merged
jeffpaul merged 5 commits into
WordPress:trunkfrom
superdav42:fix/php-ai-client-1.3.1-compatibility
Sep 11, 2026
Merged

jeffpaul merged 5 commits into
WordPress:trunkfrom
superdav42:fix/php-ai-client-1.3.1-compatibility

Conversation

@superdav42

@superdav42 superdav42 commented Aug 16, 2026 •

Copy link
Copy Markdown
Member

Summary

  • set PHP AI Client 1.3.1, bundled with WordPress 7.0, as the supported development baseline
  • add PHPUnit coverage proving Anthropic provider availability can be created with that baseline
  • add a pull-request matrix across PHP 7.4–8.4 and lowest/latest compatible dependencies
  • include tests in PHPCS and keep model sorting compatible with the current PHPStan release

Verification

  • composer lint
  • composer test — 1 test, 2 assertions
  • composer validate --no-check-publish --no-interaction
  • composer audit --no-interaction --no-ansi
  • PHPUnit passes with both PHP AI Client 1.3.1 and 1.4.0 locally

@superdav42
superdav42 requested a review from a team August 16, 2026 06:50
@github-actions

github-actions Bot commented Aug 16, 2026 •

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: superdav42 <superdav42@git.wordpress.org>
Co-authored-by: jeffpaul <jeffpaul@git.wordpress.org>
Co-authored-by: ekamran <ekamran@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@superdav42
superdav42 requested a review from dkotter August 16, 2026 06:54
@ekamran

ekamran commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

I tested this branch locally before commenting, so sharing the result.

I cloned this branch and installed it on an environment that reproduces #24, and the site still goes down with the same fatal at AnthropicProvider.php line 97. WP-CLI also cannot run. The composer pin, PHPUnit setup and CI matrix are all useful, and the sorting change looks like a real fix, but line 97 is untouched, so nothing changes at runtime for an affected site.

Also a correction from my side. In #24 I said the class is missing from the bundled AI Client. That was wrong, and I should have checked before saying it. WordPress 7.0 through 7.0.4 and 7.1-RC3 all bundle PHP AI Client 1.3.1 and all of them do contain ListModelsApiBasedProviderAvailability. On a clean 7.0.4 with PHP 8.4 the provider registers fine.

What actually reproduces the crash is that single class file not being present at runtime while the rest of the client is there, which is an incomplete install rather than a version mismatch. I can reproduce it reliably by deleting just that file from a clean 7.0.4.

Adding a guard next to the existing AiClient check fixed it in my testing:

if (!class_exists(ListModelsApiBasedProviderAvailability::class)) {
return;
}

With that, the same broken environment loads normally, front end and admin, no fatal.

So my only suggestion is that this may be worth merging on its own merits without closing #24, since the fatal is still reproducible with this branch applied. Happy to open a small PR for the guard, and I can share full reproduction steps if useful.

@jeffpaul jeffpaul added this to the 1.1.0 milestone Aug 17, 2026
@superdav42

Copy link
Copy Markdown
Member Author

@ekamran yes this PR should be treated unrelated to issue #24 and just be considered as added the CI test pipeline. We'll keep the discussion for #24 in the issue.

@dkotter can you review?

@jeffpaul
jeffpaul merged commit d8c3e53 into WordPress:trunk Sep 11, 2026
14 checks passed
@whyisjake whyisjake mentioned this pull request Oct 1, 2026
saarnilauri pushed a commit that referenced this pull request Oct 23, 2026
Fix #48: restore corrupted package metadata in composer.lock (#49)

A merge conflict resolution in d8c3e53 (#34) spliced fields from
phpcompatibility/php-compatibility and phpstan/phpstan into four
packages-dev entries in composer.lock. As a result, `composer install`
failed on trunk: nyholm/psr7 and phpcompatibility/php-compatibility
both claimed to replace wimg/php-compatibility.

Restore the original metadata for nyholm/psr7, phar-io/manifest,
php-http/discovery and sebastian/global-state. Locked versions and
the content-hash are unchanged.

Co-authored-by: noruzzamans <noruzzaman@git.wordpress.org>
Co-authored-by: Arkenon <arkenon@git.wordpress.org>
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.

4 participants