Skip to content
Open
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
c5c2dfe
refactor(starlette): centralize active thread updates
faizansaiyed123 Oct 2, 2026
a14cd78
refactor(fastapi): use Starlette active thread helper
faizansaiyed123 Oct 2, 2026
87d3a13
chore(fastapi): remove unused thread helper import
faizansaiyed123 Oct 2, 2026
bdaadd5
refactor(fastapi): register active thread dependency globally
faizansaiyed123 Oct 2, 2026
1301df5
refactor(fastapi): remove private request handler patch
faizansaiyed123 Oct 2, 2026
4b487a3
test(fastapi): cover global dependency websocket compatibility
faizansaiyed123 Oct 2, 2026
ba306d1
style(fastapi): tidy global dependency setup
faizansaiyed123 Oct 2, 2026
d287e61
test(fastapi): preserve user global dependencies
faizansaiyed123 Oct 2, 2026
24f7914
test(fastapi): fix global dependency test placement
faizansaiyed123 Oct 2, 2026
19407b5
fix(starlette): preserve sync request scope access
faizansaiyed123 Oct 2, 2026
c0459e3
refactor(fastapi): move request setup into global dependency
faizansaiyed123 Oct 2, 2026
475f391
style(fastapi): tidy global dependency signature
faizansaiyed123 Oct 2, 2026
070f150
refactor(starlette): centralize sync thread wrapper
faizansaiyed123 Oct 2, 2026
3008a93
fix(fastapi): preserve sync endpoint thread tracking
faizansaiyed123 Oct 2, 2026
2af5b30
fix(fastapi): wrap effective route dependant
faizansaiyed123 Oct 2, 2026
ebcff1b
fix(fastapi): use effective dependant for sync routes
faizansaiyed123 Oct 2, 2026
6a70b84
test(fastapi): cover sync thread tracking in prefixed routes
faizansaiyed123 Oct 2, 2026
b55b5d6
style(fastapi): format thread metadata assertion
faizansaiyed123 Oct 2, 2026
b3e43e3
refactor(fastapi): restore request lifecycle in global dependency
faizansaiyed123 Oct 2, 2026
9a187d9
refactor(fastapi): simplify request event processor helper
faizansaiyed123 Oct 2, 2026
99ae098
test(fastapi): cover dependency order and request data
faizansaiyed123 Oct 2, 2026
cfb86e0
test(fastapi): enable tracing for dependency order check
faizansaiyed123 Oct 2, 2026
6f39b1e
test(fastapi): cover dependency order and request data
faizansaiyed123 Oct 2, 2026
fd54812
fix(fastapi): fall back to the routed dependant
faizansaiyed123 Oct 2, 2026
7b76b1f
test(fastapi): cover request data on all supported versions
faizansaiyed123 Oct 2, 2026
f824525
fix(fastapi): install request isolation with integration
faizansaiyed123 Oct 2, 2026
c428c6e
test(fastapi): isolate request event processors
faizansaiyed123 Oct 2, 2026
4cb785b
fix(starlette): reuse ASGI instrumentation for FastAPI
faizansaiyed123 Oct 2, 2026
0468859
test(fastapi): verify request processor cleanup
faizansaiyed123 Oct 2, 2026
1fc5ea8
sync starlette integration with verified PR state
faizansaiyed123 Oct 2, 2026
1e3d9c2
sync fastapi tests with verified PR state
faizansaiyed123 Oct 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test(fastapi): cover dependency order and request data
  • Loading branch information
faizansaiyed123 committed Oct 2, 2026
commit 99ae098eb50125b33a652af9fb096fdc19fa2d36
53 changes: 52 additions & 1 deletion tests/integrations/fastapi/test_fastapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,57 @@ async def _root():
assert calls == [True]


def test_global_dependency_runs_before_existing_dependencies(sentry_init):
seen_transaction_names = []

def custom_dependency():
transaction = sentry_sdk.get_current_scope().transaction
seen_transaction_names.append(transaction.name if transaction else None)

sentry_init(
auto_enabling_integrations=False,
integrations=[StarletteIntegration(), FastApiIntegration()],
)

app = FastAPI(dependencies=[Depends(custom_dependency)])

@app.get("/items/{item_id}")
async def _get_item(item_id: int):
return {"item_id": item_id}

response = TestClient(app).get("/items/123")

assert response.status_code == 200
assert seen_transaction_names == ["/items/{item_id}"]


@pytest.mark.skipif(
FASTAPI_VERSION < (0, 121),
reason="FastAPI < 0.121 uses Starlette's request_response implementation",
)
def test_global_dependency_captures_request_data(sentry_init, capture_events):
sentry_init(
auto_enabling_integrations=False,
integrations=[StarletteIntegration(), FastApiIntegration()],
send_default_pii=True,
)

app = FastAPI()

@app.post("/message")
async def _message():
capture_message("request body captured")
return {"message": "ok"}

events = capture_events()

response = TestClient(app).post("/message", json=BODY_JSON)

assert response.status_code == 200
(event,) = events
assert event["request"]["data"] == BODY_JSON


def test_global_dependency_does_not_break_websockets(sentry_init):
sentry_init(integrations=[FastApiIntegration()])

Expand Down Expand Up @@ -1364,4 +1415,4 @@ async def _error():
}
found = True

assert found, "No event with exception found"
assert found, "No event with exception found"