Skip to content

fix(mcp): restore 4.3 CI after #8522 - #8525

Merged
soyuka merged 2 commits into
api-platform:4.3from
soyuka:fix/metadata-bad-request-exception
Sep 11, 2026
Merged

fix(mcp): restore 4.3 CI after #8522#8525
soyuka merged 2 commits into
api-platform:4.3from
soyuka:fix/metadata-bad-request-exception

Conversation

@soyuka

@soyuka soyuka commented Sep 11, 2026

Copy link
Copy Markdown
Member

#8522 landed on 4.3 in a broken state, in two separate ways. This makes 4.3 green again.

Context: #8522 was based on main, so squash-merging it onto 4.3 wrote main's tree into the maintenance branch (changelog, COMPOSER_ROOT_VERSION: 5.0.x-dev, ^5.0@alpha across 21 components, the Doctrine filter rewrites, the tools/ relocation). That has since been reverted on 4.3. Removing the pollution exposed two real defects that the ^5.0@alpha pin had been masking.

1. Missing BadRequestException (fix(metadata))

src/Mcp references ApiPlatform\Metadata\Exception\BadRequestException, which only existed from 4.4 onwards. With the correct ^4.3 metadata constraint restored:

Error: Class "ApiPlatform\Metadata\Exception\BadRequestException" not found

The file is copied verbatim from 4.4 (byte-identical there and on main), so merging up is a no-op for it. It is self-contained — extends \RuntimeException, implements ExceptionInterface + HttpExceptionInterface, both already on 4.3 with a matching contract.

Fixes the 6 api-platform/mcp jobs (2 errors each) and PHPStan (PHP 8.5) (4 errors, all in Mcp/Tests/Server/HandlerTest.php).

2. Stale tools/list schema expectation (fix(mcp))

#8522 rewrote array type nodes into anyOf branches in Mcp\JsonSchema\SchemaFactory (for #8504 — several MCP clients reject an array type), but never updated the functional test asserting the old shape:

-'status' => ['type' => ['string', 'null']],
+'status' => ['anyOf' => [['type' => 'string'], ['type' => 'null']]],

This one assertion is the sole failure in all 11 PHPUnit jobs on 4.3 (1 failure out of ~2008 tests in each).

Expected effect

Job Before After
PHPUnit (...) × 11 1 failure each, all McpTest::testToolsList fixed
PHPUnit api-platform/mcp × 6 2 errors each fixed
PHPStan (PHP 8.5) 4 errors fixed

src/Mcp references ApiPlatform\Metadata\Exception\BadRequestException,
which only existed from 4.4 on. The 4.3 MCP jobs passed only because
api-platform#8522 had pinned the metadata sibling to ^5.0@alpha; with the correct
^4.3 constraint restored they fail with "Class not found".

Copied verbatim from 4.4 so the merge-up is a no-op. Fixes the 6
api-platform/mcp jobs (2 errors each) and PHPStan (4 errors).
api-platform#8522 rewrote array `type` nodes into anyOf branches in
Mcp\JsonSchema\SchemaFactory (see api-platform#8504) but left McpTest::testToolsList
asserting the old `type: [string, null]` shape, so it was merged red.

This single assertion accounts for the failure in all 11 PHPUnit jobs
on 4.3.
@soyuka soyuka changed the title fix(metadata): add BadRequestException for 4.3 fix(mcp): restore 4.3 CI after #8522 Sep 11, 2026
@soyuka
soyuka merged commit ffc01c9 into api-platform:4.3 Sep 11, 2026
25 of 114 checks passed
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.

1 participant