bito-code-review[bot] commented on code in PR #38409:
URL: https://github.com/apache/superset/pull/38409#discussion_r2892376676


##########
superset/mcp_service/dashboard/tool/add_chart_to_existing_dashboard.py:
##########
@@ -63,35 +63,106 @@ def _find_next_row_position(layout: Dict[str, Any]) -> str:
     return row_key
 
 
-def _find_tab_insert_target(layout: Dict[str, Any]) -> str | None:
+def _normalize_tab_text(text: str) -> str:
+    """Strip emoji and extra whitespace from tab text for flexible matching."""
+    import re
+
+    # Remove emoji characters (Unicode emoji ranges)
+    cleaned = re.sub(
+        r"[\U0001F300-\U0001F9FF\U00002600-\U000027BF\U0000FE00-\U0000FE0F"
+        r"\U0001FA00-\U0001FA6F\U0001FA70-\U0001FAFF\U00002702-\U000027B0"
+        r"\U0000200D\U0000FE0F]+",

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Incorrect emoji regex pattern</b></div>
   <div id="fix">
   
   The regex in `_normalize_tab_text` uses incorrect Unicode escape syntax with 
double backslashes (`\\U`), which matches literal strings like '\U0001F300' 
instead of actual emoji characters. This prevents proper emoji stripping for 
flexible tab matching. The pattern should use single backslashes in a regular 
string to enable Unicode character matching.
   </div>
   
   
   <details>
   <summary>
   <b>Code suggestion</b>
   </summary>
   <blockquote>Check the AI-generated fix before applying</blockquote>
   <div id="code">
   
   
   ```
    -    
r"[\\U0001F300-\\U0001F9FF\\U00002600-\\U000027BF\\U0000FE00-\\U0000FE0F"
    -        
r"\\U0001FA00-\\U0001FA6F\\U0001FA70-\\U0001FAFF\\U00002702-\\U000027B0"
    -        r"\\U0000200D\\U0000FE0F]+",
    +    "[\U0001F300-\U0001F9FF\U00002600-\U000027BF\U0000FE00-\U0000FE0F"
    +        "\U0001FA00-\U0001FA6F\U0001FA70-\U0001FAFF\U00002702-\U000027B0"
    +        "\U0000200D\U0000FE0F]+",
   ```
   
   </div>
   </details>
   
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #141bf2</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



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