Issue #3607715: Bump anthropic-ai/sdk composer constraint to ^0.32

Summary

Bump anthropic-ai/sdk composer constraint on the module from ^0.29 to ^0.32. Picks up the SDK 0.30 transport fix: streaming HTTP 4xx/5xx now surfaces as a typed APIStatusException subclass (retry-supported, typed ErrorType body) rather than the misleading APIConnectionException the pre-0.30 stack threw on streaming errors.

What changed

  • composer.json: one-line constraint bump ^0.29^0.32.
  • tests/src/Unit/Plugin/AiProvider/AnthropicProviderNativeChatTest.php: one new test method testHandleApiExceptionMapsTypedRateLimitOnRateLimitClass(). Fills a documented combination-coverage gap: SdkRateLimitException + typed ErrorType::RATE_LIMIT_ERROR — the exact combination the 0.30 transport fix makes real on streaming 429. Reuses the existing mockSdkException() helper and invoke() reflection helper; no new mock framework or fixture pattern.

What did NOT change

  • AnthropicStreamedChatMessageIterator — a source-inspection probe against the v0.30.0 tag confirmed Anthropic\Messages\RawMessageStreamEvent::variants() is byte-for-byte identical between 0.29.x and 0.30.0 (same six variants; no error variant added). The 0.30 fix is one line in the SDK's StreamingHttpClient::sendRequest ('http_errors' => false), so Guzzle returns a ResponseInterface to the SDK's existing retry loop instead of throwing on 4xx/5xx. Zero code change required in our iterator dispatch.
  • Any production code in src/. This is a constraint bump + one test method; no admin form, config schema, or install file touched.

How it was verified

Local drupalci-parity gates (runnable locally):

  • composer update anthropic-ai/sdk --dry-run: 1 update, 0 installs, 0 removals; only anthropic-ai/sdk v0.29.1 → v0.32.0.
  • phpcs (Drupal + DrupalPractice) on changed files: clean.
  • phpunit targeted (--filter testHandleApiExceptionMapsTypedRateLimitOnRateLimitClass): 1 test, 1 assertion, 15ms — green on v0.32.0.
  • phpunit full module unit suite: 84 tests, 153 assertions, 166ms — green on v0.32.0. Zero regressions.

Deferred to drupalci pipeline (local environment mismatch, not a coverage claim):

  • phpstan — local workspace has an unrelated contrib module with a broken autoloader that mglaman/phpstan-drupal hits at bootstrap; CI env would be clean.
  • cspell — not installed locally.
  • PHPUnit concurrent variant (_PHPUNIT_CONCURRENT: 1) — local run was sequential via core config.
  • Opt-in variants (OPT_IN_TEST_PREVIOUS_MAJOR / _NEXT_MINOR / _MAX_PHP) — manual trigger only per gitlab_templates v1.15.0+.

AI-Generated: Yes

Used Claude Opus 4.8 to draft the PHPUnit regression test method covering the missing (SdkRateLimitException + typed RATE_LIMIT_ERROR) combination. Adversarially reviewed via a fresh-context reviewer agent, which caught an overclaim in the initial docblock; corrected before submit. The SDK constraint bump itself is a human maintainer decision. Dependencies, logic, security, and GPL compatibility verified. Full contributor responsibility assumed.

Closes #3607715.

Edited by Carlos Ospina

Merge request reports

Loading