Repository navigation
fix(dashboard): resolve display-control and drill datasources by type, not id alone - #42539
Conversation
There was a problem hiding this comment.
Code Review Agent Run #c63ed6
Actionable Suggestions - 1
-
superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/utils.test.ts - 1
- Missing type_generic assertion · Line 420-437
Additional Suggestions - 1
-
superset-frontend/src/hooks/apiResources/datasets.ts - 1
-
Unused field on type mismatch · Line 131-131The `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
- SV columns not in Redux store · Line 764-782
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
| 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, | ||
| }); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 Report❌ Patch coverage is 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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
useDatasetDrillInfoto avoid colliding/dataset/<id>drill metadata. - Introduce
useDisplayControlDatasourcehook with stale-response guarding for type flips; wire Dynamic group-by control to it. - Extract and reuse
fetchSemanticViewStructure+semanticViewDimensionsToColumns, and preservedatasourceTypethrough 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). |
|
@mikebridge this looks like a solid fix, threading One thing before I'd merge: Bito's flagging that the Also a handful of other bot threads are still open (the |
rusackas
left a comment
There was a problem hiding this comment.
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.
… 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.
|
@rusackas all five open items are addressed in
Verified: 93/93 across the FiltersConfigForm suites, 101/101 across Disclosure: fixes and replies prepared with AI assistance (Claude), on behalf of and reviewed by @mikebridge. |
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
| setLoading(true); | ||
| setError(undefined); |
There was a problem hiding this comment.
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.(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| fetchSemanticViewStructure(datasetId) | ||
| .then(({ name: svName, dimensions, metrics: svMetrics }) => { | ||
| const columns = semanticViewDimensionsToColumns(dimensions); |
There was a problem hiding this comment.
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.(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| 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>]); |
There was a problem hiding this comment.
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.(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) |
There was a problem hiding this comment.
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.(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
Code Review Agent Run #79e679Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
eschutho
left a comment
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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:
-
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.
-
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.
-
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.
@mikebridge — following up on the drill-by submenu question above. @gabotorresruiz independently hit the same gap while live-testing yesterday and confirmed the |
… 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]>
a3cc311 to
328f502
Compare
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
328f502 to
cf99987
Compare
|
@aminghadersohi — thanks for the round-1 review. All five findings are addressed (head
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
left a comment
There was a problem hiding this comment.
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.
Code Review Agent Run #cb770cActionable Suggestions - 0Additional Suggestions - 7
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
|
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 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
aminghadersohi
left a comment
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Code Review Agent Run #23ab59Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
aminghadersohi
left a comment
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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:
/structurecache eviction: fixed atsrc/utils/semanticViewStructure.ts:96-107. Reverting thetry/catchfailsevicts the cache on failure so a later call refetches after recovery, so the test really pins it.- Legacy
0sentinel:if (!datasetId)is back atuseDisplayControlDatasource.ts:99. Swapping it for the strict null check failslegacy 0 null-sentinel id is inert: no fetch to /dataset/0, no toast. - Drill by dimensions:
groupby: trueatsemanticViewStructure.ts:127. Removing it fails the newdrillable-columnsassertion inChartContextMenu.test.tsx. I re-walked the blast radius at this head: the other readers ofcolumn.groupbyareexplore/controls.tsx:160,dndControls.tsx:100andDatasourceModal/index.tsx:230, none of which get their columns fromsemanticViewDimensionsToColumns. - 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 touseDatasetDrillInfo('<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'stable_nameinstead of the view's. - Controls for @aminghadersohi's round too: the error binding scope, the dataset branch eviction and
clearedCustomizationTargeteach 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/apiResourcesanddashboard/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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Addressed in 8fbf49a — reworded the comment; thanks.
|
@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 |
Code Review Agent Run #48ef7dActionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
…, not id alone (#42539) Co-authored-by: Mike Bridge <[email protected]> Co-authored-by: Claude Fable 5 <[email protected]> (cherry picked from commit 560828d)
SUMMARY
Semantic views and regular datasets have independent numeric-id sequences, so a semantic view with
id=3and a regular dataset withid=3both exist. Two surfaces resolved their bound datasource by id alone and silently read the wrong object:/api/v1/dataset/<id>while ignoring thedatasourceTypealready persisted ontargets[0], so the dropdown offered the colliding dataset's columns with no error shown.useDatasetDrillInfoparsed the<id>__<type>composite but discarded the type, so the drill modal's name andverbose_mapcame 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:
fetchSemanticViewStructure/semanticViewDimensionsToColumnsfrom the two existing inline copies (ColumnSelect.tsx,FiltersConfigForm.tsx) and migrate both onto them. Behaviour-preserving; existing suites unchanged.useDisplayControlDatasourcehook — type-branched resolution with a monotonic request-id stale-response guard (a slow/dataset/3must not overwrite a fast/semantic_view/3/structureafter 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.datasourceTypeat both target-rewrite sites (handleColumnChangeand 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— thesemantic_viewbranch short-circuits before theload.drillby.optionsextension 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.dependenciescoupling (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):
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.SemanticLayersenabled and a configured extension):Regression check on regular datasets: repeat steps 2-6 against a normal dataset-backed chart; behaviour should be indistinguishable from master.
ADDITIONAL INFORMATION
SemanticLayers