You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by jl...@apache.org on 2026/10/13 08:25:28 UTC

(superset) 01/01: fix(ci): narrow nullable filters in metric_filter_test and resync oxfmt formatting

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

sadpandajoe pushed a commit to branch ultraset-metric-filter-none-iterable-oxfmt-drift
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 25e5b992279dc0ef47373213d1e95a6c5b097c09
Author: Joe Li <jo...@preset.io>
AuthorDate: Tue Oct 13 08:24:59 2026 +0000

    fix(ci): narrow nullable filters in metric_filter_test and resync oxfmt formatting
    
    Nightly full-repo pre-commit run on master (1578b8cbc1) failed two
    unrelated hooks:
    
    - mypy (main): tests/unit_tests/semantic_layers/metric_filter_test.py:248
      iterated `query.filters`, typed `set[Filter] | None` on
      SemanticQuery (superset-core/src/superset_core/semantic_layers/types.py),
      without narrowing away None first. Only a full-repo mypy invocation
      surfaces it, since `superset_core.*` is configured with
      `follow_imports = "skip"` and a per-file/PR-scoped run never sees the
      real field type. Add `assert query.filters is not None`, the same
      idiom already used elsewhere in this test suite.
    
    - oxfmt (frontend): #45225 bumped oxfmt 0.71.0 -> 0.72.0, which
      reformats arrow functions whose body is a tagged `css` template
      literal differently than 0.71.0 did. Re-run the now-pinned oxfmt on
      the two affected files to resync them.
    
    Co-Authored-By: Claude Sonnet 5 <no...@anthropic.com>
---
 .../src/components/Typography/index.tsx            |  3 +--
 .../controls/VizTypeControl/VizTypeGallery.tsx     | 24 +++++++++-------------
 .../semantic_layers/metric_filter_test.py          |  1 +
 3 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/superset-frontend/packages/superset-ui-core/src/components/Typography/index.tsx b/superset-frontend/packages/superset-ui-core/src/components/Typography/index.tsx
index aff5b395786..5969f0c35af 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/Typography/index.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/Typography/index.tsx
@@ -23,8 +23,7 @@ export type { TitleProps } from 'antd/es/typography/Title';
 export type { ParagraphProps } from 'antd/es/typography/Paragraph';
 
 const StyledLink = styled(AntdTypography.Link)`
-    ${({ theme }) =>
-      css`
+    ${({ theme }) => css`
       && {
         color: ${theme.colorLink};
         &:hover {
diff --git a/superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeGallery.tsx b/superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeGallery.tsx
index 50900d2c733..04639f2d3fe 100644
--- a/superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeGallery.tsx
+++ b/superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeGallery.tsx
@@ -716,13 +716,11 @@ export default function VizTypeGallery(props: VizTypeGalleryProps) {
     >
       <LeftPane aria-label={t('Choose chart type')} role="tablist">
         <Selector
-          css={({ sizeUnit }) =>
-            // adjust style for not being inside a collapse
-            css`
-              margin: ${sizeUnit * 2}px;
-              margin-bottom: 0;
-            `
-          }
+          css={({ sizeUnit }) => // adjust style for not being inside a collapse
+          css`
+            margin: ${sizeUnit * 2}px;
+            margin-bottom: 0;
+          `}
           sectionId={Sections.AllCharts}
           selector={ALL_CHARTS}
           icon={<Icons.Ballot iconSize="m" />}
@@ -734,13 +732,11 @@ export default function VizTypeGallery(props: VizTypeGalleryProps) {
           onClick={clickSelector}
         />
         <Selector
-          css={({ sizeUnit }) =>
-            // adjust style for not being inside a collapse
-            css`
-              margin: ${sizeUnit * 2}px;
-              margin-bottom: 0;
-            `
-          }
+          css={({ sizeUnit }) => // adjust style for not being inside a collapse
+          css`
+            margin: ${sizeUnit * 2}px;
+            margin-bottom: 0;
+          `}
           sectionId={Sections.Featured}
           selector={FEATURED}
           icon={<Icons.FireOutlined iconSize="m" />}
diff --git a/tests/unit_tests/semantic_layers/metric_filter_test.py b/tests/unit_tests/semantic_layers/metric_filter_test.py
index 4761db0fc38..3a00486021a 100644
--- a/tests/unit_tests/semantic_layers/metric_filter_test.py
+++ b/tests/unit_tests/semantic_layers/metric_filter_test.py
@@ -245,6 +245,7 @@ def test_incompatible_filter_is_reported_without_breaking_chart(
     assert result["rejected_filters"][0]["column"] == column
     assert result["applied_filters"] == ([{"column": "category"}] if mixed else [])
     query: SemanticQuery = metric_view[1].get_table.call_args.args[0]
+    assert query.filters is not None
     assert {f.column.name for f in query.filters if f.column} == (
         {"category"} if mixed else set()
     )