Skip to content

feat(native-filters): make filter dependency support extensible via plugin registry#40905

Open
ashah65 wants to merge 2 commits into
apache:masterfrom
ashah65:feat/extensible-filter-dependency-registry
Open

feat(native-filters): make filter dependency support extensible via plugin registry#40905
ashah65 wants to merge 2 commits into
apache:masterfrom
ashah65:feat/extensible-filter-dependency-registry

Conversation

@ashah65

@ashah65 ashah65 commented Jun 9, 2026

Copy link
Copy Markdown

Replace hardcoded ALLOW_DEPENDENCIES list with a registry-based check so any filter plugin registering with Behavior.NativeFilter automatically supports the cascade dependency feature — no core changes needed for new plugins.

Also adds isColumnSelect support in getControlItemsMap to allow plugins to declare dataset column picker controls.

SUMMARY

Currently, the mechanism that determines which native filters support cascading dependencies relies on a hardcoded list (ALLOW_DEPENDENCIES) within the core Superset codebase. This creates a tight coupling that blocks external, third-party, or custom filter plugins from leveraging cascading features without directly mutating core files.

This PR refactors the filter dependency system to be entirely registry-driven and enhances control mapping flexibility.

Design Decisions & Changes:

Registry-Driven Dependencies: Replaced the hardcoded check with a dynamic lookup. Any filter plugin that registers with Behavior.NativeFilter now automatically inherits support for the cascade dependency feature out-of-the-box. This eliminates the need for future core repository changes when new filters are introduced.

Dynamic Column Selection Controls: Added explicit support for isColumnSelect inside getControlItemsMap. This allows external plugins to declaratively request dataset column picker controls directly from the native filter configuration modal.

TESTING INSTRUCTIONS

Since this is an architectural enablement patch, testing should focus on verifying that existing core filters suffer no regressions, and that the underlying hooks resolve correctly.

Navigate to a dashboard and open the Manage native filters modal.

Create a standard core filter (e.g., a Select or Numerical Range filter).

Ensure that the "Filter is dependent on..." (cascading) configuration option is visible, selectable, and functional.

Verify that dataset column configuration selectors still populate and save accurately for out-of-the-box filters.

Register a custom dummy plugin leveraging Behavior.NativeFilter to verify it successfully reveals dependency options without updating core mapping arrays.

ADDITIONAL INFORMATION

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

…lugin registry

Replace hardcoded ALLOW_DEPENDENCIES list with a registry-based check so
any filter plugin registering with Behavior.NativeFilter automatically
supports the cascade dependency feature — no core changes needed for
new plugins.

Also adds isColumnSelect support in getControlItemsMap to allow plugins
to declare dataset column picker controls.
@dosubot dosubot Bot added the dashboard:native-filters Related to the native filters of the Dashboard label Jun 9, 2026
@bito-code-review

Copy link
Copy Markdown
Contributor

The flagged issue is correct. When divider edits are made, the handleValuesChange function in FiltersConfigModal does not trigger the necessary state updates to mark the divider as modified, which prevents the canSave flag from enabling the Save button.

To resolve this, you should ensure that divider-specific changes are tracked. You can update handleValuesChange to inspect the changed values and call handleModifyItem when the changed ID corresponds to a divider. Alternatively, passing a modification callback into DividerConfigForm would allow it to explicitly add the divider ID to changes.modified.

Would you like me to fetch all other comments on this PR to validate them and implement minimal fixes for those as well?

superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigModal.tsx

const handleValuesChange = (changedValues: any, allValues: any) => {
  // ... existing logic
  if (changedValues.filters) {
    const changedId = Object.keys(changedValues.filters)[0];
    if (isDivider(changedId)) {
      handleModifyItem(changedId);
    }
  }
  // ...
};

@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 #d2347d

Actionable Suggestions - 3
  • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/getControlItemsMap.tsx - 2
  • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigModal.tsx - 1
Additional Suggestions - 2
  • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx - 1
    • Dead code from incomplete removal · Line 650-691
      Since the operatorType auto-reset logic depends on columns.type_generic, you should either add 'columns.type_generic' back to the API query's columns list or remove the related operatorType auto-reset code (lines 650–691) entirely.
  • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/getControlItemsMap.tsx - 1
    • Missing test coverage for isColumnSelect · Line 322-350
      The new `isColumnSelect` feature block (lines 322-350) lacks test coverage. Existing tests mock `ColumnSelect` but not `DatasetColumnSelect`. Add unit tests following the pattern in lines 212-251 to validate the new feature's behavior, including `notifyChange` propagation and initial value resolution.
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/getControlItemsMap.tsx - 1
    • Missing unit tests for DatasetColumnSelect · Line 105-149
  • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx - 1
Review Details
  • Files reviewed - 5 · Commit Range: 3596459..3596459
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/getControlItemsMap.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigModal.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/hooks/index.ts
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/hooks/useFilterOperations.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 evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

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

This PR refactors native filter cascading-dependency support to be registry-driven (based on plugin metadata behaviors) and extends the native filter config modal’s control mapping to support plugin-declared dataset column picker controls (isColumnSelect).

Changes:

  • Replaced the hardcoded native-filter dependency allowlist with a registry-based Behavior.NativeFilter check.
  • Exported the new dependency-support helper through the hooks index and config modal module.
  • Added isColumnSelect handling in getControlItemsMap and introduced a dataset-column fetching select control for plugins.

Reviewed changes

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

Show a summary per file
File Description
superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/hooks/useFilterOperations.ts Switches dependency eligibility to a registry/behavior-based check.
superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/hooks/index.ts Re-exports the new helper instead of the removed hardcoded allowlist.
superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigModal.tsx Wires the new helper export; modifies form onValuesChange handling.
superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/getControlItemsMap.tsx Adds isColumnSelect rendering and a dataset column select control.
superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx Adopts the new dependency helper; includes additional unrelated UI logic changes.

- Mark divider edits as modified so canSave is enabled for divider changes
- Persist sortMetric=undefined when Select is cleared via allowClear
- Restore datasetLabel() for semantic-layers feature flag consistency
- Restore time_grains allowlist UI for filter_timegrain config
- Restore operatorType (Match type) UI for filter_select config
- Fix ControlLabel to resolve function-typed label/description props
- Fix DatasetColumnSelect: add cancellation, error handling, allowClear

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@netlify

netlify Bot commented Jun 9, 2026

Copy link
Copy Markdown

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 212fbbc
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6a285bf4f9546d000870c467
😎 Deploy Preview https://deploy-preview-40905--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.

@bito-code-review

bito-code-review Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #0adbb6

Actionable Suggestions - 0
Additional Suggestions - 2
  • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx - 1
    • Null reference on undefined object · Line 660-660
      The `onOperatorTypeChanged` function accesses `.controlValues` on a potentially undefined object. If `form.getFieldValue('filters')?.[filterId]` is undefined, this will throw a TypeError at runtime. Add optional chaining (`?.controlValues`) and a fallback empty object.
      Code suggestion
      --- a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx
      +++ b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx
       @@ -657,7 +657,7 @@ const FiltersConfigForm = (
          }, [formFilter?.column, datasetDetails?.columns]);
       
          const onOperatorTypeChanged = (value: SelectFilterOperatorType) => {
      -    const previous = form.getFieldValue('filters')?.[filterId].controlValues;
      +    const previous = form.getFieldValue('filters')?.[filterId]?.controlValues ?? {};
            setNativeFilterFieldValues(form, filterId, {
              controlValues: {
                ...previous,
  • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/getControlItemsMap.tsx - 1
    • Tooltip text conversion complexity · Line 98-103
      The `tooltipText` extraction has redundant String conversion logic (lines 98-103). When `resolvedDescription` is a React element (e.g., `text`), `String(resolvedDescription)` produces `'[object Object]'` instead of preserving the rich content. Consider directly using `resolvedDescription` when it's ReactNode, or document this behavior.
Review Details
  • Files reviewed - 3 · Commit Range: 3596459..212fbbc
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/getControlItemsMap.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigModal.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ 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 evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dashboard:native-filters Related to the native filters of the Dashboard size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants