Skip to content

fix(dashboard): resolve display-control and drill datasources by type, not id alone - #42539

Merged
aminghadersohi merged 12 commits into
apache:masterfrom
mikebridge:sc-111089-groupby-id-collision
Sep 18, 2026
Merged

aminghadersohi merged 12 commits into
apache:masterfrom
mikebridge:sc-111089-groupby-id-collision

Conversation

@mikebridge

Copy link
Copy Markdown
Member

SUMMARY

Semantic views and regular datasets have independent numeric-id sequences, so a semantic view with id=3 and a regular dataset with id=3 both exist. Two surfaces resolved their bound datasource by id alone and silently read the wrong object:

  1. Dynamic group by display control — the FilterBar loader fetched /api/v1/dataset/<id> while ignoring the datasourceType already persisted on targets[0], so the dropdown offered the colliding dataset's columns with no error shown.
  2. Drill to detail — useDatasetDrillInfo parsed the <id>__<type> composite but discarded the type, so the drill modal's name and verbose_map came from the colliding dataset.

Both are extensions of the type-aware pattern already shipped in #40475, applied at a shared resolution point rather than as a fourth and fifth inline copy:

  • Extract fetchSemanticViewStructure / semanticViewDimensionsToColumns from the two existing inline copies (ColumnSelect.tsx, FiltersConfigForm.tsx) and migrate both onto them. Behaviour-preserving; existing suites unchanged.
  • New useDisplayControlDatasource hook — type-branched resolution with a monotonic request-id stale-response guard (a slow /dataset/3 must not overwrite a fast /semantic_view/3/structure after a type flip), inert when the control is unbound. The regular-dataset branch preserves the legacy request byte-for-byte; characterization tests for that path were authored against the unmodified component first so the claim is falsifiable.
  • Preserve datasourceType at both target-rewrite sites (handleColumnChange and the FilterBar clear-customizations path). Without this the fix self-reverts: the first select-and-apply rebuilt the target without the type, silently degrading the binding back to the colliding dataset.
  • useDatasetDrillInfo — the semantic_view branch short-circuits before the load.drillby.options extension check, because that extension receives only the numeric id and would resolve the collision itself. Non-semantic types keep byte-identical behaviour including extension precedence.
  • Dropped the display-control effect's dead dependencies coupling (it was in the dep array but the request never used it).

Known, deliberate degradation: the drill modal's metadata bar renders its explicit "Not available" state for Last modified / Modified by on semantic views — the structure endpoint carries no changed_on/owners metadata. This is pinned by test rather than papered over.

Everything here is behind FeatureFlag.SemanticLayers, which is off by default.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Not applicable — the visible difference requires a semantic-layer provider configured with an id collision against a regular dataset. Covered by tests instead (below).

TESTING INSTRUCTIONS

Automated (100 tests across 6 suites):

cd superset-frontend
npm run test -- \
  src/dashboard/components/nativeFilters/FilterBar/FilterControls/GroupByFilterCard.test.tsx \
  src/dashboard/components/nativeFilters/useDisplayControlDatasource.test.ts \
  src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/utils.test.ts \
  src/hooks/apiResources/datasets.test.ts \
  src/components/Chart/DrillDetail/DrillDetailPane.test.tsx \
  src/components/Chart/ChartContextMenu/ChartContextMenu.test.tsx

Notable cases: the collision fixture (dataset 306 vs semantic view 306) asserting the dataset endpoint is never called; the select-and-apply persistence guard for the self-revert; the stale-response discard; and the four pre-change characterization tests pinning the regular-dataset path.

Manual (requires a semantic-layer provider — FeatureFlag.SemanticLayers enabled and a configured extension):

  1. Create a semantic view whose numeric id collides with an existing regular dataset (the sequences are independent, so this happens naturally as both tables grow).
  2. Add a chart on that semantic view to a dashboard, then add a Dynamic group by display control bound to it.
  3. The dropdown must list the semantic view's dimensions, not the colliding dataset's columns.
  4. Select a dimension, apply, then reopen the filter bar — the list must still show dimensions (this is the path that previously regressed after the first interaction).
  5. Clear the customization and confirm the binding survives.
  6. Right-click a chart on the semantic view → Drill to detail. The modal header must show the semantic view's name; the metadata bar will show "Not available" for Last modified / Modified by, which is expected.

Regression check on regular datasets: repeat steps 2-6 against a normal dataset-backed chart; behaviour should be indistinguishable from master.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags: SemanticLayers
  • 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

@dosubot dosubot Bot added change:frontend Requires changing the frontend dashboard:native-filters Related to the native filters of the Dashboard labels Jul 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 #c63ed6

Actionable Suggestions - 1
  • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/utils.test.ts - 1
Additional Suggestions - 1
  • superset-frontend/src/hooks/apiResources/datasets.ts - 1
    • Unused field on type mismatch · Line 131-131
      The `datasource_type` property is set on the result object but the local `Dataset` type (from `src/components/Chart/types.ts`) does not declare it. The `as unknown as Dataset` cast suppresses TypeScript warnings but introduces type-noise. The field is not consumed by any downstream consumer (`ChartContextMenu.tsx`, `SliceHeaderControls`) — all use the spread result including `verbose_map` which comes from `createVerboseMap`. Consider removing it to keep the type contract clean.
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/FiltersConfigForm.tsx - 1
Review Details
  • Files reviewed - 13 · Commit Range: e409aa2..e409aa2
    • superset-frontend/src/components/Chart/ChartContextMenu/ChartContextMenu.test.tsx
    • superset-frontend/src/components/Chart/DrillDetail/DrillDetailPane.test.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/GroupByFilterCard.test.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/GroupByFilterCard.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FilterBar/index.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/ColumnSelect.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.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/useDisplayControlDatasource.test.ts
    • superset-frontend/src/dashboard/components/nativeFilters/useDisplayControlDatasource.ts
    • superset-frontend/src/hooks/apiResources/datasets.test.ts
    • superset-frontend/src/hooks/apiResources/datasets.ts
  • Files skipped - 0
  • Tools
    • 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

Comment on lines +420 to +437
test('semanticViewDimensionsToColumns maps dimension fields incl. temporal detection', () => {
const { semanticViewDimensionsToColumns: toColumns } = require('./utils');
const columns = toColumns([
{ name: 'ordered_at', type: 'TIMESTAMP' },
{ name: 'status', type: 'VARCHAR' },
]);

expect(columns[0]).toMatchObject({
column_name: 'ordered_at',
type: 'TIMESTAMP',
is_dttm: true,
filterable: true,
});
expect(columns[1]).toMatchObject({
column_name: 'status',
is_dttm: false,
filterable: true,
});

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 type_generic assertion

The test for semanticViewDimensionsToColumns omits assertion for type_generic, a field returned by the implementation at line 189 and consumed by downstream filter-type logic. Without this check, a regression in mapSemanticTypeToGenericDataType would pass silently.

Code Review Run #c63ed6


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

  • Yes, avoid them

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 23f1617 — the test now asserts type_generic explicitly for a temporal, string, and numeric dimension. The fixture also switched to wire-shaped pyarrow type names (timestamp[us]/string/double): that is what /structure actually serialises, and the mapper deliberately does not match SQL-style names like VARCHAR, so the old fixture could not have carried the assertion. Control-run verified: breaking mapSemanticTypeToGenericDataType now fails this test.

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.

The suggestion to include an assertion for type_generic is valid and appropriate. Adding this check ensures that the downstream filter-type logic receives the expected data format, preventing potential silent regressions in the mapSemanticTypeToGenericDataType mapping function.

superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/utils.test.ts

expect(columns[0]).toMatchObject({
    column_name: 'ordered_at',
    type: 'TIMESTAMP',
    is_dttm: true,
    filterable: true,
    type_generic: 1,
  });

@codecov

codecov Bot commented Jul 28, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.81481% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.56%. Comparing base (6956da1) to head (cf99987).
⚠️ Report is 51 commits behind head on master.

Files with missing lines Patch % Lines
...tersConfigModal/FiltersConfigForm/ColumnSelect.tsx 0.00% 3 Missing ⚠️
...onfigModal/FiltersConfigForm/FiltersConfigForm.tsx 0.00% 3 Missing ⚠️
...ers/FilterBar/FilterControls/GroupByFilterCard.tsx 96.42% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #42539      +/-   ##
==========================================
+ Coverage   79.52%   79.56%   +0.04%     
==========================================
  Files        2897     2899       +2     
  Lines      168619   168671      +52     
  Branches    39121    39125       +4     
==========================================
+ Hits       134092   134201     +109     
+ Misses      32026    31969      -57     
  Partials     2501     2501              
Flag Coverage Δ
javascript 75.15% <94.81%> (+0.08%) ⬆️

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.

Copilot AI 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.

Pull request overview

Note

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Fixes datasource resolution collisions between semantic views and regular datasets by making lookup logic type-aware (not id-only), and centralizes semantic-view structure fetching/mapping for reuse across dashboard display controls and drill-to-detail.

Changes:

  • Add datasource-type parsing and semantic-view short-circuit in useDatasetDrillInfo to avoid colliding /dataset/<id> drill metadata.
  • Introduce useDisplayControlDatasource hook with stale-response guarding for type flips; wire Dynamic group-by control to it.
  • Extract and reuse fetchSemanticViewStructure + semanticViewDimensionsToColumns, and preserve datasourceType through target rewrites/clears; add targeted tests for collisions and regressions.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
superset-frontend/src/hooks/apiResources/datasets.ts Parse datasource type; short-circuit drill info for semantic views using structure endpoint.
superset-frontend/src/hooks/apiResources/datasets.test.ts Add tests for type parsing and semantic-view drill resolution (no /drill_info calls).
superset-frontend/src/dashboard/components/nativeFilters/useDisplayControlDatasource.ts New type-aware datasource loader hook with request-id stale-response guard.
superset-frontend/src/dashboard/components/nativeFilters/useDisplayControlDatasource.test.ts Add hook unit tests for dataset vs semantic-view branches and race handling.
superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/utils.ts Extract semantic-view structure fetch + dimension→column mapping utilities.
superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/utils.test.ts Add unit tests for new semantic-view utilities.
superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx Migrate inline semantic-view structure logic to shared utilities.
superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/ColumnSelect.tsx Migrate inline semantic-view dimension mapping to shared utilities.
superset-frontend/src/dashboard/components/nativeFilters/FilterBar/index.tsx Preserve datasourceType when clearing filter customizations to prevent rebind.
superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/GroupByFilterCard.tsx Use new hook for loading columns/dimensions; normalize legacy ids; preserve datasourceType on edits.
superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/GroupByFilterCard.test.tsx Add characterization + collision/persistence/error tests for GroupByFilterCard.
superset-frontend/src/components/Chart/DrillDetail/DrillDetailPane.test.tsx Add semantic-view drill detail regression test for “Not available” metadata rows.
superset-frontend/src/components/Chart/ChartContextMenu/ChartContextMenu.test.tsx Add semantic-view context menu test ensuring structure endpoint is used (not /drill_info).

@rusackas

Copy link
Copy Markdown
Member

@mikebridge this looks like a solid fix, threading datasourceType through instead of resolving by id alone.

One thing before I'd merge: Bito's flagging that the semanticViewDimensionsToColumns test in utils.test.ts doesn't assert type_generic, so a regression in mapSemanticTypeToGenericDataType would pass silently. Worth adding.

Also a handful of other bot threads are still open (the as unknown as Dataset/Metric[] casts, the cross-layer import into datasets.ts), if you don't mind giving those a look too.

@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.

Hey @mikebridge, checking back in since the bot threads from a few days ago are all still open (the missing type_generic assertion in the semanticViewDimensionsToColumns test, the as unknown as Dataset/Metric[] casts, the cross-layer import into datasets.ts). None of them block merging, just flagging they haven't moved.

Also noticed ViewQuery.tsx's SQL formatter has the same id-alone /api/v1/dataset/<id> lookup this PR fixes elsewhere, splitting datasource on __ and dropping the type before fetching. Out of scope for this PR, but might be worth a follow-up issue given it's the same collision pattern.

mikebridge pushed a commit to mikebridge/superset that referenced this pull request Aug 6, 2026
… resolution

Four review items from apache#42539:

- The semanticViewDimensionsToColumns test now asserts type_generic for a
  temporal, string, and numeric dimension, using wire-shaped pyarrow type
  names (timestamp[us]/string/double) — a regression in
  mapSemanticTypeToGenericDataType fails the test instead of passing
  silently (control-run verified). SQL-style names like VARCHAR were never
  what /structure serialises, and the mapper rightly does not match them.

- The shared semantic-view structure helpers move to a layer-neutral module
  (src/utils/semanticViewStructure.ts); the filter-form utils re-export them
  for existing call sites, and the generic drill-info hook no longer imports
  from a dashboard modal utility.

- useDatasetDrillInfo's semantic branch builds a structurally valid Dataset
  with no cast: the fabricated id/datasource_type fields are dropped
  (consumers read only columns/metrics and derive verbose_map) and
  verbose_name is omitted rather than null.

- The FiltersConfigForm metric mapping documents its one genuine type gap
  instead of erasing the type: the /structure wire carries no metric uuid
  and this state's consumers never read it, so the cast narrows to
  Omit<Metric, 'uuid'> — every other field stays compiler-checked. (The
  blanket unknown-cast was hiding the uuid gap, not the verbose_name one.)

- getDatasourceTypeFromId renamed to getDatasourceTypeFromDatasourceId: it
  parses the composite `<id>__<type>` datasource string, not a plain id.
@mikebridge

Copy link
Copy Markdown
Member Author

@rusackas all five open items are addressed in 23f1617b08 — thread-by-thread replies inline. The short version:

  • type_generic assertion added (your named ask), with the fixture switched to wire-shaped pyarrow type names (timestamp[us]/string/double) since that is what /structure serialises — a mapSemanticTypeToGenericDataType regression now fails the test (control-run verified: breaking the mapper fails it, restoring passes).
  • Cross-layer import resolved: the shared structure helpers moved to src/utils/semanticViewStructure.ts; the filter-form utils re-export them, so the diff to existing call sites is nil.
  • as unknown as Dataset deleted outright — the fabricated id/datasource_type fields had no readers, and with them (and verbose_name: null) gone, the literal is a structurally valid Dataset.
  • as unknown as Metric[] narrowed, not just cleaned: the blanket cast was actually hiding a missing required uuid (which the wire doesn't carry), not the verbose_name typing. It's now as Omit<Metric, 'uuid'>[] as Metric[] — the one genuinely absent field is documented, everything else stays compiler-checked.
  • Renamed to getDatasourceTypeFromDatasourceId.

Verified: 93/93 across the FiltersConfigForm suites, 101/101 across hooks/apiResources + utils, 233/234 (1 pre-existing skip) over the wider affected surface incl. both useDatasetDrillInfo consumers; full-project tsc and pre-commit clean.

Disclosure: fixes and replies prepared with AI assistance (Claude), on behalf of and reviewed by @mikebridge.

@netlify

netlify Bot commented Aug 6, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 8fbf49a
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6aac46322fd6860008907961
😎 Deploy Preview https://deploy-preview-42539--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 +86 to +87
setLoading(true);
setError(undefined);

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: When datasetId or datasourceType changes, the hook marks the new request as loading but retains the previous name and columns until the request completes. GroupByFilterCard continues to expose those retained columns while Select is only visually marked as loading, so users can select a column belonging to the previous datasource and persist it against the new binding. Clear the datasource state when starting a new request, or disable selection until the new response arrives. [stale reference]

Severity Level: Major ⚠️
- ⚠️ Datasource switches expose stale group-by columns.
- ❌ Invalid columns can be persisted against new bindings.
- ⚠️ Dynamic group-by configuration may fail after switching types.

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/useDisplayControlDatasource.ts
**Line:** 86:87
**Comment:**
	*Stale Reference: When `datasetId` or `datasourceType` changes, the hook marks the new request as loading but retains the previous `name` and `columns` until the request completes. `GroupByFilterCard` continues to expose those retained columns while `Select` is only visually marked as loading, so users can select a column belonging to the previous datasource and persist it against the new binding. Clear the datasource state when starting a new request, or disable selection until the new response arrives.

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
👍 | 👎

Comment on lines +767 to +769
fetchSemanticViewStructure(datasetId)
.then(({ name: svName, dimensions, metrics: svMetrics }) => {
const columns = semanticViewDimensionsToColumns(dimensions);

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: The asynchronous structure request is not associated with the current datasetId and datasourceType. If the user changes the datasource while this request is pending, its completion can overwrite datasetDetails and metrics for the newly selected datasource with the previous semantic view's data. Add an effect cleanup or request-generation guard before applying either success or failure results. [race condition]

Severity Level: Major ⚠️
- ❌ Filter configuration shows columns from the wrong datasource.
- ⚠️ Ad hoc filters use stale metrics and metadata.
- ⚠️ Rapid datasource changes can silently misconfigure filters.

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/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx
**Line:** 767:769
**Comment:**
	*Race Condition: The asynchronous structure request is not associated with the current `datasetId` and `datasourceType`. If the user changes the datasource while this request is pending, its completion can overwrite `datasetDetails` and `metrics` for the newly selected datasource with the previous semantic view's data. Add an effect cleanup or request-generation guard before applying either success or failure results.

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
👍 | 👎

Comment on lines 433 to +446
const targets: [Partial<NativeFilterTarget>] = columnValue
? ([
{
datasetId: dataset,
...(datasourceType ? { datasourceType } : {}),
column: { name: columnValue },
},
] as [Partial<NativeFilterTarget>])
: ([{}] as [Partial<NativeFilterTarget>]);
: ([
{
datasetId: dataset,
...(datasourceType ? { datasourceType } : {}),
},
] as [Partial<NativeFilterTarget>]);

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: The hook normalizes legacy string and {value} dataset IDs only for fetching, but these target rewrites persist the original unnormalized value. Editing or clearing a legacy target can therefore send a string or object as datasetId in the pending customization and directly in saveChartCustomization, violating the numeric target contract and potentially causing backend serialization or datasource resolution failures. Persist normalizedDatasetId instead of dataset when rebuilding the target. [api mismatch]

Severity Level: Major ⚠️
- ⚠️ Legacy dynamic-group-by edits can submit malformed dataset targets.
- ❌ Saving affected customizations may fail backend validation.
- ⚠️ Subsequent datasource resolution may receive an object instead of an ID.

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/GroupByFilterCard.tsx
**Line:** 433:446
**Comment:**
	*Api Mismatch: The hook normalizes legacy string and `{value}` dataset IDs only for fetching, but these target rewrites persist the original unnormalized value. Editing or clearing a legacy target can therefore send a string or object as `datasetId` in the pending customization and directly in `saveChartCustomization`, violating the numeric target contract and potentially causing backend serialization or datasource resolution failures. Persist `normalizedDatasetId` instead of `dataset` when rebuilding the target.

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
👍 | 👎

};
},
);
fetchSemanticViewStructure(datasetId)

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: The semantic-view request has no binding check before updating state. If the dataset ID or datasource type changes while this request is pending, its completion can reset the new field value, replace the new datasource's columns with stale dimensions, and set loading to false while the newer request is still active. Track a request/binding identity and ignore stale success, error, and finally callbacks. [race condition]

Severity Level: Major ⚠️
- ❌ Filter configuration can show columns from the previous datasource.
- ⚠️ Current column values may be reset using stale dimensions.
- ⚠️ Loading state can end before the active request completes.

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/FiltersConfigModal/FiltersConfigForm/ColumnSelect.tsx
**Line:** 120:132
**Comment:**
	*Race Condition: The semantic-view request has no binding check before updating state. If the dataset ID or datasource type changes while this request is pending, its completion can reset the new field value, replace the new datasource's columns with stale dimensions, and set `loading` to false while the newer request is still active. Track a request/binding identity and ignore stale success, error, and finally callbacks.

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 commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #79e679

Actionable Suggestions - 0
Review Details
  • Files reviewed - 6 · Commit Range: e409aa2..23f1617
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.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/hooks/apiResources/datasets.test.ts
    • superset-frontend/src/hooks/apiResources/datasets.ts
    • superset-frontend/src/utils/semanticViewStructure.ts
  • Files skipped - 0
  • Tools
    • 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

@eschutho eschutho closed this Aug 6, 2026
@eschutho eschutho reopened this Aug 6, 2026

@eschutho eschutho 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.

Posting on Elizabeth's behalf — this is her PR reviewer agent. Forward any pushback to her and she'll loop me back in.

Nice work — the type-aware resolution reads cleanly and the test surface is genuinely thorough (the collision fixture and the stale-response race test in particular). One functional question worth a look before merge, plus a couple of optional nits. All line numbers verified against HEAD 8a607f9.

superset-frontend/src/utils/semanticViewStructure.ts:105-117

semanticViewDimensionsToColumns doesn't set groupby on the mapped columns. That's fine for drill-to-detail and for the group-by control, but the Drill-by submenu in ChartContextMenu/SliceHeaderControls filters dataset.columns with (!loadDrillByOptionsExtension || column.groupby) — so in a deployment that has a load.drillby.options extension registered (plausible for semantic-layer installs), every semantic-view column is dropped and Drill-by comes up empty. Since the extension path used to resolve the colliding regular dataset, this trades "wrong columns" for "no columns," which may well be the intended outcome — just want to confirm it's deliberate rather than an accidental gap.

WDYT — is empty Drill-by the intended behavior for semantic views here, or should dimensions be marked groupby: true so they remain drillable? Either way, a test covering the extension-registered path (the existing ChartContextMenu test only exercises the no-extension case) would pin whichever answer is right.

superset-frontend/src/dashboard/components/nativeFilters/useDisplayControlDatasource.ts:77

The inert guard treats undefined/null/'' as unbound, whereas the previous effect used if (!datasetId) return, so a literal id 0 was also inert before and would now issue GET /api/v1/dataset/0. No real dataset has id 0, so this is almost certainly moot — just flagging it as a small deviation from the "byte-identical legacy path" the docstring promises.

Totally optional — happy to keep as-is if 0 is genuinely unreachable.

superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx:779

The as Omit<Metric, 'uuid'>[] as Metric[] double cast is well-documented and clearly narrower than the old blanket unknown cast, so this is just a nit. If Metric.uuid is the only structurally-missing field, it might read a touch cleaner to build the objects against Omit<Metric, 'uuid'> directly (single cast) rather than round-tripping through it.

Small suggestion, not required.

@gabotorresruiz gabotorresruiz 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.

Hey @mikebridge, thanks for the disciplined work here. I went beyond reading the diff and stood up a live environment at your head commit (9ee185c) with SEMANTIC_LAYERS enabled, a registered semantic layer provider, and a manufactured id collision (semantic view id 1 vs regular dataset id 1, different column sets). What I verified:

  • All 100 tests across the 6 suites pass locally, and reverting GroupByFilterCard.tsx / datasets.ts to their pre-fix versions makes exactly the new semantic-view tests fail while the characterization tests keep passing, as the PR body promises.
  • Live on this branch, the Dynamic group by card lists only the view's dimensions, issues exactly one GET /api/v1/semantic_view/1/structure and no bare GET /api/v1/dataset/1, and still lists dimensions after select and reopen. The same dashboard served by the pre-fix build lists the colliding dataset's columns (address_line1, deal_size, city, sales) fetched via a bare GET /api/v1/dataset/1.
  • Live drill to detail on a chart bound to 1__semantic_view: this branch shows the view's name (orders) with the pinned Not available metadata rows; the pre-fix build shows vehicle_sales and the colliding dataset's real last-modified timestamp in the same modal.

Two inline comments with the remaining findings. Beyond those:

  1. I want to second Elizabeth's drill-by extension question with data, because I reproduced it live: with no load.drillby.options extension registered, the semantic chart's Drill by submenu lists the view's dimensions; after registering a stub extension, the same submenu renders "No columns found", because semanticViewDimensionsToColumns sets no groupby and ChartContextMenu.tsx:223 filters on column.groupby when an extension is present. I also checked the blast radius of marking dimensions groupby: true in the shared mapper: that extension filter is the only consumer that reads .groupby on these columns (ColumnSelect, FiltersConfigForm and the display-control hook filter on filterable/is_dttm/type_generic only), so the one-word fix is safe for every other call site if drillable dimensions are the intended answer. I would like this question resolved before merge, whichever way you land.

  2. A question, not a blocker: in both builds the drill modal's data pane errors with "Adhoc metrics are not supported in Semantic Views." for semantic-view charts, so the pane body is empty regardless of this fix. Is that a known upstream gap with its own track? This PR only claims the metadata resolution, which it delivers, so this is just for my understanding.

  3. The four red CI checks are stale-base or infra, not this code: validate-frontend fails on the fs-extra tree issue fixed on master in #42720 (landed Aug 3, after your Jul 28 base), the cypress matrix died on an empty --parallelism argument before running a single spec, and docker-build (dev) failed docker login because fork PRs do not get registry secrets. Your branch merges cleanly onto current master and no master commit since your base touches any of these 14 files, so a rebase should be painless and should clear the board.

Once the inline items and Elizabeth's question are settled and CI is green on a rebase, I am happy to approve. Great work tracking this collision down.

@eschutho

Copy link
Copy Markdown
Member

Posting on Elizabeth's behalf — this is her PR reviewer agent. Forward any pushback to her and she'll loop me back in.

@mikebridge — following up on the drill-by submenu question above. @gabotorresruiz independently hit the same gap while live-testing yesterday and confirmed the groupby: true fix (if that's the direction you want to go) is safe for every other call site that reads .groupby on semantic-view columns. He's flagged he's ready to approve once this is resolved and CI is green — the current red checks look like a stale base rather than real failures, so a rebase should clear those too. Let us know which way you'd like to land the drill-by question and we can help however's useful.

Mike Bridge and others added 6 commits September 4, 2026 13:53
… resolution

Four review items from apache#42539:

- The semanticViewDimensionsToColumns test now asserts type_generic for a
  temporal, string, and numeric dimension, using wire-shaped pyarrow type
  names (timestamp[us]/string/double) — a regression in
  mapSemanticTypeToGenericDataType fails the test instead of passing
  silently (control-run verified). SQL-style names like VARCHAR were never
  what /structure serialises, and the mapper rightly does not match them.

- The shared semantic-view structure helpers move to a layer-neutral module
  (src/utils/semanticViewStructure.ts); the filter-form utils re-export them
  for existing call sites, and the generic drill-info hook no longer imports
  from a dashboard modal utility.

- useDatasetDrillInfo's semantic branch builds a structurally valid Dataset
  with no cast: the fabricated id/datasource_type fields are dropped
  (consumers read only columns/metrics and derive verbose_map) and
  verbose_name is omitted rather than null.

- The FiltersConfigForm metric mapping documents its one genuine type gap
  instead of erasing the type: the /structure wire carries no metric uuid
  and this state's consumers never read it, so the cast narrows to
  Omit<Metric, 'uuid'> — every other field stays compiler-checked. (The
  blanket unknown-cast was hiding the uuid gap, not the verbose_name one.)

- getDatasourceTypeFromId renamed to getDatasourceTypeFromDatasourceId: it
  parses the composite `<id>__<type>` datasource string, not a plain id.
…fs-extra dependency-cache mismatch — no code changes)
…ache poisoning window — repo-wide runs green again)
…egacy 0 dataset id as unbound

Addresses @gabotorresruiz's 2026-08-20 review on apache#42539.

1. fetchSemanticViewStructure now evicts supersetGetCache on a failed
   /structure response, mirroring the regular-dataset drill branch
   (hooks/apiResources/datasets.ts). Previously cacheWrapper cached the
   rejected promise, so a single transient failure poisoned the endpoint
   for the rest of the page session and only a full reload recovered.

2. useDisplayControlDatasource restores the falsy guard (!datasetId) so the
   legacy 0 null-sentinel that migrateChartCustomization.extractDatasetId
   emits on dashboard hydrate is treated as unbound, instead of issuing a
   spurious GET /api/v1/dataset/0 -> 404 + danger toast.

Both covered by control-verified tests (new semanticViewStructure.test.ts
500-then-200 refetch; a datasetId:0 inert case).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…ce comment

Pre-push tripwire flagged the pre-existing 'today' in the hook docstring;
reword to timeless per the codebase convention. No behaviour change.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…mment

Second pre-push tripwire hit: 'today' in the characterization-test
docstring. Reword to timeless; no behaviour change. Swept the rest of the
PR's changed files — no other time-relative comments remain.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@mikebridge
mikebridge force-pushed the sc-111089-groupby-id-collision branch from a3cc311 to 328f502 Compare September 4, 2026 20:10
mikebridge pushed a commit to mikebridge/superset that referenced this pull request Sep 4, 2026
Amin round-1 review of apache#42539:

- GroupByFilterCard: guard the load-failure toast on binding identity. The
  hook clears its error one render after a binding change, so a render could
  pair the previous binding's error with the new binding's id/type and toast
  a danger message naming a healthy datasource. The hook now tags the error
  with the binding it belongs to (errorBinding) via a shared
  displayControlBindingKey, and the card only toasts when it matches the
  current binding.
- useDisplayControlDatasource: evict the dataset-branch cache entry on
  rejection. cachedSupersetGet caches the in-flight promise and never evicts a
  rejected one, so a single 500 poisoned the endpoint for the whole page
  session. Mirror the semantic-view branch's eviction-on-rejection.
- FilterBar: extract the clear-time target reduction into
  clearedCustomizationTarget (pure, tested), so the "preserve datasourceType
  through a clear" invariant has a direct regression guard.
- DrillDetailPane test: scope-note the semantic-view test to say it pins the
  metadata-bar degradation rendering, not the type-aware resolution (guarded
  in hooks/apiResources/datasets.test.ts).
- datasets.ts: type the drill-info `result` as Dataset instead of implicit
  any, and reword the semantic-branch comment to describe the one narrow
  Metric assertion honestly (the structure payload carries no uuid) rather
  than claim "no cast".

Tests: new/updated coverage in useDisplayControlDatasource.test.ts (error
binding + cache eviction), GroupByFilterCard.test.tsx (no toast on switch to
healthy binding), and FilterBar/utils.test.ts (datasourceType preserved
through clear). Each new guard verified to fail when its fix is reverted.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01267VBWbvWTNZUg9GvXKgkC
Amin round-1 review of apache#42539:

- GroupByFilterCard load-failure toast no longer names the wrong datasource on
  a binding change. The hook now scopes its `error` to the binding that
  produced it: it clears error one render after a binding change, so returning
  the raw error let a render pair the previous binding's error with the new
  binding's id/type and toast a healthy datasource. The gating is encapsulated
  inside useDisplayControlDatasource (via a shared displayControlBindingKey) so
  future adopters of this single resolution point inherit it; the card just
  reads a clean, binding-scoped error and de-dupes one toast per binding.
- useDisplayControlDatasource: evict the dataset-branch cache entry on
  rejection. cachedSupersetGet caches the in-flight promise and never evicts a
  rejected one, so a single 500 poisoned the endpoint for the whole page
  session. Mirror the semantic-view branch's eviction-on-rejection. (A central
  fix in cacheWrapper is tracked separately as sc-119921.)
- FilterBar: extract the clear-time target reduction into
  clearedCustomizationTarget (pure, tested), so the "preserve datasourceType
  through a clear" invariant has a direct regression guard.
- DrillDetailPane test: scope-note the semantic-view test to say it pins the
  metadata-bar degradation rendering, not the type-aware resolution (guarded
  in hooks/apiResources/datasets.test.ts).
- datasets.ts: type the drill-info `result` as Dataset instead of implicit
  any, and reword the semantic-branch comment to describe the one narrow
  Metric assertion honestly (the structure payload carries no uuid) rather
  than claim "no cast".

Tests: new/updated coverage in useDisplayControlDatasource.test.ts (cache
eviction), GroupByFilterCard.test.tsx (no toast on switch to a healthy
binding — the end-to-end guard for the binding-scoped error), and
FilterBar/utils.test.ts (datasourceType preserved through clear). Each guard
verified to fail when its fix is reverted.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01267VBWbvWTNZUg9GvXKgkC
@mikebridge
mikebridge force-pushed the sc-111089-groupby-id-collision branch from 328f502 to cf99987 Compare September 4, 2026 20:21
@mikebridge

Copy link
Copy Markdown
Member Author

@aminghadersohi — thanks for the round-1 review. All five findings are addressed (head cf999870b5):

  1. Spurious toast naming the healthy datasource on a binding change — fixed at the source: useDisplayControlDatasource now scopes its error to the binding that produced it (it clears one render after a binding change, so returning the raw error let a render pair the previous binding's failure with the new binding's id/type). The gating is encapsulated inside the hook via a shared displayControlBindingKey, so future adopters of this single resolution point inherit it and the card just reads a clean, binding-scoped error. Regression test added (error on A → switch to healthy B → no toast), and it fails when the gate is reverted.
  2. Asymmetric cache eviction — the dataset branch now evicts the cache entry on rejection, mirroring the semantic-view branch, so a single 500 no longer poisons /api/v1/dataset/<id> for the page session. Test proves a retry re-issues the request. (A central fix in cacheWrapper — the shared root cause across all three call sites — is tracked separately as sc-119921 rather than done as a drive-by here, since it's an app-wide util change beyond this PR's scope.)
  3. Untested type-preserving clear site — extracted the clear-time target reduction into a pure clearedCustomizationTarget helper with direct tests; deleting the datasourceType spread now fails a test.
  4. DrillDetailPane test — scope-noted: it pins the metadata-bar degradation rendering, not the type-aware resolution (which is guarded directly in hooks/apiResources/datasets.test.ts T012).
  5. Misleading "no cast" comment — result is now typed Dataset (no longer implicit any), and the comment describes the one narrow Metric assertion honestly (the structure payload carries no uuid) instead of claiming there's no cast.

Rebased onto master; 95 frontend unit tests green across the affected suites; the 9 changed files are tsc-clean. Ready for another look when you have a moment.

@aminghadersohi aminghadersohi 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.

Round 2 review — type-aware datasource resolution

Reviewed at cf999870b5ed40840b46457adc85f9ce8807452f (pinned checkout, working tree clean). Still not an approval — @villebro and @DamianPendrak are still requested reviewers, and both of @gabotorresruiz's threads are still unresolved. Please treat their sign-off as the gate, not this comment.

I can see at head that the two fixes you replied with are present — useDisplayControlDatasource.ts:99 is the falsy if (!datasetId) guard, and semanticViewStructure.ts:105 evicts on rejection — but whether that closes his threads is his to say, not mine.

Baseline at this head: the 8 affected suites run 145 tests, all green. Reverting hooks/apiResources/datasets.ts to the merge base → 4 red (3 in datasets.test.ts, 1 in ChartContextMenu.test.tsx); the suite is not vacuous. Deduped statusCheckRollup (newest run per leg): 54 success / 9 skipped / 4 neutral / 0 failures.


Round-1 findings — re-checked, with the runs

1. Spurious toast naming the healthy datasource — FIXED, and I re-ran it rather than re-read it.

This was the one that mattered, so I rebuilt round 1's probe from scratch and read the toast strings, not the count. Two scenarios, both at head:

scenario round 1 (a3cc3117) head (cf999870)
semantic 601 fails → rebind to healthy semantic 602 ["…semantic view 601", "…semantic view 602"] ["…semantic view 601"]
same id 700, semantic fails → type-flip to healthy table 700 ["…semantic view 700", "Failed to load columns for dataset 700"] ["…semantic view 700"]

The second row is the interesting one: pre-fix, a healthy regular dataset was named in a danger toast purely because it shared the failed view's number — the exact sc-111089 shape, one layer up. Gone at head. And the guard is load-bearing: replacing error: scopedError with the raw error on useDisplayControlDatasource.ts:180 turns both of my probes red and fails your new switching from a failed binding to a healthy one never toasts the healthy datasource (2 toasts, expected 1). Scoping this inside the hook rather than in the card was the right call — the next adopter of this resolution point inherits it.

2. Untested type-preserving clear site — mostly closed, with a residual worth recording.

The invariant now has a real guard: deleting the datasourceType spread inside clearedCustomizationTarget fails FilterBar/utils.test.ts (round 1: the equivalent revert left 25 suites / 204 tests green; now 1 red). toStrictEqual in the absent-target case is a nice touch — it stops that assertion passing against a bare {}.

The residual (on my existing FilterBar/index.tsx thread, not re-filing): the wiring is still uncovered. I replaced the call at FilterBar/index.tsx:490 with the old id-only literal [{ datasetId: item.targets?.[0]?.datasetId }], left clearedCustomizationTarget and its tests fully intact, and src/dashboard/components/nativeFilters/ stayed 50 suites / 465 tests green. So the helper is guarded; the "Clear all" path that calls it is not. Much narrower than round 1 and not a blocker — just noting it so the gap isn't recorded as closed when it's half-closed.

3. DrillDetailPane.test.tsx docblock — CLOSED as documentation. Confirmed the scope note is accurate rather than aspirational: with datasets.ts reverted to the merge base, DrillDetailPane.test.tsx still passes while ChartContextMenu.test.tsx and datasets.test.ts go red. The docblock now says exactly that. Correct resolution — the test does pin something real (the metadata-bar degradation), it just never was the resolution guard.

4. Cache-eviction asymmetry — CLOSED for the in-scope branch. supersetGetCache.delete(endpoint) matches cacheWrapper's key function exactly (({ endpoint }) => endpoint || ''), so the eviction is precise. Removing it fails the new dataset-branch failure evicts the cache so a retry re-issues the request test. For the record on the remaining surface: of the five cachedSupersetGet call sites, three now evict on rejection (useDisplayControlDatasource, semanticViewStructure, datasets.ts) and two do not (ColumnSelect.tsx:134, FiltersConfigForm.tsx:798) — both are the regular-dataset branches this PR does not touch, and both are what sc-119921 covers. Deferring the central cacheWrapper fix out of this PR is the right scoping.

5. let result implicit any — CLOSED. Now Dataset | undefined, and the comment describes the one as Metric narrowing honestly instead of claiming there is no cast. tsc --noEmit reports no errors under src/ (the only output is pre-existing TS6305 from unbuilt plugin lib/ outputs, an env artifact).


One data point for codeant's open useDisplayControlDatasource.ts thread

Not re-filing — it's still theirs, and it is pre-existing (master's GroupByFilterCard also only called setColumnOptions on success, so old options survived a rebind there too). But I measured it at head and it may help you answer them: bind the card to dataset 801 (column alpha_only_in_801), then rebind to semantic view 802 with a slow /structure — while the card is bound to the view, the combobox still offers alpha_only_in_801, a column of the colliding regular dataset, and it is selectable.

What makes it worth a line this round rather than last: cf999870 makes error binding-scoped but leaves name and columns unscoped, so the hook's contract is now half binding-scoped. The docstring on DisplayControlDatasource.error promises "a stale failure from a previous binding never surfaces against the new one" — a reader will reasonably assume the same of the columns beside it. Either scoping them the same way (clear on binding change, as ColumnSelect already does via useChangeEffect) or saying in the docstring that they deliberately aren't would close the surprise. Your call and codeant's thread, not a blocker from me.

Also unchanged from round 1: I'm still not filing the other three codeant threads, the VARCHAR mapper gap, or the require()-in-test style.


Housekeeping

The rebase resolved round 1's staleness note — the branch is current against master, so please disregard the rebase recommendation from round 1. npm ci still fails here with Missing: @noble/[email protected] from lock file, but package-lock.json is untouched by this PR and master's own copy fails identically, so that is env/master and not yours; npm install works and is what I used. I verified the mapSemanticTypeToGenericDataType relocation is still byte-identical after the rebase.

Nice turnaround on all five.

@bito-code-review

bito-code-review Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #cb770c

Actionable Suggestions - 0
Additional Suggestions - 7
  • superset-frontend/src/dashboard/components/nativeFilters/useDisplayControlDatasource.ts - 1
    • Stale columns on binding change · Line 113-115
      On a binding change the effect sets loading(true) but leaves the previous binding's name/columns in state. GroupByFilterCard derives columnOptions from datasourceColumns and its Select stays interactive (no disabled) during loading, so a user can select a column belonging to the old datasource. Clear name/columns when starting the new load.
  • superset-frontend/src/utils/semanticViewStructure.ts - 1
    • Duration type unmapped · Line 58-64
      The numeric regex omits `duration`, but the backend `get_column_type()` (superset/semantic_layers/models.py:120) maps `pa.types.is_duration` to `GenericDataType.NUMERIC`. A `duration[ms]` dimension therefore falls through to `undefined` here, diverging from backend typing and leaving `type_generic` unset for consumers like `semanticViewDimensionsToColumns`. Consider adding `\bduration\b` to the numeric alternation.
  • superset-frontend/src/hooks/apiResources/datasets.ts - 1
    • Semantic view drill-by gap · Line 137-147
      Semantic-view columns from `semanticViewDimensionsToColumns` set `filterable: true` but never `groupby`. In `ChartContextMenu` (line 238), `(!loadDrillByOptionsExtension || column.groupby)` drops every semantic-view column from `drillable_columns` whenever a `load.drillby.options` extension is registered, silently disabling drill-by for semantic views. Consider setting `groupby: true` for parity with regular-dataset columns.
  • superset-frontend/src/utils/semanticViewStructure.test.ts - 1
    • Duplicated test coverage · Line 29-45
      This test duplicates the payload-mapping assertions already in `FiltersConfigForm/utils.test.ts` (lines 381-418) for the same `fetchSemanticViewStructure`. Two divergent copies of the same contract risk drift. Keep the eviction test here (unique) and drop one of the mapping tests.
  • superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/GroupByFilterCard.test.tsx - 1
    • Magic string constant · Line 84-84
      The filterType value duplicates `ChartCustomizationPlugins.DynamicGroupBy` from `src/constants.ts` (line 206). Since `GroupByFilterCard` never reads `filterType`, this is inert today, but referencing the canonical constant keeps the test aligned if the contract value ever changes.
  • superset-frontend/src/dashboard/components/nativeFilters/useDisplayControlDatasource.test.ts - 1
    • Test cache isolation · Line 24-27
      `afterEach` clears fetchMock routes/history but not the module-level `supersetGetCache` Map that `cachedSupersetGet` populates. Successful/in-flight responses cached in one test persist into later tests. Currently each test uses a unique id (401-405), so no collision occurs, but reusing an id would silently serve a stale cached payload. Consider `supersetGetCache.clear()` in `afterEach`.
  • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/utils.test.ts - 1
    • Cache not cleared in tests · Line 381-418
      These tests exercise `fetchSemanticViewStructure`, which caches its resolved promise in the module-level `supersetGetCache` keyed by endpoint. The tests clear fetch-mock routes/history but never `supersetGetCache`, unlike the sibling `semanticViewStructure.test.ts` which clears it in `afterEach`. Today the unique IDs (9101/9102) mask it, but cached entries leak for the whole suite run. Consider clearing the cache in `afterEach`.
Review Details
  • Files reviewed - 17 · Commit Range: 327d468..cf99987
    • superset-frontend/src/components/Chart/ChartContextMenu/ChartContextMenu.test.tsx
    • superset-frontend/src/components/Chart/DrillDetail/DrillDetailPane.test.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/GroupByFilterCard.test.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/GroupByFilterCard.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FilterBar/index.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FilterBar/utils.test.ts
    • superset-frontend/src/dashboard/components/nativeFilters/FilterBar/utils.ts
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/ColumnSelect.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.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/useDisplayControlDatasource.test.ts
    • superset-frontend/src/dashboard/components/nativeFilters/useDisplayControlDatasource.ts
    • superset-frontend/src/hooks/apiResources/datasets.test.ts
    • superset-frontend/src/hooks/apiResources/datasets.ts
    • superset-frontend/src/utils/semanticViewStructure.test.ts
    • superset-frontend/src/utils/semanticViewStructure.ts
  • Files skipped - 0
  • Tools
    • 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 an incremental AI Review.

  • /review full - 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

@github-actions github-actions Bot added the requires:rebase Requires rebasing on top of current master label Sep 7, 2026
@gabotorresruiz

Copy link
Copy Markdown
Contributor

Thanks for 607b2c5 and cf99987, Mike. I verified both rounds on this head: my two earlier items stay fixed, and the binding-scoped error design for the toast race is exactly right (I re-ran the suites, 145 passing, and reverting each fix one at a time makes exactly its test fail, so everything is genuinely pinned). CI is green.

That leaves one open item between this PR and my approval: the drill-by extension question Elizabeth and I raised. With a load.drillby.options extension registered, the semantic chart's Drill by submenu renders "No columns found" because semanticViewDimensionsToColumns sets no groupby and the ChartContextMenu filter keys on it. Either landing works for me: groupby: true in the mapper (I checked the blast radius, the extension filter is the only consumer that reads .groupby on these columns) or an explicit decision that the submenu is empty on purpose, with one extension-registered test pinning whichever you choose. One word plus one test either way, and then this is an approve from me.

Small coordination note: #43736 (Group By column allowlist) touches four of the same files; the features compose cleanly, whoever merges second just rebases.

Master split labelSource out of result in useDatasetDrillInfo so that
verbose_map labels come from the full dataset API rather than a possibly
partial extension response. The semantic-view path this branch adds has no
such second source -- the structure payload is the label authority -- so it
sets labelSource = result, preserving the pre-merge behaviour. Without it
the semantic view renders an empty verbose_map (raw dimension/metric names);
the existing structure test covers this.

ChartContextMenu.test.tsx was a both-sides-append conflict: the file is the
union of master's two new tests and this branch's semantic-view test.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01EA4MGEkUcDpyLReqjQBhPy
@github-actions github-actions Bot removed the requires:rebase Requires rebasing on top of current master label Sep 15, 2026

@aminghadersohi aminghadersohi 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.

Since our last round the merge brought in #43719, which makes ChartContextMenu's column.groupby filter unconditional — widening @gabotorresruiz's open drill-by item from extension-only to always. Closing it stays his call.

* from the view's structure — never from the colliding regular dataset's
* drill_info — and the menu renders cleanly against the narrowed
* (dimension-derived) column shape. Without the drillby extension, the
* view's dimensions pass the drillable filter, which is deliberate:

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.

This sentence is false at this head: the drillable filter is now unconditional, so the view's dimensions do not pass it (probe: drillable_columns=[]). Taking the mapper suggestion makes it true again; otherwise it needs rewording.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

You're right that the sentence was false at that head. Fixed in e23a37fc28: the obsolete extension-only qualification is gone, and the comment now matches what the test asserts, paired with the mapper change above so the claim is true again rather than just reworded.

Answer PR apache#42539 thread PRRT_kwDOAlosUs6is1Yv by marking mapped semantic dimensions groupby=true so the unconditional drillable-column filter retains them. Add a mapper regression for string and temporal dimensions.

Answer thread PRRT_kwDOAlosUs6is1ZC by asserting the semantic dimension reaches the submenu and removing the obsolete extension qualification. The two new assertions fail without the mapper flag and pass with it.

Validation: 8 relevant Jest suites, 153 tests passed. Commit authorized with documented frontend type-check failures; TS6305 and additional diagnostics also reproduced on plain master. No type-check success claimed.
@bito-code-review

bito-code-review Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #23ab59

Actionable Suggestions - 0
Review Details
  • Files reviewed - 3 · Commit Range: cf99987..e23a37f
    • superset-frontend/src/components/Chart/ChartContextMenu/ChartContextMenu.test.tsx
    • superset-frontend/src/utils/semanticViewStructure.test.ts
    • superset-frontend/src/utils/semanticViewStructure.ts
  • Files skipped - 0
  • Tools
    • 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 an incremental AI Review.

  • /review full - 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

@aminghadersohi aminghadersohi 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.

Verified e23a37fc28: drillable_columns goes []->[Orders Status,Created At] at the real component, and deleting groupby: true reds both new tests. Yes to both your questions -- reverting the scopedError guard reds the 310->311 toast test, and the T013 scope note is the option I meant.

@gabotorresruiz gabotorresruiz 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.

LGTM. I re-verified both of my earlier items plus the drill by question against e23a37fc, in a clean worktree with the suites run locally.

What I checked by running it:

  • /structure cache eviction: fixed at src/utils/semanticViewStructure.ts:96-107. Reverting the try/catch fails evicts the cache on failure so a later call refetches after recovery, so the test really pins it.
  • Legacy 0 sentinel: if (!datasetId) is back at useDisplayControlDatasource.ts:99. Swapping it for the strict null check fails legacy 0 null-sentinel id is inert: no fetch to /dataset/0, no toast.
  • Drill by dimensions: groupby: true at semanticViewStructure.ts:127. Removing it fails the new drillable-columns assertion in ChartContextMenu.test.tsx. I re-walked the blast radius at this head: the other readers of column.groupby are explore/controls.tsx:160, dndControls.tsx:100 and DatasourceModal/index.tsx:230, none of which get their columns from semanticViewDimensionsToColumns.
  • The collision itself: I wrote a throwaway spec that renders two display controls bound to the same numeric id with different types, flips the type on one id, and runs useDatasetDrillInfo('<id>__semantic_view') next to useDatasetDrillInfo('<id>__table'). All four cases resolve to the right datasource here. Against the merge base the same spec fails three of four, the drill case returning the colliding dataset's table_name instead of the view's.
  • Controls for @aminghadersohi's round too: the error binding scope, the dataset branch eviction and clearedCustomizationTarget each fail their named test when reverted, so all three are genuinely pinned.
  • Suites: 113 suites, 1022 passed, 1 skipped, across nativeFilters, Chart/Drill*, ChartContextMenu, hooks/apiResources and dashboard/util. CI is green on this head.

One question, not a blocker

Master has since added a datasource level opt out: useDrillDetailMenuItems disables both Drill to detail and Drill to detail by when the datasource reports supports_drill_to_detail === false (src/components/Chart/useDrillDetailMenuItems/index.tsx:171-176), and SemanticView declares exactly that (superset/semantic_layers/models.py:272-273). I confirmed both renderings in a probe at this head: with a datasources entry for 1__semantic_view carrying supports_drill_to_detail: false the menu renders Drill to detail disabled, and with no entry it renders enabled.

Which of the two a real dashboard hits I could not settle statically: the store keys on the payload uid (src/dashboard/reducers/datasources.ts:32) while SemanticView.uid delegates to self.implementation.uid() (superset/semantic_layers/models.py:495), which is provider defined. Do you know how that lands with a real provider? If the entry does resolve, the drill to detail half of this PR sits behind a disabled menu item, which feels like its own conversation rather than more work here. It would also explain the empty drill pane I asked about last time.

Thanks for staying with this one for so long.

// The structure payload carries no changed_on/owners metadata —
// those metadata-bar rows render their not-available state, an
// accepted degradation. Columns are narrowed to metadata needs;
// no drill flags are fabricated.

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.

Just a small NIT: this says no drill flags are fabricated, but semanticViewDimensionsToColumns now sets groupby: true (src/utils/semanticViewStructure.ts:127), and that is exactly the flag ChartContextMenu.tsx:241 reads to build drillable_columns. Worth a reword so the next reader does not trust it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Addressed in 8fbf49a — reworded the comment; thanks.

@rusackas

Copy link
Copy Markdown
Member

@mikebridge before this merges I'd want aminghadersohi's thread on the untested call site addressed. They verified by reverting just that hunk that all 204 FilterBar/GroupByFilterCard tests still pass, so a semantic-view control could silently rebind to the colliding dataset after "Clear all" with nothing to catch it. There's also a few CodeAnt race-condition flags on useDisplayControlDatasource/ColumnSelect that haven't had a response yet, worth a look even if you end up disagreeing with them.

@bito-code-review

bito-code-review Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #48ef7d

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: e23a37f..8fbf49a
    • superset-frontend/src/hooks/apiResources/datasets.ts
  • Files skipped - 0
  • Tools
    • 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 an incremental AI Review.

  • /review full - 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

@aminghadersohi
aminghadersohi merged commit 560828d into apache:master Sep 18, 2026
78 of 79 checks passed
villebro pushed a commit that referenced this pull request Sep 20, 2026
…, not id alone (#42539)

Co-authored-by: Mike Bridge <[email protected]>
Co-authored-by: Claude Fable 5 <[email protected]>
(cherry picked from commit 560828d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:frontend Requires changing the frontend dashboard:native-filters Related to the native filters of the Dashboard size/XXL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants