fix(web): FastAPI adapter serialization parity — negotiation, JSON config, RFC 7807 (v26.06.33)#60
Merged
Merged
Conversation
…JSON config, RFC 7807) + bump v26.06.33 Final-audit finding: the FastAPI adapter bypassed the v26.06.27/28 serialization stack. - fastapi controller threads accept + message-converter registry into handle_return_value (Accept negotiation JSON/XML + Content-Type request parsing incl. XML). - fastapi app wires pyfly_json_serializer/pyfly_message_converters/pyfly_problem_details onto app.state (global pyfly.web.json.* config + RFC 7807 now apply on FastAPI too). - Extracted shared install_serialization_state(app, context) used by BOTH adapters so they can't drift again (Starlette refactored to call it). Tests: tests/web/test_fastapi_content_negotiation.py (3: JSON<->XML negotiation, XML request body, problem+json). Gates: mypy --strict (614), ruff + format, full suite 3793 passed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The final parity audit's top finding: the FastAPI adapter (the auto-config-preferred one) silently bypassed the serialization stack added in v26.06.27/28 — global JSON config, content negotiation, and RFC 7807 only worked on Starlette.
accept+ the message-converter registry intohandle_return_value→Acceptnegotiation (JSON/XML, q-values) +Content-Typerequest parsing (incl. XML request bodies).pyfly_json_serializer/pyfly_message_converters/pyfly_problem_detailsontoapp.state→ globalpyfly.web.json.*config + RFC 7807 problem+json apply on FastAPI.install_serialization_state(app, context)used by both adapters (Starlette refactored to call it) so they can't drift again.Tests
tests/web/test_fastapi_content_negotiation.py(3, real FastAPITestClient): JSON⇄XML response negotiation, XML request-body parsing, problem+json when enabled. Starlette e2e + full web suite unchanged.Gates
mypy --strict(614) ✓ ·ruff+ruff format✓ · full suite 3793 passed.Wave B of the audit fixes. Next: @transactional CancelledError-commit + read_only; Kafka per-message isolation.