Skip to content

fix: clear the two Starlette deprecation warnings - #218

Merged
JohnRDOrazio merged 1 commit into
devfrom
fix/starlette-deprecations
Aug 19, 2026
Merged

fix: clear the two Starlette deprecation warnings#218
JohnRDOrazio merged 1 commit into
devfrom
fix/starlette-deprecations

Conversation

@JohnRDOrazio

@JohnRDOrazio JohnRDOrazio commented Aug 19, 2026

Copy link
Copy Markdown
Member

Clears both DeprecationWarnings the test suite was emitting after the dependency bumps in #215. Neither changes behaviour.

HTTP_413_REQUEST_ENTITY_TOO_LARGEHTTP_413_CONTENT_TOO_LARGE

Starlette 1.3.1 deprecated the old spelling. Both constants resolve to 413, and there is a single call site — the upload size guard in import_project (ontokit/api/routes/projects.py:197). The test asserting response.status_code == 413 is unaffected.

starlette.testclienthttpx2

starlette.testclient now imports httpx2 and falls back to httpx with a warning. Adding httpx2 to the dev group makes TestClient pick it up:

>>> import starlette.testclient as tc; tc.httpx.__name__
'httpx2'

httpx deliberately stays a runtime dependency — core/auth.py, services/github_service.py, services/user_service.py, services/embedding_providers/openai_provider.py and services/sitemap_notifier.py all use it directly, and test_auth_routes.py / test_github_service.py mock httpx.Response and httpx.HTTPStatusError against that runtime code.

Verification

  • ruff check, ruff format --check, mypy strict, pyright — all clean (0 errors)
  • uv lock --check consistent
  • 1535 tests pass, with zero deprecation warnings remaining (was 2)

Summary by CodeRabbit

  • Bug Fixes
    • Updated the import endpoint to use the current HTTP 413 status for oversized requests.
  • Chores
    • Added development tooling support for HTTP client testing.

Starlette 1.3.1 deprecated `HTTP_413_REQUEST_ENTITY_TOO_LARGE` in favour
of `HTTP_413_CONTENT_TOO_LARGE`. Both resolve to 413, so the swap at the
single call site in the project-import size guard is warning-only with no
behaviour change.

`starlette.testclient` now prefers `httpx2` and warns when it falls back
to `httpx`. Add `httpx2` to the dev group so TestClient picks it up.
`httpx` stays a runtime dependency — auth, github_service, user_service,
the OpenAI embedding provider and sitemap_notifier all use it directly,
and several test modules mock `httpx.Response` / `httpx.HTTPStatusError`
against that runtime code.

The test suite now runs with zero deprecation warnings.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c9aa4853-0926-4dfd-a626-fb50e1626c12

📥 Commits

Reviewing files that changed from the base of the PR and between 4f4627a and 76ef571.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • ontokit/api/routes/projects.py
  • pyproject.toml

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The import endpoint now uses the current HTTP 413 status constant. The development dependency group now includes httpx2>=2.12.0.

Changes

Import status response

Layer / File(s) Summary
Oversized import status constant
ontokit/api/routes/projects.py
The import error response uses HTTP_413_CONTENT_TOO_LARGE instead of HTTP_413_REQUEST_ENTITY_TOO_LARGE.

Development dependency

Layer / File(s) Summary
Add httpx2 development dependency
pyproject.toml
The dev dependency group includes httpx2>=2.12.0.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Merge Risk: ⚪ Minimal · up to 76ef5

This PR updates a deprecated status-code name and adds the test dependency needed to remove deprecation warnings without changing runtime behavior; no actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main purpose of the changes: clearing two Starlette deprecation warnings.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/starlette-deprecations

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Aug 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@JohnRDOrazio
JohnRDOrazio merged commit a21b7d5 into dev Aug 19, 2026
16 checks passed
@JohnRDOrazio
JohnRDOrazio deleted the fix/starlette-deprecations branch August 19, 2026 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant