Repository navigation
feat: allow drill-to-details to a specific chart (optionaly) configured at the dataset level - #34785
mistercrunch wants to merge 26 commits into
Conversation
There was a problem hiding this comment.
I've completed my review and didn't find any issues.
Files scanned
| File Path | Reviewed |
|---|---|
| superset-frontend/src/components/Chart/types.ts | ✅ |
| superset/migrations/versions/2025-08-21_01-54_852e99567fe7_.py | ✅ |
| superset-frontend/src/features/datasets/types.ts | ✅ |
| superset/migrations/versions/2025-08-11_12-43_f56ac3accfc9_drill_through_chart_fk.py | ✅ |
| superset-frontend/src/components/Select/ChartSelect.tsx | ✅ |
| superset-frontend/src/explore/components/controls/SelectAsyncControl/index.tsx | ✅ |
| superset-frontend/src/components/Datasource/DatasourceModal.tsx | ✅ |
| superset-frontend/src/components/Chart/DrillDetail/DrillDetailPane.tsx | ✅ |
| superset/datasets/schemas.py | ✅ |
| superset/datasets/api.py | ✅ |
| superset-frontend/src/components/Datasource/DatasourceEditor.jsx | ✅ |
| superset/connectors/sqla/models.py | ✅ |
Explore our documentation to understand the languages and file types we support and the files we ignore.
Check out our docs on how you can make Korbit work best for you and your team.
|
@mistercrunch Processing your ephemeral environment request here. Action: up. More information on how to use or configure ephemeral environments |
|
@mistercrunch Ephemeral environment spinning up at http://44.243.96.179:8080. Credentials are 'admin'/'admin'. Please allow several minutes for bootstrapping and startup. |
|
While testing, you might hit a weird known issues related to this comment: #23454 (comment) Refreshing the page fixes it, so you may need to refresh the page between saving the dataset with the new drill-to-chart for it to work in the dashboard. |
|
🎪 @unknown Creating ephemeral environment for commit Action: View workflow Building and deploying... Watch the labels for progress updates. |
8148a7c to
5ffb332
Compare
| import Field from '../Field'; | ||
| import { fetchSyncedColumns, updateColumns } from '../../utils'; | ||
| import DatasetUsageTab from './components/DatasetUsageTab'; | ||
| import ChartSelect from '../Select/ChartSelect'; |
There was a problem hiding this comment.
Suggestion: The relative import points to src/components/Datasource/components/Select/ChartSelect, but ChartSelect is located at src/components/Select/ChartSelect. The datasource editor will fail to resolve this module and the frontend build/runtime will break. Update the import path to traverse out of the datasource component directories before entering components/Select. [import error]
Severity Level: Critical 🚨
- ❌ Frontend build fails resolving the datasource editor import.
- ❌ Dataset editing cannot load with the invalid module path.
- ⚠️ Drill-to-details chart configuration becomes unavailable.Steps of Reproduction ✅
1. Build or load the frontend containing
`superset-frontend/src/components/Datasource/components/DatasourceEditor/DatasourceEditor.jsx`;
the module resolver evaluates the import at line 78.
2. Resolve `../Select/ChartSelect` relative to the editor directory
`src/components/Datasource/components/DatasourceEditor`; this points to the nonexistent
path `src/components/Datasource/components/Select/ChartSelect`.
3. The actual implementation is `src/components/Select/ChartSelect.tsx`, confirmed by
repository file discovery and its exported component at `ChartSelect.tsx:48`.
4. Observe a module-resolution error during the frontend build or runtime loading of the
datasource editor; the import should traverse three parent directories using
`../../../Select/ChartSelect`.(Use Cmd/Ctrl + Click for best experience)
Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** superset-frontend/src/components/Datasource/components/DatasourceEditor/DatasourceEditor.jsx
**Line:** 78:78
**Comment:**
*Import Error: The relative import points to `src/components/Datasource/components/Select/ChartSelect`, but `ChartSelect` is located at `src/components/Select/ChartSelect`. The datasource editor will fail to resolve this module and the frontend build/runtime will break. Update the import path to traverse out of the datasource component directories before entering `components/Select`.
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 dashboardContextFormData = useDashboardFormData( | ||
| dataset?.drill_through_chart_id, | ||
| ); |
There was a problem hiding this comment.
Suggestion: Dashboard context is calculated for the configured target chart only. A target chart that is not present in the current dashboard, or whose scope does not include that chart ID, receives no scoped dashboard filters even when the source chart is affected by them. This makes drill-through results differ from the filtered source chart; the context should account for the source chart's active filters or explicitly merge the applicable source and target scopes. [incorrect condition logic]
Severity Level: Major ⚠️
- ❌ Drill results can omit filters applied to the source chart.
- ⚠️ Cross-dashboard drill consistency breaks for scoped filters.
- ⚠️ Users see results differing from the chart they drilled from.Steps of Reproduction ✅
1. Configure a dashboard native filter whose scope includes the source chart but excludes
the dataset-level drill-through target chart; scoped filter application is determined by
getFilterIdsAppliedOnChart at
superset-frontend/src/dashboard/util/getFilterIdsAppliedOnChart.ts:31-37.
2. Trigger drill-to-detail from the source chart through ChartContextMenu.tsx:447, which
passes the source chart ID and drill form data into DrillDetailModal.
3. DrillDetailModal.tsx:123-125 asks useDashboardFormData for the target chart ID, not the
source chart ID; useDashboardFormData.ts:81-85 therefore excludes filters whose scope does
not contain the target ID.
4. DrillDetailModal.tsx:138-143 merges that target-only dashboard context with the drill
filters, so the StatefulChart at DrillDetailPane.tsx:303-309 queries without dashboard
filters that affected the source chart, producing different drill-through results.(Use Cmd/Ctrl + Click for best experience)
Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** superset-frontend/src/components/Chart/DrillDetail/DrillDetailModal.tsx
**Line:** 123:125
**Comment:**
*Incorrect Condition Logic: Dashboard context is calculated for the configured target chart only. A target chart that is not present in the current dashboard, or whose scope does not include that chart ID, receives no scoped dashboard filters even when the source chart is affected by them. This makes drill-through results differ from the filtered source chart; the context should account for the source chart's active filters or explicitly merge the applicable source and target scopes.
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| // If a drill-through chart is configured, use it instead of the table | ||
| if (dataset?.drill_through_chart_id && drillThroughFormData) { | ||
| tableContent = ( | ||
| <Flex vertical style={{ height: '100%' }}> | ||
| <StatefulChart | ||
| chartId={dataset.drill_through_chart_id} | ||
| formDataOverrides={drillThroughFormData} | ||
| height="100%" | ||
| width="100%" | ||
| showLoading | ||
| /> |
There was a problem hiding this comment.
Suggestion: StatefulChart refetches whenever the formDataOverrides object changes, but its fetch callback captures the props from its initial render. When dashboard filters or drill filters change while the modal is open, this call therefore triggers a request using the original overrides and the displayed chart remains stale. The chart component or this integration must ensure that refetches use the latest form data. [stale reference]
Severity Level: Major ⚠️
- ❌ Open drill views can display stale filtered results.
- ⚠️ Dashboard filter changes are not reflected reliably.
- ⚠️ Users may export or inspect outdated drill data.Steps of Reproduction ✅
1. Open drill-to-detail from the dashboard context-menu path at
superset-frontend/src/components/Chart/ChartContextMenu/ChartContextMenu.tsx:447, which
supplies drill filters and dashboard context to the modal.
2. DrillDetailPane.tsx:299-309 renders StatefulChart with the memoized
drillThroughFormData as formDataOverrides.
3. When dashboard context or drill filters change, DrillDetailModal.tsx:127-149 produces a
new override object, and StatefulChart.tsx:66-74 correctly detects the changed
formDataOverrides and invokes fetchData.
4. StatefulChart.tsx:170-180 defines fetchData with an empty dependency array, so that
callback retains the props from its initial render; StatefulChart.tsx:193-212 consequently
fetches using the original overrides even though the effect was triggered by newer
overrides, leaving the displayed chart stale.(Use Cmd/Ctrl + Click for best experience)
Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** superset-frontend/src/components/Chart/DrillDetail/DrillDetailPane.tsx
**Line:** 299:309
**Comment:**
*Stale Reference: `StatefulChart` refetches whenever the `formDataOverrides` object changes, but its fetch callback captures the props from its initial render. When dashboard filters or drill filters change while the modal is open, this call therefore triggers a request using the original overrides and the displayed chart remains stale. The chart component or this integration must ensure that refetches use the latest form data.
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| // Invalidate drill info cache to pick up any drill-through config changes | ||
| invalidateDatasetDrillCache(currentDatasource.id); |
There was a problem hiding this comment.
Suggestion: The cache is invalidated only after both the dataset PUT and the follow-up GET succeed. If the PUT succeeds but the GET fails, the catch path reports a save error without clearing the old drill-info entry, so subsequent drill-to-detail operations continue using the previous chart configuration. Invalidate the drill-info cache immediately after a successful mutation, independently of the refresh GET. [cache]
Severity Level: Major ⚠️
- ⚠️ Dataset saves can leave stale drill configuration cached.
- ⚠️ Subsequent dashboard drill actions use the previous chart.
- ⚠️ A failed refresh falsely indicates the new configuration was not applied.Steps of Reproduction ✅
1. Open the dataset editor and save a changed drill-through chart;
DatasourceModal.tsx:200-203 successfully sends the dataset PUT request.
2. Make the follow-up dataset GET at DatasourceModal.tsx:205-207 fail through a transient
network or server error after the PUT has already succeeded.
3. Because invalidateDatasetDrillCache is called only at DatasourceModal.tsx:209-210 after
the GET resolves, the catch path at lines 221-224 reports an error without deleting cached
drill-info entries.
4. Reopen or use drill-to-detail from SliceHeaderControls.tsx:588; the dataset drill
metadata is loaded through cachedSupersetGet at
superset-frontend/src/hooks/apiResources/datasets.ts:99-103, so the stale cached
configuration can continue selecting the previous chart.(Use Cmd/Ctrl + Click for best experience)
Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** superset-frontend/src/components/Datasource/DatasourceModal/index.tsx
**Line:** 209:210
**Comment:**
*Cache: The cache is invalidated only after both the dataset PUT and the follow-up GET succeed. If the PUT succeeds but the GET fails, the catch path reports a save error without clearing the old drill-info entry, so subsequent drill-to-detail operations continue using the previous chart configuration. Invalidate the drill-info cache immediately after a successful mutation, independently of the refresh GET.
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 fixDatasourceEditor.jsx imported ChartSelect from '../Select/ChartSelect', which resolves to a nonexistent Datasource/components/Select directory. ChartSelect actually lives at src/components/Select/ChartSelect, so this broke module resolution. Flagged in review. Co-Authored-By: Claude Sonnet 5 <[email protected]>
CodeQL flagged a DOM-XSS taint path (js/xss-through-dom) from DashboardPageIdContext into window.location.href via generateExploreUrl. Wrap the generated URL in sanitizeUrl(), matching the existing convention used elsewhere for window.location.href assignments (e.g. ResultSet, SaveDatasetModal, navigationUtils). Co-Authored-By: Claude <[email protected]>
Code Review Agent Run #92790fActionable 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 |
The test mocked getExploreUrl from src/explore/exploreUtils, but the component was refactored to use generateExploreUrl (which calls postFormData) from src/explore/exploreUtils/formData. Update the mock to target postFormData, matching the pattern already used in SaveDatasetModal.test.tsx, so URL generation is properly stubbed. Co-Authored-By: Claude Sonnet 5 <[email protected]>
…ation The Create chart click handler awaited generateExploreUrl with no catch, so a failed form-data POST produced an unhandled promise rejection and no user feedback. Wrap it in try/catch and surface the same danger toast pattern already used for URL generation failures elsewhere (e.g. DrillDetailModal). Flagged in review. Co-Authored-By: Claude <[email protected]>
Code Review Agent Run #c09dc4Actionable 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 |
…t save The drill-info cache invalidation ran after the follow-up GET, so a failed refresh (PUT succeeds, GET fails) left the stale drill-through config cached even though the save itself went through. Move the invalidation right after the mutation succeeds, independent of the refresh GET. Co-Authored-By: Claude <[email protected]>
Code Review Agent Run #620bbeActionable Suggestions - 0Additional Suggestions - 1
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 |
|
Conflicts are back after last month's rebase, and CI never got past queued on the last push here — cypress, playwright, python-unit, sonarqube, codecov all stuck, only docs-preview and labeler ran. Anyone seen that on other branches, or is this one specifically stuck? |
|
LMK if you want help getting this one patched up and reviewed. |
| const drillThroughBaseFormData = { | ||
| slice_id: dataset.drill_through_chart_id, | ||
| datasource: `${dataset.id}__table`, | ||
| viz_type: 'table', |
There was a problem hiding this comment.
This overrides the saved chart's viz_type, so configuring any non-table chart for drill-through still renders a table. Could the override contain only the drill context and leave the selected chart's visualization type intact?
| fetch_values_predicate = fields.String(allow_none=True) | ||
| extra = fields.Dict(allow_none=True) | ||
| uuid = fields.UUID(required=True) | ||
| drill_through_chart_id = fields.Integer(allow_none=True) |
There was a problem hiding this comment.
This exports an environment-local slices.id as dataset configuration. Importing a dataset into another instance can either fail the foreign key before that chart exists or bind the dataset to an unrelated chart with the same ID. Could this use a portable chart reference and resolve it after chart import instead?
🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️❗ @mistercrunch Your base branch
|
2 similar comments
🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️❗ @mistercrunch Your base branch
|
🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️❗ @mistercrunch Your base branch
|
| return ( | ||
| <> | ||
| {!isEmbedded() && ( | ||
| {!isEmbedded() && showEditButton && ( |
There was a problem hiding this comment.
This hides the existing Explore/Edit action for every dataset without the new configuration, so the claimed no-op fallback removes the only shortcut back to the source chart after upgrade. Should the unconfigured path keep the previous source-chart action?
| ]; | ||
|
|
||
| return { | ||
| q: rison.encode({ |
There was a problem hiding this comment.
This request gets only Flask-AppBuilder’s default 20-row page, and SelectAsyncControl neither paginates nor sends a server-side search term. A valid chart that sorts after the first page can never be selected; can this use the paginated async selector instead?
| columns = fields.List(fields.Nested(DatasetColumnsPutSchema)) | ||
| metrics = fields.List(fields.Nested(DatasetMetricsPutSchema)) | ||
| folders = fields.List(fields.Nested(FolderSchema), required=False) | ||
| drill_through_chart_id = fields.Integer(allow_none=True) |
There was a problem hiding this comment.
The runtime dataset API now accepts and returns this field, but the checked-in OpenAPI document has no drill_through_chart_id property. Generated clients therefore cannot configure the feature and may reject the response; could the API specification be regenerated with this field?
🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️❗ @mistercrunch Your base branch
|
|
6 similar comments
|
|
|
|
|
|
There was a problem hiding this comment.
Not duplicating a line-by-line pass across all 27 open bot threads here, but two things stand out as worth resolving whenever this comes back up: the DB-migration-conflict bot has been nagging on this since September (master picked up a new migration after this branch, so merging as-is risks two Alembic heads), and there's a real GHAS CodeQL alert (not just an LLM heuristic) on DrillDetailModal.tsx for DOM text being reinterpreted as HTML without escaping, which is worth a direct look.
Given the showtime-blocked label and three months of no non-bot activity, I'm guessing this is intentionally paused rather than actively being worked. Let me know if that's not the case and you want help getting it unstuck.
|
3 similar comments
|
|
|
This PR introduces customizable drill-to-details functionality that allows dataset owners to configure which chart should be used when users drill through from any chart using their dataset.
Problem: Current drill-to-details uses a one-size-fits-all approach showing all columns in a generic table with no customization options.
Solution: Dataset-level drill-to-details customization allowing association of any existing chart as the drill-to-details target.
Key Benefits:
Implementation:
Walkthrough: