This is an automated email from the ASF dual-hosted git repository.

shahar1 pushed a commit to branch v3-4-test
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/v3-4-test by this push:
     new b4236dab7d1 [v3-4-test] Fix duplicated asset events when 
name_prefix_pattern matches all (#74816) (#76570)
b4236dab7d1 is described below

commit b4236dab7d1d264d9ceab7cc8e54738e9138937f
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Fri Nov 6 08:08:06 2026 +0000

    [v3-4-test] Fix duplicated asset events when name_prefix_pattern matches 
all (#74816) (#76570)
    
    The "~" match-all alias for name_prefix_pattern is transformed into an empty
    string, so the truthiness check skipped the join to the asset table while 
the
    filter still referenced it, and each event was returned once per asset.
    (cherry picked from commit 322c178e05b6621b9577e62e66964c1f4c0b590f)
    
    Co-authored-by: Sahil Ray <[email protected]>
    Co-authored-by: Henry Chen <[email protected]>
---
 airflow-core/src/airflow/api_fastapi/core_api/routes/public/assets.py   | 2 +-
 .../tests/unit/api_fastapi/core_api/routes/public/test_assets.py        | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git 
a/airflow-core/src/airflow/api_fastapi/core_api/routes/public/assets.py 
b/airflow-core/src/airflow/api_fastapi/core_api/routes/public/assets.py
index 003e880b81d..5025f02eb1f 100644
--- a/airflow-core/src/airflow/api_fastapi/core_api/routes/public/assets.py
+++ b/airflow-core/src/airflow/api_fastapi/core_api/routes/public/assets.py
@@ -346,7 +346,7 @@ def get_asset_events(
     # The regexp partition-key filter bounds the query runtime automatically 
(its dependency applies
     # ``apply_regex_query_timeout`` to this request's session), so no explicit 
wrapping is needed here.
     base_statement = select(AssetEvent)
-    if name_pattern.value or name_prefix_pattern.value:
+    if name_pattern.value is not None or name_prefix_pattern.value is not None:
         base_statement = base_statement.join(AssetModel, AssetEvent.asset_id 
== AssetModel.id)
 
     assets_event_select, total_entries = paginated_select(
diff --git 
a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_assets.py 
b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_assets.py
index d9ba3d5b9b6..bb6d55ac096 100644
--- a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_assets.py
+++ b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_assets.py
@@ -1365,6 +1365,8 @@ class TestGetAssetEvents(TestAssets):
             ({"name_prefix_pattern": "simple1"}, 1),
             ({"name_prefix_pattern": "simple"}, 2),
             ({"name_prefix_pattern": "nonexistent"}, 0),
+            ({"name_prefix_pattern": "~"}, 2),
+            ({"name_pattern": ""}, 2),
         ],
     )
     @provide_session

Reply via email to