Repository navigation
[do not merge] testing merge - #8319
Merged
Merged
Conversation
Django tests take long, split them off into a separate group so that we can parallelize better. New layout: - **Web 1**: Django - **Web 2**: Flask, Starlette, FastAPI (the rest of the old Web 1) - **Web 3**: aiohttp, asgi, bottle, falcon, litestar, pyramid, quart, sanic, starlite, tornado (the old Web 2) <!-- junior-request-attribution:start --> via @sentrivana. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:slack%3AC0BTREZTS2Z%3A1794920307.639339 --> -- [View Session](https://junior-prod.sentry.dev/conversations/slack%3AC0BTREZTS2Z%3A1794920307.639339) [[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC0BTREZTS2Z%3A1794920307.639339/?project=4510944073809921) <!-- junior-session-footer:end --> Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: Ivana Kellyer <131587164+sentrivana@users.noreply.github.com>
…8302) The W3C baggage format allows optional whitespace around '=' in a list member. from_incoming_header only stripped the item as a whole, so 'sentry-sample_rand = 0.5' produced the key 'sample_rand ' and the value ' 0.5'. The incoming sample_rand was then ignored and the corrupted keys were re-sent downstream percent-encoded. ### Description <!-- What changed and why? --> #### Issues <!-- * resolves: #1234 * resolves: LIN-1234 --> #### Reminders - Please add tests to validate your changes, and lint your code using `uv run ruff`. - Add GH Issue ID _&_ Linear ID (if applicable) - PR title should use [conventional commit](https://develop.sentry.dev/engineering-practices/commit-messages/#type) style (`feat:`, `fix:`, `ref:`, `meta:`) - For external contributors: [CONTRIBUTING.md](https://github.com/getsentry/sentry-python/blob/master/CONTRIBUTING.md), [Sentry SDK development docs](https://develop.sentry.dev/sdk/), [Discord community](https://discord.gg/Ww9hbqr)
TL;DR: Get rid of cases where a name could be possibly undefined, because there exists a code branch where it's not set. ### Description Turns on mypy's `possibly-undefined` error code. It flags names that are only assigned on some code paths (in one `if` branch, inside a `try`, in a conditional import) and then used where they might not be bound. At runtime that's an `UnboundLocalError`, which in the SDK would crash the host app's code path. It reported 15 errors in 11 files. Nearly all were correct code that mypy couldn't prove was safe. They're fixed without changing behavior: - **Initialize before branching**: `name = None` in the Litestar/Starlite route handler patch (falls through to the existing `_DEFAULT_TRANSACTION_NAME` fallback), and moved `agent_name = None` out of the `try` in `langchain._get_request_data`. - **Restructure so the binding is obvious**: - `transport.py`: return `PoolManager` straight from the SOCKS `except ImportError` instead of tracking a `use_socks_proxy` flag. - `spotlight.py`: compute `spotlight_js_url` before the `try`. `urljoin` doesn't raise `URLError`, so the exception handling stays the same. - `chalice.py`: pick the patched class once and use it for both reading and patching `_get_view_function_response`, instead of checking the version twice. - `stdlib.py`: `set_on_span` starts as `None` and the tunnel block checks it instead of `span`. They're set together, and spans don't define `__bool__`, so the two checks are equivalent. - **Targeted ignore**: `grpc/aio/server.py` keeps its four explicit `request_streaming`/`response_streaming` branches, which are exhaustive, so the final `handler_factory(wrapped, ...)` call gets `# type: ignore[possibly-undefined]`. - **Fix an annotation**: `beam.raise_exception` always re-raises, so it now returns `NoReturn` instead of `None`. Latent bugs, fixed minimally (I don't know of a real trigger for either): - `mcp.py`: `_tool_handler_wrapper` and `_prompt_handler_wrapper` leave `handler_name` unbound if they get no positional args and no truthy `name` kwarg. That raises `UnboundLocalError` before the user's handler runs. Both now default to `"unknown"`, the same as `_resource_handler_wrapper` already does. - `quart.py`: `_request_websocket_started` leaves `request_websocket` unbound if neither a request nor a websocket context is active. That shouldn't happen for `request_started`/`websocket_started` signals. It now returns early in that case. The branches are reordered so the websocket context still wins when both are active, as before. `enable_error_code` now lists both `possibly-undefined` and `unused-awaitable` (from #8281, merged into this branch). The sibling mypy follow-up PRs will still conflict trivially on that line; merge the lists when rebasing. Follow-up from #8281. <!-- junior-request-attribution:start --> via @sentrivana. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3A7a83c05e74f882736a37443f4dfc9ae1 --> -- [View Session](https://junior-prod.sentry.dev/conversations/agent%3A7a83c05e74f882736a37443f4dfc9ae1) [[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A7a83c05e74f882736a37443f4dfc9ae1/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: Ivana Kellyer <131587164+sentrivana@users.noreply.github.com>
The spans may be split across multiple envelopes if the worker takes more than 5 seconds to start up, because the time-based flush condition can collect buckets before the corresponding segment has finished.
Run independent steps in parallel.
Contributor
Coverage Results 📊✅ 59186 passed | ⏭️ 3035 skipped | Total: 62221 | Pass Rate: 95.12% | Execution Time: 235m 9s 📊 Comparison with Base Branch
All tests are passing successfully. ✅ Patch coverage is 90.00% (9 of 10 changed executable lines covered; target 80%). Changed files with executable lines (8)
Coverage diff@@ Coverage Diff @@
## master #8319 +/-##
==========================================
- Coverage 90.25% 90.11% -0.14%
==========================================
Files 203 200 -3
Tracked lines 27330 22082 -5248
Branches 10242 7736 -2506
==========================================
- Hits 24665 19898 -4767
+ Misses 2665 2184 -481
+ Partials 1555 1276 -279Generated by Coverage Action |
sentrivana
force-pushed
the
ivana/major/test-test-merge
branch
from
November 17, 2026 16:03
c77adae to
1df5669
Compare
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.
Description
Issues
Reminders
uv run ruff.feat:,fix:,ref:,meta:)