manish1337 commented on code in PR #72026:
URL: https://github.com/apache/airflow/pull/72026#discussion_r3885548349


##########
airflow-core/newsfragments/72026.bugfix.rst:
##########


Review Comment:
   Removed.



##########
airflow-core/src/airflow/api_fastapi/app.py:
##########
@@ -152,6 +153,11 @@ def create_app(apps: str = "all") -> FastAPI:
         init_error_handlers(app)
         init_middlewares(app)
 
+    # Every server backend disables its own access logger, so this is the only 
producer of access
+    # records and has to be installed whatever ``apps`` selects. Added last to 
stay outermost and
+    # time the full request lifecycle.

Review Comment:
   Moved to `init_access_logging()` and cut the docstring to one line, matching 
`init_plugins` next to it. `create_app` just calls it now.



##########
airflow-core/tests/unit/api_fastapi/test_app.py:
##########
@@ -88,6 +89,17 @@ def test_all_apps(mock_create_task_exec_api, 
mock_init_plugins, mock_init_views,
     mock_create_task_exec_api.assert_called_once_with()
 
 
[email protected]("apps", ["all", "core", "execution"])
+def test_access_log_middleware_installed_for_every_apps_selection(apps, 
client):
+    """Both server backends disable their own access logger, so a selection 
that skips this
+    middleware has no access logging at all; it must also stay outermost so 
the duration it
+    logs covers every inner middleware."""
+    installed = [m.cls for m in client(apps=apps).app.user_middleware]
+
+    assert installed.count(HttpAccessLogMiddleware) == 1
+    assert installed[0] is HttpAccessLogMiddleware

Review Comment:
   Removed. Also dropped the "stays outermost" line from the docstring since 
nothing asserts it now.



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