Skip to content

feat(semantic layers): dashboard filters - #40475

Merged
rusackas merged 4 commits into
masterfrom
semantic-view-dashboard-filters
Jul 10, 2026
Merged

rusackas merged 4 commits into
masterfrom
semantic-view-dashboard-filters

Conversation

@betodealmeida

Copy link
Copy Markdown
Member

SUMMARY

Allow using semantic views in dashboard filters.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@codecov

codecov Bot commented May 27, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 63.91753% with 70 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.74%. Comparing base (b421813) to head (58c1f10).
⚠️ Report is 7 commits behind head on master.

Files with missing lines Patch % Lines
...onfigModal/FiltersConfigForm/FiltersConfigForm.tsx 22.91% 37 Missing ⚠️
...tersConfigModal/FiltersConfigForm/ColumnSelect.tsx 46.42% 15 Missing ⚠️
...ersConfigModal/FiltersConfigForm/DatasetSelect.tsx 65.71% 12 Missing ⚠️
...ters/FiltersConfigModal/FiltersConfigForm/utils.ts 90.24% 4 Missing ⚠️
...mponents/nativeFilters/FiltersConfigModal/utils.ts 0.00% 1 Missing ⚠️
...src/features/datasets/DatasetSelectLabel/index.tsx 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #40475      +/-   ##
==========================================
+ Coverage   64.72%   64.74%   +0.01%     
==========================================
  Files        2686     2688       +2     
  Lines      148683   148887     +204     
  Branches    34322    34395      +73     
==========================================
+ Hits        96240    96400     +160     
- Misses      50678    50720      +42     
- Partials     1765     1767       +2     
Flag Coverage Δ
hive 39.20% <0.00%> (+<0.01%) ⬆️
javascript 69.59% <63.35%> (+<0.01%) ⬆️
mysql 57.87% <0.00%> (+0.02%) ⬆️
postgres 57.94% <0.00%> (+0.02%) ⬆️
presto 40.73% <0.00%> (+<0.01%) ⬆️
python 59.33% <100.00%> (+0.02%) ⬆️
sqlite 57.52% <0.00%> (+0.02%) ⬆️
unit 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@betodealmeida
betodealmeida force-pushed the semantic-view-dashboard-filters branch 2 times, most recently from 82a0eab to 5e46103 Compare May 28, 2026 21:09
@betodealmeida
betodealmeida marked this pull request as ready for review May 28, 2026 21:30
@dosubot dosubot Bot added the dashboard:native-filters Related to the native filters of the Dashboard label May 28, 2026

@bito-code-review bito-code-review Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Agent Run #37e9f4

Actionable Suggestions - 1
  • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/utils.ts - 1
Additional Suggestions - 5
  • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/ColumnSelect.tsx - 1
    • CWE-13616: Type Field Omitted in Column Object · Line 126-131
      The column object built from semantic view dimensions (lines 126-131) omits the `type` field, while the same transformation in `FiltersConfigForm.tsx` line 778 includes `type: dim.type`. This inconsistency means column metadata differs based on which component loaded it, which could cause unexpected behavior if downstream code expects the `type` field.
      Code suggestion
      --- superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/ColumnSelect.tsx (lines 126-131) ---
       126:                 return {
       127:                   column_name: dim.name,
       128: +                 type: dim.type,
       129:                   is_dttm: mappedType === GenericDataType.Temporal,
       130:                   type_generic: mappedType,
       131:                   filterable: true,
       132:                 };
  • superset-frontend/packages/superset-ui-core/src/query/types/Dashboard.ts - 1
    • Type should use DatasourceType enum · Line 41-41
      Using `string` type for `datasourceType` bypasses the existing `DatasourceType` enum which defines valid values (`Table`, `Query`, `Dataset`, `SlTable`, `SavedQuery`, `SemanticView`). This reduces type safety and allows invalid string values to be assigned. The three transformer files already using this field (`filterTransformer.ts`, `customizationTransformer.ts`, `utils.ts`) all assign from form inputs that should map to enum values. Aligning the type ensures compile-time validation and consistency with how `datasourceType` is typed elsewhere in the codebase.
      Code suggestion
      --- superset-frontend/packages/superset-ui-core/src/query/types/Dashboard.ts
      +++ superset-frontend/packages/superset-ui-core/src/query/types/Dashboard.ts
       @@ -17,6 +17,7 @@
         */
       
        import { AdhocFilter, DataMask } from '@superset-ui/core';
      +import { DatasourceType } from './Datasource';
       
        export interface ColumnOption {
          label: string;
       @@ -38,7 +39,7 @@ export interface NativeFilterScope {
       export interface NativeFilterTarget {
          datasetId: number;
          column: NativeFilterColumn;
      -  datasourceType?: string;
      +  datasourceType?: DatasourceType;
       
          // maybe someday support this?
          // show values from these columns in the filter options selector
  • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/transformers/filterTransformer.ts - 1
    • Missing unit tests for transformer · Line 100-102
      The `buildFilterTarget` function now transforms `datasourceType` but lacks dedicated unit tests. Per rule [6262], tests should verify actual business logic (data transformation) not just component rendering. Add test coverage for `buildFilterTarget` covering `datasourceType` propagation.
  • superset-frontend/src/features/datasets/DatasetSelectLabel/index.tsx - 1
    • CWE-691: Redundant Label · Line 108-108
      The `parentLabelLower(item.kind)` label is semantically misleading for datasets. The function returns 'database' for non-semantic-view items, producing 'database: ' which is redundant — the database name is already shown below in StyledLabelDetail. This label adds noise without clarifying information.
  • superset-frontend/src/features/semanticLayers/label.ts - 1
    • Missing return type annotation · Line 76-77
      The new `parentLabelLower` function is missing an explicit return type hint. Per organizational standards, all functions should include explicit return type annotations for consistency and better static type checking.
Filtered by Review Rules

Bito filtered these suggestions based on rules created automatically for your feedback. Manage rules.

  • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/DatasetSelect.tsx - 1
Review Details
  • Files reviewed - 23 · Commit Range: 6a82ead..31758e3
    • superset-core/src/superset_core/semantic_layers/types.py
    • superset-frontend/packages/superset-ui-core/src/query/types/Dashboard.ts
    • superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterValue.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/ColumnSelect.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/DatasetSelect.test.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/DatasetSelect.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/getControlItemsMap.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/utils.test.ts
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/utils.ts
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/transformers/customizationTransformer.ts
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/transformers/filterTransformer.ts
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/types.ts
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/utils.ts
    • superset-frontend/src/dashboard/components/nativeFilters/utils.ts
    • superset-frontend/src/dashboard/reducers/dashboardInfo.test.ts
    • superset-frontend/src/dashboard/reducers/dashboardInfo.ts
    • superset-frontend/src/features/datasets/DatasetSelectLabel/index.tsx
    • superset-frontend/src/features/semanticLayers/label.ts
    • superset/semantic_layers/api.py
    • superset/semantic_layers/mapper.py
    • tests/unit_tests/semantic_layers/api_test.py
    • tests/unit_tests/semantic_layers/mapper_test.py
  • Files skipped - 1
    • superset-frontend/package-lock.json - Reason: Filter setting
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Eslint (Linter) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

Comment on lines +133 to +135
if (formInputs.datasourceType) {
target.datasourceType = formInputs.datasourceType;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SEMANTIC_DUPLICATION

The added datasourceType assignment (lines 133-135) duplicates existing logic in filterTransformer.ts:100-101 and customizationTransformer.ts:95-96. This creates maintenance risk where future changes to this pattern require updates in three places. Consider extracting a shared helper function.

Code Review Run #37e9f4


Should Bito avoid suggestions like this for future reviews? (Manage Rules)

  • Yes, avoid them

@betodealmeida
betodealmeida force-pushed the semantic-view-dashboard-filters branch from 31758e3 to fe0def2 Compare June 1, 2026 13:46
@netlify

netlify Bot commented Jun 1, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 58c1f10
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6a4be763a3739600087a7d08
😎 Deploy Preview https://deploy-preview-40475--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Comment on lines +76 to +77
export const parentLabelLower = (kind?: string) =>
kind === 'semantic_view' ? t('semantic layer') : t('database');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: This new label helper bypasses the existing sl(...) feature-flag logic and always uses "database" for non-semantic-view items, so when semantic layers are enabled the UI will show inconsistent terminology ("database" here vs "data connection" elsewhere). Route the fallback branch through the same feature-flag-aware label helper used by the other database labels. [logic error]

Severity Level: Major ⚠️
- ⚠️ Native filter dataset tooltip shows inconsistent parent label string.
- ⚠️ Semantic layers experience uses mixed "database" and "data connection" terms.
Steps of Reproduction ✅
1. Observe that semantic-layer-aware labels use the `sl` helper in
`superset-frontend/src/features/semanticLayers/label.ts`: `databaseLabelLower` at lines
57–58 calls `sl(t('database'), t('data connection'))`, and `sl` itself at lines 30–32
returns the "semantic" label when `isFeatureEnabled(SEMANTIC_LAYERS_FLAG)` is true.

2. Note that the new `parentLabelLower` helper in the same file at lines 71–77 does not
use `sl` and instead hardcodes `t('semantic layer')` for `kind === 'semantic_view'` and
`t('database')` for all other kinds, so it never produces "data connection" even when
`SEMANTIC_LAYERS` is enabled.

3. Follow an actual caller:
`superset-frontend/src/features/datasets/DatasetSelectLabel/index.tsx` lines 16–31 render
a tooltip for datasets and call `parentLabelLower(item.kind)` on line 29 to render the
parent label before the database name in the tooltip description.

4. Trace how this label is used in real UI flows: `DatasetSelectLabel` is used by
`DatasetSelect` in
`superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/DatasetSelect.tsx`
at lines 7–15 and 120–15, and `DatasetSelect` is used in the native filters config form
and in chart creation (`superset-frontend/src/pages/ChartCreation/index.tsx` lines 4–11).
When the `SemanticLayers` feature flag is enabled (checked via
`isFeatureEnabled(FeatureFlag.SemanticLayers)` in `DatasetSelect.tsx` line 32 and via
`SEMANTIC_LAYERS_FLAG` in `label.ts`), the rest of the UI shows "data connection" (e.g.,
`DatabaseList` uses `databaseLabelLower()` at
`superset-frontend/src/pages/DatabaseList/index.tsx` lines 5–8 and 80–82), but
`parentLabelLower` still renders "database" for non-`semantic_view` items, so a user
opening the dataset selector or native filter dataset tooltip will see inconsistent
terminology ("database: …" here vs "data connection" elsewhere).

Fix in Cursor | Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-frontend/src/features/semanticLayers/label.ts
**Line:** 76:77
**Comment:**
	*Logic Error: This new label helper bypasses the existing `sl(...)` feature-flag logic and always uses "database" for non-semantic-view items, so when semantic layers are enabled the UI will show inconsistent terminology ("database" here vs "data connection" elsewhere). Route the fallback branch through the same feature-flag-aware label helper used by the other database labels.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

const newFormData = getFormData({
...filter,
datasetId,
datasourceType,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: datasourceType is now part of the query payload, but it is not included in the effect dependency list that triggers data refreshes. If the datasource type changes while datasetId stays the same (the exact collision case this PR introduces), the effect can keep using stale form data and skip refetching, so filter options can come from the wrong datasource. Add datasourceType to the effect dependencies so switching datasource kind always rebuilds and reloads the filter query. [stale reference]

Severity Level: Major ⚠️
- ❌ Native filter options use columns from old datasource.
- ⚠️ Semantic view filters may query wrong backend dataset.
Steps of Reproduction ✅
1. In the native filter configuration flow, `FiltersConfigForm` computes `datasetId` and
`datasourceType` for each filter (see
`superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx:11-23`),
where `datasetId` and `datasourceType` are derived from `filterToEdit?.targets?.[0]` /
`customizationToEdit?.targets?.[0]`.

2. `ColumnSelect` shows that datasets and semantic views can share the same numeric ID but
differ in `datasourceType` (see
`superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/ColumnSelect.tsx:96-101`),
and explicitly constructs `datasourceKey = \`${datasetId}__${datasourceType || 'table'}\``
so switching between `'table'` and `'semantic_view'` with the same `datasetId` is a real,
supported scenario.

3. At runtime, `FilterControl` renders `FilterValue` for each native filter (see
`superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterControl.tsx:20-34`),
and `FilterValue` destructures `datasetId` and `datasourceType` from `filter.targets[0]`
(see `FilterValue.tsx` around lines 28-37), then uses both when building `newFormData`
inside the `useEffect` shown in the PR hunk (lines 217-227), passing `datasetId` and
`datasourceType` into `getFormData`.

4. That `useEffect`'s dependency array (shown in `FilterValue.tsx` lines 193-206) includes
`datasetId` but not `datasourceType`, even though `datasourceType` participates in the
query payload (line 220). Therefore, when a filter's `targets[0].datasourceType` changes
(e.g., user switches from a physical dataset to a semantic view that reuses the same
`datasetId`, a scenario explicitly called out in `ColumnSelect.tsx:96-101`), it is
possible for all listed dependencies (`datasetId`, `dependencies`, `filter`, etc.) to
remain referentially unchanged while `datasourceType` changes, so this effect does not
rerun and `formData` stays bound to the old datasource kind, causing the filter query to
hit the wrong datasource until some other dependency changes or the dashboard reloads.

Fix in Cursor | Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterValue.tsx
**Line:** 220:220
**Comment:**
	*Stale Reference: `datasourceType` is now part of the query payload, but it is not included in the effect dependency list that triggers data refreshes. If the datasource type changes while `datasetId` stays the same (the exact collision case this PR introduces), the effect can keep using stale form data and skip refetching, so filter options can come from the wrong datasource. Add `datasourceType` to the effect dependencies so switching datasource kind always rebuilds and reloads the filter query.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

@bito-code-review bito-code-review Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Agent Run #15656f

Actionable Suggestions - 1
  • superset-core/src/superset_core/semantic_layers/types.py - 1
Additional Suggestions - 5
  • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/utils.ts - 1
    • Incomplete type mapping coverage · Line 104-146
      The `mapSemanticTypeToGenericDataType` function fails to map several common SQL semantic types to generic data types. Types like 'tinyint', 'bigint', 'smallint', 'integer', 'numeric', 'varchar', and 'text' will return `undefined` instead of their appropriate `GenericDataType`. This affects filter column selection in dashboards when these common column types are used.
      Code suggestion
      --- superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/utils.ts
      +++ superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/utils.ts
       @@ -127,7 +127,7 @@ export const mapSemanticTypeToGenericDataType = (
          }
       
          if (
      -    /(\b(u?int\d*)\b|\bfloat\d*\b|\bdouble\b|\bdecimal\d*\b|\bnumber\b)/.test(
      +    /(\b(u?int\d*)\b|\bfloat\d*\b|\bdouble\b|\bdecimal\d*\b|\bnumber\b|\b(big|small|tiny|medium)?int(eger)?\b|\bnumeric\b|\breal\b)/.test(
              normalized,
            )
          ) {
       @@ -134,7 +134,7 @@ export const mapSemanticTypeToGenericDataType = (
          }
       
          if (
      -    /(\bstr(ing)?\b|\butf8\b|\blarge_string\b|\bbinary\b|\bjson\b|\buuid\b)/.test(
      +    /(\bstr(ing)?\b|\butf8\b|\blarge_string\b|\bbinary\b|\bjson\b|\buuid\b|\b(var)?char\d*\b|\btext\b)/.test(
              normalized,
            )
          ) {
  • superset-frontend/packages/superset-ui-core/src/query/types/Dashboard.ts - 1
    • Use DatasourceType enum not string · Line 41-41
      The field uses raw `string` type instead of the typed `DatasourceType` enum defined in `Datasource.ts`. This creates a type-safety gap: the codebase policy (AGENTS.md § TypeScript) explicitly prohibits `any`/untyped strings, and `Datasource` interface at line 43 correctly uses `type: DatasourceType`. Import `DatasourceType` and use the enum to match the established pattern.
      Code suggestion
      --- superset-frontend/packages/superset-ui-core/src/query/types/Dashboard.ts
      +++ superset-frontend/packages/superset-ui-core/src/query/types/Dashboard.ts
       @@ -18,6 +18,7 @@
         */
       
        import { AdhocFilter, DataMask } from '@superset-ui/core';
      +import { DatasourceType } from './Datasource';
       
        export interface ColumnOption {
          label: string;
       @@ -38,7 +39,7 @@ export interface NativeFilterScope {
        export interface NativeFilterTarget {
          datasetId: number;
          column: NativeFilterColumn;
      -  datasourceType?: string;
      +  datasourceType?: DatasourceType;
       
          // maybe someday support this?
          // show values from these columns in the filter options selector
  • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/types.ts - 2
    • Type consistency: string vs enum · Line 57-57
      The `datasourceType?: string` on line 57 uses a plain string type. Elsewhere in the codebase (e.g., `Dashboard.ts:41`, `superset-ui-chart-controls/src/types.ts:73`), `DatasourceType` enum is used for datasource type values. For consistency and type safety, consider `datasourceType?: DatasourceType`.
    • Type consistency: string vs enum · Line 95-95
      The `datasourceType?: string` on line 95 uses a plain string type. For consistency with `NativeFiltersFormItem` (line 57) and `DatasourceType` enum usage elsewhere, consider `datasourceType?: DatasourceType`.
  • superset-frontend/src/features/datasets/DatasetSelectLabel/index.tsx - 1
    • Schema fallback removed · Line 111-115
      The schema display logic changed from showing 'Schema: Not defined' for invalid schemas to silently hiding the schema row when invalid. This may be intentional UX improvement but removes explicit feedback about data quality issues. Consider documenting this behavior change or restoring the fallback if users need to see incomplete dataset metadata.
Filtered by Review Rules

Bito filtered these suggestions based on rules created automatically for your feedback. Manage rules.

  • superset/semantic_layers/mapper.py - 1
Review Details
  • Files reviewed - 23 · Commit Range: fe0def2..fe0def2
    • superset-core/src/superset_core/semantic_layers/types.py
    • superset-frontend/packages/superset-ui-core/src/query/types/Dashboard.ts
    • superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterValue.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/ColumnSelect.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/DatasetSelect.test.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/DatasetSelect.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/getControlItemsMap.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/utils.test.ts
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/utils.ts
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/transformers/customizationTransformer.ts
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/transformers/filterTransformer.ts
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/types.ts
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/utils.ts
    • superset-frontend/src/dashboard/components/nativeFilters/utils.ts
    • superset-frontend/src/dashboard/reducers/dashboardInfo.test.ts
    • superset-frontend/src/dashboard/reducers/dashboardInfo.ts
    • superset-frontend/src/features/datasets/DatasetSelectLabel/index.tsx
    • superset-frontend/src/features/semanticLayers/label.ts
    • superset/semantic_layers/api.py
    • superset/semantic_layers/mapper.py
    • tests/unit_tests/semantic_layers/api_test.py
    • tests/unit_tests/semantic_layers/mapper_test.py
  • Files skipped - 1
    • superset-frontend/package-lock.json - Reason: Filter setting
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Eslint (Linter) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

column: Dimension | Metric | None
operator: Operator
value: FilterValues | frozenset[FilterValues]
value: FilterValues | tuple[FilterValues, ...] | frozenset[FilterValues]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heterogeneous order comparison crash

The order=True decorator generates __lt__/__gt__ etc. comparing fields left-to-right. When value is a tuple in one Filter and a frozenset in another (both valid per the new union), Python raises TypeError: '<' not supported between instances of 'tuple' and 'frozenset' at runtime. This surfaces when set[Filter] is iterated or sorted. Either remove order=True or split into separate homogeneous dataclasses for each collection type.

Code suggestion
Check the AI-generated fix before applying
 --- a/superset-core/src/superset_core/semantic_layers/types.py
 +++ b/superset-core/src/superset_core/semantic_layers/types.py
 @@ -153,7 +153,7 @@ class PredicateType(enum.Enum):
      HAVING = "HAVING"
 
 
 -@dataclass(frozen=True, order=True)
 +@dataclass(frozen=True)
  class Filter:
      type: PredicateType
      column: Dimension | Metric | None

Code Review Run #15656f


Should Bito avoid suggestions like this for future reviews? (Manage Rules)

  • Yes, avoid them

@richardfogaca richardfogaca left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Posting on Richard's behalf - this is his PR reviewer agent. Forward any pushback to him and he'll loop me back in.

Left two notes below - both are about semantic-view behavior diverging from the datasource type that the PR is now carrying through the filter config. All line numbers verified against HEAD fe0def2.

Functional - worth checking before merge

  • superset/semantic_layers/mapper.py:582-583

    The native filter UI still offers the text match modes as ILIKE, but semantic-view queries currently collapse ILIKE and NOT_ILIKE into LIKE and NOT_LIKE. That makes contains / starts-with / ends-with filters case-sensitive or case-insensitive depending on the semantic backend's collation, which can diverge from what the dashboard author selected.

    WDYT - could we either carry explicit case-insensitive operators through the semantic-layer contract, or disable those match types for semantic views until that behavior is supported end to end?

  • superset-frontend/src/dashboard/util/charts/getFormDataWithExtraFilters.ts:310-320

    Chart customizations now persist targets[].datasourceType, but this matching path still compares only the numeric ID parsed from form_data.datasource. Since tables and semantic views have independent ID spaces, a customization targeting semantic view 1 can also match a chart on table 1 here, and the same ID-only comparison is used when deriving related charts in superset-frontend/src/dashboard/util/getRelatedCharts.ts:126-142.

    Could we include the parsed datasource type in these comparisons as well, so semantic-view customizations only apply to __semantic_view charts?

Praise

  • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/DatasetSelect.tsx:64

    The composite select value is a nice way to avoid dataset / semantic-view ID collisions inside AsyncSelect while still handing the rest of the form the numeric ID shape it already expects.

@kgabryje kgabryje left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good from my side, looks ready to merge once Richard's comment is addressed

@rusackas rusackas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bot feedback incoming!

The one I'd want settled before merging is the ID-only match in getFormDataWithExtraFilters.ts and getRelatedCharts.ts - now that targets carry datasourceType, a customization on semantic_view 1 looks like it'd still match a chart on table 1 there since those consumers weren't touched. Is that a real collision, or am I missing where it's disambiguated?

@betodealmeida
betodealmeida force-pushed the semantic-view-dashboard-filters branch 2 times, most recently from dbb9217 to 4492d10 Compare June 29, 2026 19:37

@bito-code-review bito-code-review Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Agent Run #1a039c

Actionable Suggestions - 3
  • tests/unit_tests/semantic_layers/api_test.py - 1
  • superset-frontend/src/features/semanticLayers/label.ts - 1
  • superset-frontend/src/features/datasets/DatasetSelectLabel/index.tsx - 1
Additional Suggestions - 3
  • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/DatasetSelect.tsx - 1
    • Missing test for semantic layers integration · Line 174-191
      No test coverage exists for the new `handleChange` (lines 174-191) and `selectValue` (lines 161-167) logic paths that activate when the `SemanticLayers` feature flag is enabled. The existing tests at lines 268-312 test `loadDatasetOptions` in isolation but do not exercise the component's internal conversion of numeric IDs to/from composite strings. Without these tests, if `isFeatureEnabled` is mocked incorrectly or the conversion functions change, the integration will silently break.
  • superset-frontend/src/dashboard/components/nativeFilters/utils.ts - 1
    • Missing test for datasourceType · Line 81-82
      The new `datasourceType` parameter (lines 49, 66) lacks test coverage. The existing test at utils.test.ts:89-102 calls `getFormData` without this parameter, so the fallback to 'table' isn't explicitly validated when a type IS provided. Per rule [6262], tests should verify actual business logic, not just rendering.
  • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx - 1
    • Type shape mismatch · Line 1189-1189
      The `datasetInfo` field receives the full `value` object which includes `kind?: string`, but `NativeFiltersFormItem.datasetInfo` type expects `{ label, value, table_name? }` without `kind`. This creates a type inconsistency where extra properties may leak through. While TypeScript's structural typing allows this, downstream consumers expecting only documented fields could behave unexpectedly.
Review Details
  • Files reviewed - 29 · Commit Range: 5bbca69..28e1cf5
    • superset-core/src/superset_core/semantic_layers/types.py
    • superset-frontend/packages/superset-ui-core/src/query/types/Dashboard.ts
    • superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterValue.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/ColumnSelect.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/DatasetSelect.test.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/DatasetSelect.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/getControlItemsMap.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/utils.test.ts
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/utils.ts
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/transformers/buildTarget.test.ts
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/transformers/buildTarget.ts
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/transformers/customizationTransformer.ts
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/transformers/filterTransformer.ts
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/types.ts
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/utils.ts
    • superset-frontend/src/dashboard/components/nativeFilters/utils.ts
    • superset-frontend/src/dashboard/reducers/dashboardInfo.test.ts
    • superset-frontend/src/dashboard/reducers/dashboardInfo.ts
    • superset-frontend/src/dashboard/util/charts/getFormDataWithExtraFilters.ts
    • superset-frontend/src/dashboard/util/getFormDataWithExtraFilters.test.ts
    • superset-frontend/src/dashboard/util/getRelatedCharts.test.ts
    • superset-frontend/src/dashboard/util/getRelatedCharts.ts
    • superset-frontend/src/features/datasets/DatasetSelectLabel/index.tsx
    • superset-frontend/src/features/semanticLayers/label.ts
    • superset/semantic_layers/api.py
    • superset/semantic_layers/mapper.py
    • tests/unit_tests/semantic_layers/api_test.py
    • tests/unit_tests/semantic_layers/mapper_test.py
  • Files skipped - 1
    • superset-frontend/package-lock.json - Reason: Filter setting
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Eslint (Linter) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

mock_dim.grain = None

mock_view = MagicMock()
mock_view.name = "customers"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test incomplete assertion coverage

The mock_view.name is set to "customers" on line 2207, but unlike test_get_semantic_view_structure (which has the matching assertion on line 2124), this test lacks verification that the name is present in the API response. Per BITO.md rule [6262], tests must validate actual business logic, not merely confirm components render without errors.

Code Review Run #1a039c


Should Bito avoid suggestions like this for future reviews? (Manage Rules)

  • Yes, avoid them

Comment on lines +76 to +77
export const parentLabelLower = (kind?: string) =>
kind === 'semantic_view' ? t('semantic layer') : t('database');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing unit test coverage

The new parentLabelLower function has no unit tests. Per BITO.md rules [6262] and [11730], new tools/functions should have comprehensive unit tests covering success paths, error scenarios, and edge cases.

Code Review Run #1a039c


Should Bito avoid suggestions like this for future reviews? (Manage Rules)

  • Yes, avoid them

{item.schema && isValidValue(item.schema)
? item.schema
: t('Not defined')}
{parentLabelLower(item.kind)}:{' '}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semantic_view tests

The new parentLabelLower(item.kind) call at line 108 changes display behavior based on item.kind === 'semantic_view' vs undefined, but DatasetSelect.test.tsx only tests regular datasets without kind set. Add coverage for semantic_view to verify the label transformation logic per rule 6262. Also, schema: string in the type (line 33) should be schema?: string to match the optional guard used on lines 111-114.

Code Review Run #1a039c


Should Bito avoid suggestions like this for future reviews? (Manage Rules)

  • Yes, avoid them

@mikebridge mikebridge left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work — solid, well-tested feature, cleanly gated behind SEMANTIC_LAYERS; requesting changes only for a couple of frontend type-safety items before merge.

Should fix before merge

  • Unify datasourceType on the DatasourceType enum. The field is the enum in types.ts / buildTarget.ts / Dashboard.ts, but the form/control path types it as a bare string and branches on hand-written 'semantic_view' / 'table' literals in ~8 places — e.g. FiltersConfigForm.tsx:411, getControlItemsMap.tsx:51, ColumnSelect.tsx:43, nativeFilters/utils.ts:1323, FilterValue.tsx:145. It only works because the enum values happen to equal those strings. Standardize on DatasourceType.SemanticView / DatasourceType.Table everywhere so the enum's exhaustiveness actually buys us something.

  • Drop the as unknown as cast in doesChartMatchFilterDatasource (FiltersConfigModal/FiltersConfigForm/utils.ts:1026). The double cast to reach datasource_type disables structural checking because DatasourcesState doesn't declare the field. Add it to the type and drop the cast; if it isn't guaranteed at runtime, the fallback is silently relying on undefined.

Also: fill in the PR description/testing instructions (both blank) and drop the unrelated package-lock.json churn.

This review was generated by Claude (AI) on behalf of @mikebridge.

@betodealmeida
betodealmeida force-pushed the semantic-view-dashboard-filters branch from 28e1cf5 to 58c1f10 Compare July 6, 2026 17:35
@betodealmeida
betodealmeida requested a review from mikebridge July 6, 2026 17:36

@bito-code-review bito-code-review Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Agent Run #768548

Actionable Suggestions - 1
  • superset-frontend/src/dashboard/types.ts - 1
    • Mismatch: TS type added, backend not serializing · Line 234-236
Additional Suggestions - 1
  • superset-frontend/src/dashboard/util/getFormDataWithExtraFilters.test.ts - 1
    • Use enum instead of any cast · Line 581-581
      Use the `DatasourceType` enum from `@superset-ui/core` instead of a string literal cast to `any`. The enum is already defined in `packages/superset-ui-core/src/query/types/Datasource.ts` as `SemanticView = 'semantic_view'`, so importing it eliminates the type workaround.
Filtered by Review Rules

Bito filtered these suggestions based on rules created automatically for your feedback. Manage rules.

  • superset-frontend/src/features/semanticLayers/label.ts - 1
  • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/ColumnSelect.tsx - 1
    • Missing column reset in SemanticView branch · Line 118-145
Review Details
  • Files reviewed - 30 · Commit Range: 5a92459..58c1f10
    • superset-core/src/superset_core/semantic_layers/types.py
    • superset-frontend/packages/superset-ui-core/src/query/types/Dashboard.ts
    • superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterValue.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/ColumnSelect.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/DatasetSelect.test.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/DatasetSelect.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/getControlItemsMap.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/utils.test.ts
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/utils.ts
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/transformers/buildTarget.test.ts
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/transformers/buildTarget.ts
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/transformers/customizationTransformer.ts
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/transformers/filterTransformer.ts
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/types.ts
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/utils.ts
    • superset-frontend/src/dashboard/components/nativeFilters/utils.ts
    • superset-frontend/src/dashboard/reducers/dashboardInfo.test.ts
    • superset-frontend/src/dashboard/reducers/dashboardInfo.ts
    • superset-frontend/src/dashboard/types.ts
    • superset-frontend/src/dashboard/util/charts/getFormDataWithExtraFilters.ts
    • superset-frontend/src/dashboard/util/getFormDataWithExtraFilters.test.ts
    • superset-frontend/src/dashboard/util/getRelatedCharts.test.ts
    • superset-frontend/src/dashboard/util/getRelatedCharts.ts
    • superset-frontend/src/features/datasets/DatasetSelectLabel/index.tsx
    • superset-frontend/src/features/semanticLayers/label.ts
    • superset/semantic_layers/api.py
    • superset/semantic_layers/mapper.py
    • tests/unit_tests/semantic_layers/api_test.py
    • tests/unit_tests/semantic_layers/mapper_test.py
  • Files skipped - 1
    • superset-frontend/package-lock.json - Reason: Filter setting
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Eslint (Linter) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@betodealmeida
betodealmeida requested a review from rusackas July 7, 2026 14:27

@rusackas rusackas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work @betodealmeida, LGTM. The code notes from Richard and mikebridge all look handled now, so approving!

Couple of housekeeping bits before you merge if you don't mind: the testing instructions are still blank, and there's a little stray package-lock.json churn worth dropping. Neither blocks it.

@rusackas
rusackas merged commit 5b8e94d into master Jul 10, 2026
66 checks passed
@rusackas
rusackas deleted the semantic-view-dashboard-filters branch July 10, 2026 19:18
mikebridge pushed a commit to mikebridge/superset that referenced this pull request Aug 28, 2026
…, not id alone

Semantic views and regular datasets have independent numeric-id
sequences, but two surfaces resolved their bound datasource by id only,
silently reading whatever regular dataset shared the view's number
(sc-111089, QA TC13/TC16):

- The Dynamic group by display control's FilterBar loader fetched
  /api/v1/dataset/<id> ignoring the persisted targets[0].datasourceType,
  offering the colliding dataset's columns with no error.
- useDatasetDrillInfo parsed the id__type composite and discarded the
  type, so the drill modal's metadata (name, verbose_map) came from the
  colliding dataset.

The fix extends the apache#40475 type-aware pattern at a shared resolution
point:

- Extract fetchSemanticViewStructure/semanticViewDimensionsToColumns
  from the two shipped inline copies (ColumnSelect, FiltersConfigForm)
  and migrate them behaviour-preservingly.
- New useDisplayControlDatasource hook: type-branched resolution with a
  monotonic request-id stale-response guard, inert on unbound controls;
  the dataset branch preserves the legacy request byte-for-byte
  (characterization tests authored pre-change).
- Preserve datasourceType at both target-rewrite sites
  (handleColumnChange and the FilterBar clear path) — without this the
  binding silently degraded to the colliding dataset after the user's
  first select+apply.
- useDatasetDrillInfo: the semantic_view branch short-circuits before
  the load.drillby.options extension check (the extension receives only
  the numeric id); metadata rows the structure payload cannot fill
  render their explicit not-available state, pinned by test.
- Drop the display-control effect's dead `dependencies` coupling (the
  request never used it).

Spec-kit artifacts (design, the 3-lens review that found the
write-site self-revert, and the QA handoff notes) are tracked in the
internal spec repo under sc-111089-groupby-id-collision.

Co-Authored-By: Claude Fable 5 <[email protected]>
mikebridge pushed a commit to mikebridge/superset that referenced this pull request Aug 31, 2026
…, not id alone

Semantic views and regular datasets have independent numeric-id
sequences, but two surfaces resolved their bound datasource by id only,
silently reading whatever regular dataset shared the view's number
(sc-111089, QA TC13/TC16):

- The Dynamic group by display control's FilterBar loader fetched
  /api/v1/dataset/<id> ignoring the persisted targets[0].datasourceType,
  offering the colliding dataset's columns with no error.
- useDatasetDrillInfo parsed the id__type composite and discarded the
  type, so the drill modal's metadata (name, verbose_map) came from the
  colliding dataset.

The fix extends the apache#40475 type-aware pattern at a shared resolution
point:

- Extract fetchSemanticViewStructure/semanticViewDimensionsToColumns
  from the two shipped inline copies (ColumnSelect, FiltersConfigForm)
  and migrate them behaviour-preservingly.
- New useDisplayControlDatasource hook: type-branched resolution with a
  monotonic request-id stale-response guard, inert on unbound controls;
  the dataset branch preserves the legacy request byte-for-byte
  (characterization tests authored pre-change).
- Preserve datasourceType at both target-rewrite sites
  (handleColumnChange and the FilterBar clear path) — without this the
  binding silently degraded to the colliding dataset after the user's
  first select+apply.
- useDatasetDrillInfo: the semantic_view branch short-circuits before
  the load.drillby.options extension check (the extension receives only
  the numeric id); metadata rows the structure payload cannot fill
  render their explicit not-available state, pinned by test.
- Drop the display-control effect's dead `dependencies` coupling (the
  request never used it).

Spec-kit artifacts (design, the 3-lens review that found the
write-site self-revert, and the QA handoff notes) are tracked in the
internal spec repo under sc-111089-groupby-id-collision.

Co-Authored-By: Claude Fable 5 <[email protected]>
mikebridge pushed a commit to mikebridge/superset that referenced this pull request Sep 4, 2026
…, not id alone

Semantic views and regular datasets have independent numeric-id
sequences, but two surfaces resolved their bound datasource by id only,
silently reading whatever regular dataset shared the view's number
(sc-111089, QA TC13/TC16):

- The Dynamic group by display control's FilterBar loader fetched
  /api/v1/dataset/<id> ignoring the persisted targets[0].datasourceType,
  offering the colliding dataset's columns with no error.
- useDatasetDrillInfo parsed the id__type composite and discarded the
  type, so the drill modal's metadata (name, verbose_map) came from the
  colliding dataset.

The fix extends the apache#40475 type-aware pattern at a shared resolution
point:

- Extract fetchSemanticViewStructure/semanticViewDimensionsToColumns
  from the two shipped inline copies (ColumnSelect, FiltersConfigForm)
  and migrate them behaviour-preservingly.
- New useDisplayControlDatasource hook: type-branched resolution with a
  monotonic request-id stale-response guard, inert on unbound controls;
  the dataset branch preserves the legacy request byte-for-byte
  (characterization tests authored pre-change).
- Preserve datasourceType at both target-rewrite sites
  (handleColumnChange and the FilterBar clear path) — without this the
  binding silently degraded to the colliding dataset after the user's
  first select+apply.
- useDatasetDrillInfo: the semantic_view branch short-circuits before
  the load.drillby.options extension check (the extension receives only
  the numeric id); metadata rows the structure payload cannot fill
  render their explicit not-available state, pinned by test.
- Drop the display-control effect's dead `dependencies` coupling (the
  request never used it).

Spec-kit artifacts (design, the 3-lens review that found the
write-site self-revert, and the QA handoff notes) are tracked in the
internal spec repo under sc-111089-groupby-id-collision.

Co-Authored-By: Claude Fable 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Related to the REST API dashboard:native-filters Related to the native filters of the Dashboard dependencies:npm packages size/XXL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants