codeant-ai-for-open-source[bot] commented on code in PR #42596:
URL: https://github.com/apache/superset/pull/42596#discussion_r3679112655
##########
superset-frontend/src/filters/components/Select/SelectFilterPlugin.test.tsx:
##########
@@ -720,6 +720,80 @@ describe('SelectFilterPlugin', () => {
expect(options[2]).toHaveTextContent('beta');
});
+ test('sorts numeric filter values numerically, not lexicographically, when
no sortMetric is specified', () => {
+ // Regression for #36775: numeric filter values were sorted as strings
+ // (localeCompare on the formatted label), producing "1, 10, 100, 2"
+ // instead of the expected "1, 2, 10, 100".
+ const testData = [{ age: 10 }, { age: 2 }, { age: 100 }];
Review Comment:
**Suggestion:** The new test asserts behavior that the exercised
implementation does not provide: `labelFormatter` converts these numeric values
to string labels, and `SelectFilterPlugin` sorts using
`propertyComparator('label')`, whose string branch uses `localeCompare`.
Consequently this fixture renders as `10`, `100`, `2`, so the test fails
consistently until the production comparator is made numeric-aware. Either
implement the comparator fix in the production change or keep this test out of
a test-only PR intended to remain green. [api mismatch]
<details>
<summary><b>Severity Level:</b> Critical 🚨</summary>
```mdx
- ❌ Numeric native-filter dropdowns remain lexicographically sorted.
- ❌ The new regression test fails in CI.
- ⚠️ Dashboard users see incorrect numeric filter ordering.
```
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=88379edf40c9423e906c1a38a869bf19&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=88379edf40c9423e906c1a38a869bf19&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:**
superset-frontend/src/filters/components/Select/SelectFilterPlugin.test.tsx
**Line:** 723:727
**Comment:**
*Api Mismatch: The new test asserts behavior that the exercised
implementation does not provide: `labelFormatter` converts these numeric values
to string labels, and `SelectFilterPlugin` sorts using
`propertyComparator('label')`, whose string branch uses `localeCompare`.
Consequently this fixture renders as `10`, `100`, `2`, so the test fails
consistently until the production comparator is made numeric-aware. Either
implement the comparator fix in the production change or keep this test out of
a test-only PR intended to remain green.
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
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42596&comment_hash=27eea61dfc3a0e1dcb969709c7cc8c265c28d418bc40440cf0fc95f8335beb37&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42596&comment_hash=27eea61dfc3a0e1dcb969709c7cc8c265c28d418bc40440cf0fc95f8335beb37&reaction=dislike'>👎</a>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]