codeant-ai-for-open-source[bot] commented on code in PR #40221:
URL: https://github.com/apache/superset/pull/40221#discussion_r3268563867


##########
superset-frontend/packages/superset-ui-core/src/components/Select/Select.tsx:
##########
@@ -519,7 +519,8 @@ const Select = forwardRef(
               handleSelectAll();
             }}
           >
-            {t('Select all')} {`(${formatNumber('SMART_NUMBER', 
bulkSelectCounts.selectable)})`}
+            {t('Select all')}{' '}
+            {`(${formatNumber('SMART_NUMBER', bulkSelectCounts.selectable)})`}

Review Comment:
   **Suggestion:** The selectable count is rendered outside the translation 
string, so translators cannot reorder or localize the full label (text + 
number) correctly for languages with different grammar. Put the count inside a 
single `t(...)` message with a placeholder so the whole phrase is translatable. 
[code quality]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ⚠️ Bulk select label poorly localized in non-English locales.
   - ⚠️ Translators cannot reorder count relative to label text.
   ```
   </details>
   <details>
   <summary><b>Steps of Reproduction ✅ </b></summary>
   
   ```mdx
   1. Open 
`superset-frontend/packages/superset-ui-core/src/components/Select/Select.tsx` 
and
   locate the `bulkSelectComponent` `useMemo` defined near the bottom of the 
file; within
   this JSX block, at diff lines 522–523, the label is rendered as `{t('Select 
all')}{' '}`
   on one line and `{`(${formatNumber('SMART_NUMBER', 
bulkSelectCounts.selectable)})`}` on
   the next.
   
   2. In the same file, at diff lines 552–565 (confirmed via BulkRead), 
`popupRender` passes
   `selectAllEnabled ? bulkSelectComponent : undefined` into 
`dropDownRenderHelper`, so
   whenever `selectAllEnabled` (computed earlier in this file around lines 
11–23 of the
   BulkRead snippet) is true, the dropdown renders this combined label to the 
user.
   
   3. Run the frontend with a non-English locale enabled so that `t('Select 
all')` resolves
   via the i18n catalogs; observe that translators only see and can translate 
the bare string
   `"Select all"` because the numeric count and parentheses `(${...})` are 
added in code and
   are not part of the translation key.
   
   4. Observe in the UI that the rendered text always follows the hardcoded 
English-oriented
   structure `"<translated Select all> (<count>)"`; translators cannot change 
the position of
   the count, add language-specific glue words, or adapt parentheses because 
the count is
   concatenated outside `t(...)`, demonstrating a localization defect tied 
directly to the
   code at lines 522–523.
   ```
   </details>
   
   [Fix in 
Cursor](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=ac76556a642b4f9a89dcb11e593b9565&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 | [Fix in VSCode 
Claude](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=ac76556a642b4f9a89dcb11e593b9565&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/packages/superset-ui-core/src/components/Select/Select.tsx
   **Line:** 522:523
   **Comment:**
        *Code Quality: The selectable count is rendered outside the translation 
string, so translators cannot reorder or localize the full label (text + 
number) correctly for languages with different grammar. Put the count inside a 
single `t(...)` message with a placeholder so the whole phrase is translatable.
   
   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%2F40221&comment_hash=ee1fcddfcb11b86ac0770ef78f2e300519395106d4189b0749cda5b616022748&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40221&comment_hash=ee1fcddfcb11b86ac0770ef78f2e300519395106d4189b0749cda5b616022748&reaction=dislike'>👎</a>



##########
superset-frontend/packages/superset-ui-core/src/components/Select/Select.tsx:
##########
@@ -536,7 +537,8 @@ const Select = forwardRef(
               handleDeselectAll();
             }}
           >
-            {t('Clear')} {`(${formatNumber('SMART_NUMBER', 
bulkSelectCounts.deselectable)})`}
+            {t('Clear')}{' '}
+            {`(${formatNumber('SMART_NUMBER', 
bulkSelectCounts.deselectable)})`}

Review Comment:
   **Suggestion:** The clear-action count is concatenated outside the i18n 
message, which prevents proper localization of the complete phrase in 
non-English locales. Use one translated string with an interpolation 
placeholder for the formatted count. [code quality]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ⚠️ Bulk clear label not fully localizable in other languages.
   - ⚠️ Translators constrained by hardcoded text-count concatenation.
   ```
   </details>
   <details>
   <summary><b>Steps of Reproduction ✅ </b></summary>
   
   ```mdx
   1. In 
`superset-frontend/packages/superset-ui-core/src/components/Select/Select.tsx`,
   within the same `bulkSelectComponent` `useMemo` block used for bulk actions, 
locate the
   second button for the clear action; at diff lines 540–541 it renders 
`{t('Clear')}{' '}`
   on one line and `{`(${formatNumber('SMART_NUMBER', 
bulkSelectCounts.deselectable)})`}` on
   the next.
   
   2. As confirmed by BulkRead, `popupRender` (diff lines 552–565) passes 
`selectAllEnabled ?
   bulkSelectComponent : undefined` into `dropDownRenderHelper`, so whenever 
the bulk actions
   footer is shown, this clear button (with its split label) is rendered in the 
dropdown UI.
   
   3. Enable a non-English locale so that `t('Clear')` resolves via the i18n 
catalogs; note
   that the translation system only sees `"Clear"` as the message key, while 
the deselectable
   count and parentheses are added separately via `formatNumber('SMART_NUMBER',
   bulkSelectCounts.deselectable)`.
   
   4. Observe in the rendered UI that the clear action label always appears as 
`"<translated
   Clear> (<count>)"`, and translators cannot move the count before the word, 
change the
   punctuation, or integrate the number into the localized phrase because the 
count is not
   part of the `t(...)` message, demonstrating the same localization limitation 
at lines
   540–541.
   ```
   </details>
   
   [Fix in 
Cursor](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=033b73dc4d0a4be58bb9c0da17015f73&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 | [Fix in VSCode 
Claude](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=033b73dc4d0a4be58bb9c0da17015f73&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/packages/superset-ui-core/src/components/Select/Select.tsx
   **Line:** 540:541
   **Comment:**
        *Code Quality: The clear-action count is concatenated outside the i18n 
message, which prevents proper localization of the complete phrase in 
non-English locales. Use one translated string with an interpolation 
placeholder for the formatted count.
   
   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%2F40221&comment_hash=e1d03b6af038639fd073187421654d568a449f161f2f50759e63d8156861f118&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40221&comment_hash=e1d03b6af038639fd073187421654d568a449f161f2f50759e63d8156861f118&reaction=dislike'>👎</a>



##########
superset/common/query_object.py:
##########
@@ -128,6 +129,7 @@ def __init__(  # pylint: disable=too-many-locals, 
too-many-arguments
         post_processing: list[dict[str, Any] | None] | None = None,
         row_limit: int | None = None,
         row_offset: int | None = None,
+        force_query: bool = False,
         series_columns: list[Column] | None = None,

Review Comment:
   **🟠 Architect Review — HIGH**
   
   QueryObject.to_dict() now includes the execution-control flag force_query, 
and cache_key() hashes that dict directly; this makes forced-refresh requests 
use a different cache key than identical non-forced requests, so a 
user-triggered refresh populates a separate cache entry while normal follow-up 
requests continue serving stale cached data under the old key.
   
   **Suggestion:** Keep force_query as an execution-control flag but exclude it 
from cache key materialization (e.g., remove it from the dict inside 
cache_key() before hashing, or build the cache dict without it) so forced 
refreshes update the canonical cache entry shared with normal requests.
   
   
   [Fix in 
Cursor](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=5f8546beb26f4b6a827a8f269dfd5a41&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 | [Fix in VSCode 
Claude](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=5f8546beb26f4b6a827a8f269dfd5a41&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 an **Architect / Logical Review** comment left during a code review. 
These reviews are first-class, important findings — not optional suggestions. 
Do NOT dismiss this as a 'big architectural change' just because the title says 
architect review; most of these can be resolved with a small, localized fix 
once the intent is understood.
   
   **Path:** superset/common/query_object.py
   **Line:** 133:179
   **Comment:**
        *HIGH: QueryObject.to_dict() now includes the execution-control flag 
force_query, and cache_key() hashes that dict directly; this makes 
forced-refresh requests use a different cache key than identical non-forced 
requests, so a user-triggered refresh populates a separate cache entry while 
normal follow-up requests continue serving stale cached data under the old key.
   
   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.
   If a suggested approach is provided above, use it as the authoritative 
instruction. If no explicit code suggestion is given, you MUST still draft and 
apply your own minimal, localized fix — do not punt back with 'no suggestion 
provided, review manually'. Keep the change as small as possible: add a guard 
clause, gate on a loading state, reorder an await, wrap in a conditional, etc. 
Do not refactor surrounding code or expand scope beyond the finding.
   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>



-- 
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]

Reply via email to