Repository navigation
fix(hosting,inertia): Inertia body validation redirects back with field errors; faster first loads - #818
Merged
Conversation
…ld errors; faster catalog-carrying pages An Inertia form whose JSON body fails FastAPI validation rendered the 422 'invalid parameters' Error page over the form; it now redirects back with one error per field (error-bag aware), like redirect_back_with_errors. GETs and non-Inertia requests keep the error page / JSON. Perf: the resolver checks scalars before _is_dynamic, and encode_page skips jsonable_encoder for plain-JSON pages. A page carrying the 48KB i18n catalog drops from 2.27 ms to 0.32 ms in resolve+encode. Found with the inertia_lab feature lab. Claude-Session: https://claude.ai/code/session_01FXHA3ZJ5EgoJN4zXTAhBR2
Deploying simple-module-python with
|
| Latest commit: |
ccab8cc
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://f9ab8c52.simple-module-python.pages.dev |
| Branch Preview URL: | https://fix-inertia-lab-findings.simple-module-python.pages.dev |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
Summary
Two findings from testing every Inertia v3 feature end to end in a fresh
smpy newapp (inertia_lab: 11 feature pages, 78 protocol tests, 50 Playwright browser tests against@inertiajs/react3.11, plus a load harness).Behaviour change: Inertia body validation redirects back with field errors
An Inertia
useFormPOST/PUT/PATCH/DELETE whose body fails FastAPI request validation used to get hosting's 422 Error page ("The requested URL contains invalid parameters."), which replaced the form and lost its URL. It now redirects back (303) with one message per field viaredirect_back_with_errors, scoped byX-Inertia-Error-Bag, so the errors show in place, as with Laravel's adapter.Perf: catalog-carrying pages
Every first page load carries the shared i18n catalog (48 KB in English). The resolver ran
_is_dynamic, includinginspect.isawaitable, on every catalog string before its scalar check, andencode_pagerebuilt the whole page withjsonable_encoder._sa*keys and over-deep or cyclic data.Lab perf baseline (1 uvicorn worker, SQLite, for context; not changed here)
/health/live(user and session loading, about 4 SQLite queries).Tests
New
framework/hosting/tests/test_hosting_inertia_body_validation.pycovers:Verified failing without the fix.
Fast-path tests in
test_adapter_page.py: plain page returned as-is; enum/tuple, non-str keys and_sakeys use the encoder; cycles terminate.make lint✓ ·make test-py✓ (7594 passed, 43 skipped). No TS changes./ship: three review passes (correctness + maintainability). Findings were fixed or rejected with evidence. Optimize was folded into the review. Browser QA was skipped because no framework page submits a FastAPI-validated body; the lab's Playwright suite covered it (strict xfail before this fix).
https://claude.ai/code/session_01FXHA3ZJ5EgoJN4zXTAhBR2