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

shahar1 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 4726281b5ec Keep common.ai tripwires and module_loading types working 
after dependency upgrades (#76715)
4726281b5ec is described below

commit 4726281b5ec56c16dbf1064bb3c0ea7c5fdbb726
Author: Jarek Potiuk <[email protected]>
AuthorDate: Mon Nov 9 06:36:04 2026 +0100

    Keep common.ai tripwires and module_loading types working after dependency 
upgrades (#76715)
    
    The CI environment upgrade moves sqlglot to 30.27 and importlib-metadata to 
10.1.
    
    sqlglot 30.27 refuses RETURNING for Snowflake, so the data-modifying CTE 
tripwires stopped at the parser and never exercised the deep scan they exist to 
check. Such statements are still rejected, so this is test drift, not a safety 
regression.
    
    importlib-metadata 10 types distributions() as its new IDistribution 
protocol, which fails mypy for entry_points_with_dist. Callers only use members 
the protocol provides, so runtime behaviour is unchanged.
    
    Both changes also work with the currently locked versions, so they can land 
ahead of the upgrade.
    
    Generated-by: Claude Opus 5
---
 .../ai/tests/unit/common/ai/utils/test_sql_validation.py       | 10 +++++-----
 .../src/airflow_shared/module_loading/__init__.py              |  4 +++-
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git 
a/providers/common/ai/tests/unit/common/ai/utils/test_sql_validation.py 
b/providers/common/ai/tests/unit/common/ai/utils/test_sql_validation.py
index 5fc3ca114e0..671c8f45ee3 100644
--- a/providers/common/ai/tests/unit/common/ai/utils/test_sql_validation.py
+++ b/providers/common/ai/tests/unit/common/ai/utils/test_sql_validation.py
@@ -665,13 +665,13 @@ _WRITE_STATEMENTS = {
     "alter": "ALTER TABLE t ADD COLUMN c INT",
     "copy": "COPY t FROM '/tmp/x'",
     "grant": "GRANT SELECT ON t TO u",
-    "cte_delete": "WITH d AS (DELETE FROM t RETURNING *) SELECT * FROM d",
-    "cte_insert": "WITH d AS (INSERT INTO t VALUES (1) RETURNING *) SELECT * 
FROM d",
+    # No RETURNING in the CTE writes: sqlglot 30.27 refuses it for Snowflake, 
so the statement would
+    # stop at the parser and never reach the deep scan these cases exist to 
exercise.
+    "cte_delete": "WITH d AS (DELETE FROM t) SELECT * FROM d",
+    "cte_insert": "WITH d AS (INSERT INTO t VALUES (1)) SELECT * FROM d",
     # THEN DELETE is required: with THEN UPDATE the nested Update is still 
rejected once Merge
     # leaves the deny-list, which hides the gap.
-    "cte_merge": (
-        "WITH d AS (MERGE INTO t USING s ON t.id = s.id WHEN MATCHED THEN 
DELETE RETURNING *) SELECT * FROM d"
-    ),
+    "cte_merge": "WITH d AS (MERGE INTO t USING s ON t.id = s.id WHEN MATCHED 
THEN DELETE) SELECT * FROM d",
     "select_into": "SELECT * INTO n FROM t",
 }
 
diff --git 
a/shared/module_loading/src/airflow_shared/module_loading/__init__.py 
b/shared/module_loading/src/airflow_shared/module_loading/__init__.py
index 7bf01c475ac..adfbae8acf4 100644
--- a/shared/module_loading/src/airflow_shared/module_loading/__init__.py
+++ b/shared/module_loading/src/airflow_shared/module_loading/__init__.py
@@ -185,7 +185,9 @@ def _get_grouped_entry_points() -> dict[str, list[EPnD]]:
                     continue
                 seen_dist_names.add(normalized_name)
             for e in dist.entry_points:
-                mapping[e.group].append((e, dist))
+                # importlib_metadata >= 10 types this as its IDistribution 
protocol, which older
+                # releases and the stdlib lack; a cast would be redundant on 
those.
+                mapping[e.group].append((e, dist))  # type: ignore[arg-type]
         except Exception as e:
             log.warning("Error when retrieving package metadata (skipping it): 
%s, %s", dist, e)
     return mapping

Reply via email to