failed NO_PATCH NO_PATCH UNSUBMITTED empty_patch(None) · None tool calls · 0 s · fastapi/fastapi
✨ Add support for `app.frontend("/", directory="dist")` and `router.frontend("/", directory="dist")`
## Pull Request
✨ Add support for `app.frontend("/", directory="dist")` and `router.frontend("/", directory="dist")`
<!--
Please start with a GitHub Discussion.
Once a team member asks you to open a PR, create it and link the discussion here.
Obvious typo fixes can be made in a PR without starting a discussion.
-->
Discussion: <!-- Link to the GitHub Discussion -->
## Description
<!-- Write the description of your PR here -->
## AI Disclaimer
Codex with GPT 5.5, long design iterations, then many iterations tweaking and improving the implementation. Then some refactors and docs manually written as well.
<!-- If using AI, write here the prompt and model used -->
<details>
<summary>AI transcript</summary>
<!-- Paste here the entire AI transcript -->
</details>
## Checklist
- [ ] This PR is an obvious typo fix, or it links to a GitHub Discussion for the proposed code change.
- [ ] I added tests for the change.
- [ ] The new or updated tests fail on the main branch and pass on this PR.
- [ ] Coverage stays at 100%.
- [ ] The documentation explains the change if needed.
| # | Tool | Arguments | Result |
|---|---|---|---|
| No trace captured. | |||
F
=================================== FAILURES ===================================
_________________ test_frontend_exact_prefix_path_serves_index _________________
tmp_path = PosixPath('/private/tmp/swe_work/baseline_full_v2/fastapi_15800/b/tmp/pytest-of-jp/pytest-0/test_frontend_exact_prefix_pat0')
def test_frontend_exact_prefix_path_serves_index(tmp_path: Path):
dist = tmp_path / "dist"
write_file(dist / "index.html", "app")
app = FastAPI()
> app.frontend("/app", directory=dist)
^^^^^^^^^^^^
E AttributeError: 'FastAPI' object has no attribute 'frontend'
tests/test_frontend.py:24: AttributeError
=============================== warnings summary ===============================
../../../../../../../Users/jp/repos/kaggle-gemini-coding-agent-post-training/.envs/overlays/starlette-1.6.0-py3-none-any/starlette/testclient.py:53
/Users/jp/repos/kaggle-gemini-coding-agent-post-training/.envs/overlays/starlette-1.6.0-py3-none-any/starlette/testclient.py:53: DeprecationWarning: The anyio.abc.BlockingPortal alias is deprecated, use anyio.from_thread.BlockingPortal instead.
_PortalFactoryType = Callable[[], AbstractContextManager[anyio.abc.BlockingPortal]]
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
1 failed, 1 warning in 0.49s