Sriniketh24 commented on PR #67141:
URL: https://github.com/apache/airflow/pull/67141#issuecomment-4540745820
Pushed another fix — identified the actual root cause from the CI logs.
**Root cause:** `session.py` binds `request` in its own namespace via `from
flask import request` at import time. Patching `flask.request` has no effect on
that already-evaluated reference — `SessionExemptMixin.save_session` reads from
`airflow.providers.fab.www.session.request` (the local binding), not from
`flask.request`.
**Fix:** Changed both mock targets from `patch("flask.request")` to
`patch("airflow.providers.fab.www.session.request")`. The mock now intercepts
the exact name the code uses, so `request.path == "/any"` works correctly and
no `RuntimeError: Working outside of request context` is raised.
All other logic (MRO[2] target, `lambda *args, **kwargs`) remains correct.
The fix is purely this one-line patch-target correction (plus an explanatory
comment).
Would you be able to move this back out of draft once CI passes? Happy to
address any other feedback.
---
Drafted-by: Claude Code (claude-sonnet-4-6) (no human review before posting)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]