Repository navigation
fix(inertia,hosting): version-header 409s, protocol middleware, single page-object embed (#774, #775, #778) - #800
Merged
Conversation
…e page-object embed (#774, #775, #778) - A missing X-Inertia-Version counts as "" (mismatch); the version 409 sends X-Inertia-Version. Test clients default to the app's current version. - New InertiaMiddleware (pure ASGI, streaming-safe): 302/307 -> 303 after PUT/PATCH/DELETE/QUERY, #fragment redirects -> 409 X-Inertia-Redirect (not on prefetch), empty 200 -> 303 back, Vary: X-Inertia. Installed outside module middleware so an auth redirect after a DELETE is normalised too. - The HTML document embeds the page object once (script only; v2 data-page attribute dropped). Claude-Session: https://claude.ai/code/session_01FXHA3ZJ5EgoJN4zXTAhBR2
…middleware-774-778 # Conflicts: # CHANGELOG.md
- hold an Inertia 200 only on an explicit Content-Length: 0 (streaming responses are never delayed); guard a start message without headers - the fragment 409 drops headers describing the discarded body (ETag, type, ...) - one add_vary (simple_module_inertia) shared with hosting's cache middleware - test helper reuses resolved_version; simple_module_test declares simple_module_inertia - e2e tests read the script[data-page] element; integration client defaults the version header; stale middleware-order docs; #778 marked as a behaviour change Claude-Session: https://claude.ai/code/session_01FXHA3ZJ5EgoJN4zXTAhBR2
…middleware-774-778 # Conflicts: # CHANGELOG.md # framework/inertia/README.md
… its Referer Found by /ship QA on #775: an expired session on an Inertia DELETE now 303s to the login page, but the DELETE URL was stored as 'next', so signing back in issued GET /admin/settings/3 -> 405. GET/HEAD navigations keep returning to themselves; other methods return to the same-site Referer, or nowhere. Claude-Session: https://claude.ai/code/session_01FXHA3ZJ5EgoJN4zXTAhBR2
- a malformed Referer no longer 500s the login redirect - same-site check compares the port too (fails closed: no target) Claude-Session: https://claude.ai/code/session_01FXHA3ZJ5EgoJN4zXTAhBR2
…middleware-774-778 # Conflicts: # CHANGELOG.md # framework/inertia/simple_module_inertia/errors.py
Deploying simple-module-python with
|
| Latest commit: |
34c18ea
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://9efb1585.simple-module-python.pages.dev |
| Branch Preview URL: | https://fix-inertia-protocol-middlew.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.
The remaining Inertia v3 protocol gaps from the conformance review (tracking #780): asset-version 409s, the protocol middleware the adapter guide requires, and a single page-object embed.
Closes #774
Closes #775
Closes #778
What changed
X-Inertia-Versionis treated as"", so it mismatches a real version, and the 409 now carriesX-Inertia-Versionas well asX-Inertia-Location. Behaviour change: non-browser callers that sendX-Inertiamust send the version. Thesimple_module_testclients (client,authenticated_client,session_client,wizard_client, the integrationinertia_client) send the app's current version by default (simple_module_test.inertia_headers(app)). Hand-built test clients in four module test files were updated.InertiaMiddleware: a new pure-ASGI middleware insimple_module_inertia. ForX-Inertiarequests it:PUT/PATCH/DELETE/QUERYinto a 303 (307 included because it is FastAPI'sRedirectResponsedefault);#fragmentinto a 409 withX-Inertia-Redirect(not forPurpose: prefetch), dropping the discarded body's headers;Content-Length: 0) into a 303 back to the same-site Referer;Vary: X-Inertiato Inertia and HTML responses.DELETE. With Codex's original placement inside the module stack, that case stayed a 302, and a regression test now pins it.add_vary.<script data-page="app">. The v2<div data-page='…'>copy is gone, about half of a first-load document. Behaviour change. The e2e tests now read the script element.GET /admin/settings/3and got a 405. Non-GET requests now return to their same-site Referer, with the port checked too, or to no target. A malformed Referer no longer turns the login redirect into a 500.docs/framework/middleware.md, the CLAUDE.md middleware order line, README,docs/framework-conventions.md, the adapter spec andframework/inertia/README.md(standalone usage).Verification
make lint✓ ·make test-py(8 workers): 7438 passed, 43 skipped ✓ ·make test-js: 886 passed ✓tests/e2e): 49 passed ✓script[data-page=app]and nodata-pageon#app; client-side navigation with no full reloads;X-Inertia-LocationandX-Inertia-Version, and the real version returned 200 JSON;https://claude.ai/code/session_01FXHA3ZJ5EgoJN4zXTAhBR2