Subham-KRLX opened a new pull request, #63986:
URL: https://github.com/apache/airflow/pull/63986

   This PR fixes a critical `TypeError` crash that occurs when navigating to 
`/users/list` and `/roles/list` in the UI (specifically with 
`BS3TextFieldWidget`). 
   
   **Cause**: The 
[HookMetaService](cci:2://file:///Users/subhamsangwan/airflow/airflow-core/src/airflow/api_fastapi/core_api/services/ui/connections.py:37:0-291:21)
 for connections metadata in the API was using `unittest.mock.patch` to 
globally mock the WTForms and FAB widgets so it could extract param behavior. 
In a multi-threaded web server environment, if a user hits the FAB pages while 
the API concurrently runs the metadata extraction, `super(BS3TextFieldWidget, 
self)` inside FAB evaluates the mock class instead of the real base class, 
bringing down the UI endpoints with a Type mismatch.
   
   **Solution**: I removed the non-thread-safe `mock.patch` statements on 
global modules. Instead, the UI connections metadata hook now naturally 
introspects and delegates the parameters straight from the actual `WTForms` 
`UnboundField` variables when the FAB provider is installed, completely 
avoiding global namespace hijacking.
   
   * closes: #63982
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Gemini(for code research and pr description)
   


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