Repository navigation
fix(filters): sort numeric filter values numerically, not lexicographically (#36775) - #42596
Conversation
Code Review Agent Run #83fdb5Actionable 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 flagged issue is correct. The test fails because the current implementation sorts options lexicographically using Since I do not have access to the production code ( Regarding other comments on this PR, there are no additional comments in the provided review data. Would you like me to assist with any other aspects of this PR? superset-frontend/src/filters/components/Select/SelectFilterPlugin.test.tsx |
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #42596 +/- ##
==========================================
- Coverage 65.59% 65.59% -0.01%
==========================================
Files 2819 2819
Lines 160166 160173 +7
Branches 36569 36575 +6
==========================================
Hits 105065 105065
- Misses 53053 53060 +7
Partials 2048 2048
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:
|
Code Review Agent Run #f05d56Actionable 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 |
…anch Closes review feedback on #42596: BIGINT columns with 16+ digit values decode to native `bigint` (see json-bigint parsing), not `number`. The numeric-sort fix landed in 8966a1d compares by `value` for Numeric columns via propertyComparator, but that comparator's numeric branch only matched `typeof === 'number'`, so bigint values fell through to the string fallback and reproduced the exact "10, 100, 2" bug for BIGINT-backed filters. propertyComparator now also compares bigint (and mixed bigint/number) values numerically via relational operators. Verified the comparator logic directly with a standalone Node script (diverging-digit-length bigints sort correctly with the new branch, incorrectly without it) since `npm install` hangs on this worktree's volume before node_modules exist; prettier and oxlint pass on both changed files. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Code Review Agent Run #1dbba6Actionable 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 |
…graphically (#36775) Closes #36775 Adds a regression test on PluginFilterSelect confirming that when no sortMetric is configured, numeric filter-value options are ordered by their numeric value (2, 10, 100) rather than by lexicographic comparison of their formatted string labels (10, 100, 2). Root cause: SelectFilterPlugin's sortComparator always compares the formatted `label` via propertyComparator('label'). getDataRecordFormatter (superset-frontend/src/filters/utils.ts) always returns a string, so numeric columns hit propertyComparator's string branch (localeCompare) instead of its numeric branch, even though the values themselves are numeric. This is the second recurrence of the #35008/#34858 fix, which patched SelectControl.jsx (chart-builder numeric selects like Row limit) but never touched this native-filter value dropdown. Co-Authored-By: Claude Sonnet 5 <[email protected]>
…ically Closes #36775 sortComparator compared options via propertyComparator('label'), but getDataRecordFormatter (filters/utils.ts) always returns a formatted string label regardless of the column's underlying datatype. Numeric filter values therefore always hit propertyComparator's string branch (localeCompare) instead of its numeric branch, producing "1, 10, 100, 2" instead of "1, 2, 10, 100". propertyComparator already has a numeric branch; it just needs a property that actually holds a number. `value` (the raw, unformatted option value) does for numeric columns, while `label` never does. Fix compares by `value` when the column's GenericDataType is Numeric, and keeps comparing by `label` for every other type -- unaffected here since #34858 already fixed the analogous SelectControl.jsx bug; this native-filter value dropdown just has its own independent sort path that #34858 never touched, and #36775 is the recurrence. Disclosure: type-checking-frontend was skipped locally (SKIP set) -- this worktree's `tsc --build` currently fails on unrelated TS2742 "inferred type... not portable" errors in Tabs.tsx/SafeMarkdown.tsx/ spec/index.tsx (pre-existing composite-build fragility, not touched by this change; the PR's own prior commit disclosed the same build-environment limitation). oxlint, prettier, and the full SelectFilterPlugin.test.tsx suite (39/39, including the new regression test and both pre-existing alphabetical-sort tests) are green locally. CI's Type-Checking (Frontend) job is the real gate.
…anch Closes review feedback on #42596: BIGINT columns with 16+ digit values decode to native `bigint` (see json-bigint parsing), not `number`. The numeric-sort fix landed in 8966a1d compares by `value` for Numeric columns via propertyComparator, but that comparator's numeric branch only matched `typeof === 'number'`, so bigint values fell through to the string fallback and reproduced the exact "10, 100, 2" bug for BIGINT-backed filters. propertyComparator now also compares bigint (and mixed bigint/number) values numerically via relational operators. Verified the comparator logic directly with a standalone Node script (diverging-digit-length bigints sort correctly with the new branch, incorrectly without it) since `npm install` hangs on this worktree's volume before node_modules exist; prettier and oxlint pass on both changed files. Co-Authored-By: Claude Opus 4.8 <[email protected]>
cc3571c to
5f44491
Compare
There was a problem hiding this comment.
Code Review Agent Run #c66c9e
Actionable Suggestions - 1
-
superset-frontend/packages/superset-ui-core/src/components/Select/utils.tsx - 1
- Missing bigint test coverage · Line 98-105
Review Details
-
Files reviewed - 3 · Commit Range:
12ee488..5f44491- superset-frontend/packages/superset-ui-core/src/components/Select/utils.tsx
- superset-frontend/src/filters/components/Select/SelectFilterPlugin.test.tsx
- superset-frontend/src/filters/components/Select/SelectFilterPlugin.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 [email protected].
Documentation & Help
Addresses bot review feedback on #42596: the bigint comparison branch was only exercised indirectly through SelectFilterPlugin.test.tsx. Add direct unit tests in utils.test.ts covering string, number, bigint, diverging-digit-length bigint, and mixed bigint/number comparisons. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Code Review Agent Run #ac88eaActionable 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 |
SUMMARY
Closes #36775 (filed 2026, a recurrence of #35008): numeric filter values in the dashboard filter-value dropdown were sorted alphabetically ("1, 10, 100...") instead of numerically ("1, 2, 3..."). Confirmed still present through 6.0.0, 6.0.1rc1, and 6.1.0rc2 per reporter comments.
Root cause:
SelectFilterPlugin'ssortComparator(superset-frontend/src/filters/components/Select/SelectFilterPlugin.tsx) compared options viapropertyComparator('label'), butgetDataRecordFormatter(superset-frontend/src/filters/utils.ts) always returns a formattedstringlabel regardless of the column's underlying datatype. Numeric filter values therefore always hitpropertyComparator's string branch (localeCompare) instead of its numeric branch. This is the second recurrence: #34858 fixed the analogous bug inSelectControl.jsx(chart-builder numeric selects like "Row limit"), but never touched this native-filter value dropdown, which has its own independent sorting logic.Fix:
propertyComparatoralready has a working numeric branch — it just needs a property that actually holds a number. The unformattedvalueon each option does, for numeric columns, whilelabelnever does.sortComparatornow compares byvaluewhen the column'sGenericDataTypeisNumeric, and keeps comparing bylabelfor every other type, so string/temporal/boolean sorting is untouched.This started as a test-only TDD PR (added one regression test on
PluginFilterSelect); this update adds the fix itself once CI confirmed the test was red.TESTING INSTRUCTIONS
Full suite: 39/39 passing, including the new regression test and both pre-existing alphabetical-sort tests (confirming string-column sorting is unaffected).
ADDITIONAL INFORMATION
Disclosure: the local
type-checking-frontendpre-commit hook was skipped (SKIP=type-checking-frontend) — this worktree'stsc --buildcurrently fails on pre-existing TS2742 "inferred type... not portable" errors in unrelated files (Tabs.tsx,SafeMarkdown.tsx,spec/index.tsx), not touched by this change. All other local hooks (prettier, oxlint, custom-rules-frontend, stylelint) passed. CI'sType-Checking (Frontend)job is the real gate for this.🤖 Generated with Claude Code