Skip to content

fix(starlette): Stop duplicating scope["root_path"] in URLs#6579

Merged
alexander-alderman-webb merged 22 commits into
masterfrom
webb/asgi/double-mount-prefix
Jun 26, 2026
Merged

fix(starlette): Stop duplicating scope["root_path"] in URLs#6579
alexander-alderman-webb merged 22 commits into
masterfrom
webb/asgi/double-mount-prefix

update django condition

dc3d352
Select commit
Loading
Failed to load commit list.
@sentry/warden / warden: find-bugs completed Jun 23, 2026 in 0s

2 issues

find-bugs: Found 3 issues (2 medium, 1 low)

Medium

Sentry monitoring silently disabled when Quart version is undetectable - `sentry_sdk/integrations/quart.py:97-99`

When package_version("quart") returns None (e.g. editable installs or unusual packaging), the or version is None guard causes the patched function to return the raw old_app without any Sentry middleware, silently dropping all transaction tracking and error capturing. The safe fallback is to use path_includes_root_path=False (old behavior) rather than skipping the middleware entirely.

test_request_url fails on Django < 5.1 due to incorrect skipif condition - `tests/integrations/django/asgi/test_asgi.py:1052-1101`

The test passes /root/nomessage as scope["path"] with scope["root_path"] = "/root", but for Django < 5.1 the integration uses path_includes_root_path=False, causing _get_url() to return "/root" + "/root/nomessage" = "/root/root/nomessage", which doesn't match the assertion == "/root/nomessage". The test should be guarded with skipif(django.VERSION < (5, 1)) or use a different path for older Django.

Low

Channels < 3.0.0 path missing `path_includes_root_path=False`, causing root_path to be dropped from URLs - `sentry_sdk/integrations/asgi.py:152-157`

In patch_channels_asgi_handler_impl, the SentryAsgiMiddleware created for the channels < 3.0.0 branch does not pass path_includes_root_path, so it inherits the new default of True. For Django < 5.1 (always the case with channels < 3.0.0), scope["path"] does not include scope["root_path"], so path_includes_root_path should be False — matching what patch_django_asgi_handler_impl explicitly does for the same Django version condition. When root_path is non-empty, the URL recorded in Sentry events will be missing the root path prefix.


⏱ 17m 25s · 4.1M in / 170.5k out · $5.85

Annotations

Check warning on line 99 in sentry_sdk/integrations/quart.py

See this annotation in the file changed.

@sentry-warden sentry-warden / warden: find-bugs

Sentry monitoring silently disabled when Quart version is undetectable

When `package_version("quart")` returns `None` (e.g. editable installs or unusual packaging), the `or version is None` guard causes the patched function to return the raw `old_app` without any Sentry middleware, silently dropping all transaction tracking and error capturing. The safe fallback is to use `path_includes_root_path=False` (old behavior) rather than skipping the middleware entirely.

Check warning on line 1101 in tests/integrations/django/asgi/test_asgi.py

See this annotation in the file changed.

@sentry-warden sentry-warden / warden: find-bugs

test_request_url fails on Django &lt; 5.1 due to incorrect skipif condition

The test passes `/root/nomessage` as `scope["path"]` with `scope["root_path"] = "/root"`, but for Django &lt; 5.1 the integration uses `path_includes_root_path=False`, causing `_get_url()` to return `"/root" + "/root/nomessage" = "/root/root/nomessage"`, which doesn't match the assertion `== "/root/nomessage"`. The test should be guarded with `skipif(django.VERSION < (5, 1))` or use a different path for older Django.