Harden production errors docs and request framing#180
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 10e2a72c34
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| except ImportError: | ||
| pass | ||
| return (500, "application/json", _dumps({"error": str(e)})) | ||
| return (500, "application/json", _dumps(_internal_error_body(e, debug=debug))) |
There was a problem hiding this comment.
Redact errors from the eager async runner
For body_async_eager routes, fast_handler_eager calls run_coroutine_response_eager(), which catches exceptions raised inside the coroutine and formats them through async_pool._exception_response_tuple as {"error": str(exc)}; this redacted fallback only runs for setup/parsing errors outside the coroutine. A no-await async POST handler that raises RuntimeError("secret-token") will still return the secret in production despite debug=False.
Useful? React with 👍 / 👎.
| self.docs_url, | ||
| 200, | ||
| "text/html", | ||
| get_swagger_ui_html(self.title, self.openapi_url or "/openapi.json"), |
There was a problem hiding this comment.
Guard docs registration on an OpenAPI URL
When an app disables schema serving with openapi_url=None but leaves docs_url enabled or custom, this registers the native docs page pointing at the hard-coded /openapi.json; the guard above skips registering that schema route, so the UI fetches a missing spec. Gate docs/ReDoc registration on self.openapi_url instead of falling back to an unregistered path.
Useful? React with 👍 / 👎.
Summary
Validation
Full pytest now collects repo tests only and passed: 400 passed, 23 warnings.
Note: full unfiltered zig test still has an unrelated pre-existing compile issue in the response-cache test expecting a string from getCachedResponse(), so this PR validates the new framing parser with --test-filter framing and the commit hook Zig build.