aminghadersohi commented on code in PR #38409:
URL: https://github.com/apache/superset/pull/38409#discussion_r2895039118
##########
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:
Thanks for confirming the fix.
##########
superset/mcp_service/dashboard/tool/add_chart_to_existing_dashboard.py:
##########
@@ -63,35 +63,107 @@ 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)
Review Comment:
Good catch — if a tab's meta.text is null in the stored JSON, we'd pass None
into _normalize_tab_text and re.sub would crash. I'll add a guard to handle
None text values before passing to the regex. Thanks.
##########
superset/mcp_service/dashboard/tool/add_chart_to_existing_dashboard.py:
##########
@@ -63,35 +63,107 @@
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)
+ # Note: using regular strings (not raw) so Python processes \U escapes
+ cleaned = re.sub(
+ "[\U0001f300-\U0001f9ff\U00002600-\U000027bf\U0000fe00-\U0000fe0f"
Review Comment:
Thanks for the regex analysis. The character ranges are intentional — they
target specific Unicode emoji blocks. I'll review the overlapping ranges and
clean them up to be more precise.
##########
superset/mcp_service/dashboard/tool/add_chart_to_existing_dashboard.py:
##########
@@ -63,35 +63,107 @@
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)
+ # Note: using regular strings (not raw) so Python processes \U escapes
+ cleaned = re.sub(
+ "[\U0001f300-\U0001f9ff\U00002600-\U000027bf\U0000fe00-\U0000fe0f"
Review Comment:
Acknowledged — will clean up the overlapping range. Thanks.
##########
superset/mcp_service/dashboard/tool/add_chart_to_existing_dashboard.py:
##########
@@ -63,35 +63,107 @@
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)
+ # Note: using regular strings (not raw) so Python processes \U escapes
+ cleaned = re.sub(
+ "[\U0001f300-\U0001f9ff\U00002600-\U000027bf\U0000fe00-\U0000fe0f"
Review Comment:
Same as above — will address the overlapping ranges in the regex. Thanks for
the thorough analysis.
--
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]