Sriniketh24 opened a new pull request, #67141:
URL: https://github.com/apache/airflow/pull/67141

   ## Summary
   
   `_LazySafeSerializer.dumps()` uses `msgspec.msgpack` which returns `bytes`, 
but Werkzeug 3.0+ removed the automatic `bytes → str` coercion in 
`dump_cookie()`. This causes a `TypeError` when the session cookie is set, 
breaking login for FAB users on Werkzeug 3.0+.
   
   **Fix:** Switch the serializer from `msgspec.msgpack` to `msgspec.json` so 
`dumps()` returns `str`. The `loads()` method tries JSON first and falls back 
to msgpack for backward compatibility with sessions written before this change.
   
   closes: #64921
   
   ## Changes
   
   - **`providers/fab/src/airflow/providers/fab/www/session.py`**: Switch 
`_LazySafeSerializer` from `msgspec.msgpack` (bytes) to `msgspec.json` (str) 
encoding. `loads()` now tries JSON first and falls back to msgpack for legacy 
session data.
   - **`providers/fab/tests/unit/fab/www/test_session.py`**: Add 8 tests 
covering str return type, roundtrip, LazyString conversion, legacy msgpack 
backward compatibility, empty session, nested data, encode/decode aliases, and 
str/bytes input handling.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (Opus 4.6)
   
   Generated-by: Claude Code (Opus 4.6) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)


-- 
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]

Reply via email to