Skip to content

Fix FAB roles/users 500 caused by connection hook metadata mocks#68421

Open
Nishieee wants to merge 1 commit into
apache:v3-2-testfrom
Nishieee:fix-fab-mockanywidget-68354
Open

Fix FAB roles/users 500 caused by connection hook metadata mocks#68421
Nishieee wants to merge 1 commit into
apache:v3-2-testfrom
Nishieee:fix-fab-mockanywidget-68354

Conversation

@Nishieee

Copy link
Copy Markdown
Contributor

summary

fixes [#68354](#68354): FAB Security Roles/Users pages could 500 with TypeError: ... MockAnyWidget when /ui/connections/hook_meta ran concurrently in the same api-server process.

cause: HookMetaService._get_hooks_with_mocked_fab() used a global mock.patch on BS3TextFieldWidget. the guard checked "wtforms.StringField" not in sys.modules, which is always true (that submodule path is never registered), so the mock was applied even when FAB was already loaded.

fix: hook_meta_data() now uses ProvidersManager directly, with no runtime mocks. the guard is corrected to "wtforms" not in sys.modules.

tests: two regression tests added in test_connections.py (run with --skip-db-tests) verifying BS3TextFieldWidget is unchanged after both hook_meta_data() and _get_hooks_with_mocked_fab().

closes: #68354


Was generative AI tooling used to co-author this PR?

  • yes - Cursor (Auto)

Generated-by: Cursor (Auto), following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant