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


##########
superset/models/helpers.py:
##########
@@ -916,7 +917,10 @@ def get_query_str_extended(
         sql = self._apply_cte(sql, sqlaq.cte)
 
         if mutate:
-            sql = self.database.mutate_sql_based_on_config(sql)
+            sql = self.database.mutate_sql_based_on_config(
+                sql,
+                **(mutation_context or {}),
+            )

Review Comment:
   **🟠 Architect Review — HIGH**
   
   When app.config["MUTATE_AFTER_SPLIT"] is True, SQL_QUERY_MUTATOR is only 
invoked from the split-path (Database._execute_sql_with_mutation_and_logging / 
db_engine_specs.BaseEngineSpec.estimate_query_cost) where 
mutate_sql_based_on_config is called with is_split=True and no 
mutation_context, while the pre-split call in get_query_str_extended (which is 
now the only place that receives dashboard_id/slice_id) is skipped by the 
MUTATE_AFTER_SPLIT gate, so chart queries executed in this valid configuration 
never pass dashboard/slice context to the mutator.
   
   **Suggestion:** Thread the same mutation_context through to the 
is_split=True calls to Database.mutate_sql_based_on_config (e.g. via 
get_df/_execute_sql_with_mutation_and_logging), so SQL_QUERY_MUTATOR receives 
identical chart metadata regardless of the MUTATE_AFTER_SPLIT setting.
   
   
   [Fix in 
Cursor](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=906afd9c62884fa3874257ccc69d670b&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=906afd9c62884fa3874257ccc69d670b&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/models/helpers.py
   **Line:** 920:923
   **Comment:**
        *HIGH: When app.config["MUTATE_AFTER_SPLIT"] is True, SQL_QUERY_MUTATOR 
is only invoked from the split-path 
(Database._execute_sql_with_mutation_and_logging / 
db_engine_specs.BaseEngineSpec.estimate_query_cost) where 
mutate_sql_based_on_config is called with is_split=True and no 
mutation_context, while the pre-split call in get_query_str_extended (which is 
now the only place that receives dashboard_id/slice_id) is skipped by the 
MUTATE_AFTER_SPLIT gate, so chart queries executed in this valid configuration 
never pass dashboard/slice context to the mutator.
   
   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