This is an automated email from the ASF dual-hosted git repository. sadpandajoe pushed a commit to branch ultraset-semantic-layer-metric-index-type-mismatch in repository https://gitbox.apache.org/repos/asf/superset.git
commit ec55aaf03651544ae5cdb7872d6cb52d09f0bdf1 Author: Joe Li <[email protected]> AuthorDate: Sun Oct 11 08:21:08 2026 +0000 fix(semantic-layer): narrow ValidatedQueryObject.metrics to list[str] The nightly full-repo mypy run flags mapper.py:402 as indexing a dict[str, Metric] (the semantic-layer Metric dataclass) with a key typed AdhocMetric | str, because QueryObject.metrics is typed list[Metric] | None using the unrelated superset.superset_typing.Metric alias. ValidatedQueryObject already narrows filter, series_columns and series_limit_metric for this same reason but missed metrics. _validate_metrics already guarantees every entry is a str before _map_query_object runs, so this only corrects the static type to match the existing runtime guarantee. --- superset/semantic_layers/mapper.py | 1 + 1 file changed, 1 insertion(+) diff --git a/superset/semantic_layers/mapper.py b/superset/semantic_layers/mapper.py index c99c8e392f0..a054deb2f9a 100644 --- a/superset/semantic_layers/mapper.py +++ b/superset/semantic_layers/mapper.py @@ -125,6 +125,7 @@ class ValidatedQueryObject(QueryObject): filter: list[ValidatedQueryObjectFilterClause] # type: ignore[assignment] series_columns: Sequence[str] # type: ignore[assignment] series_limit_metric: str | None + metrics: list[str] | None # type: ignore[assignment] @dataclass(frozen=True)
