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


##########
superset/mcp_service/chart/tool/get_chart_data.py:
##########
@@ -369,6 +369,38 @@ async def get_chart_data(  # noqa: C901
                 # Bubble charts use x/y/size as separate metric fields.
                 viz_type = chart.viz_type or ""
 
+                # Deck.gl chart types store spatial data (lat/lon)
+                # rather than traditional metrics/groupby. They
+                # require a saved query_context to retrieve data.
+                deck_gl_types = (
+                    "deck_arc",
+                    "deck_geojson",
+                    "deck_grid",
+                    "deck_hex",
+                    "deck_multi",
+                    "deck_path",
+                    "deck_polygon",
+                    "deck_scatter",
+                    "deck_screengrid",
+                )

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Incomplete deck.gl types list</b></div>
   <div id="fix">
   
   The deck_gl_types tuple is missing "deck_heatmap" and "deck_contour", which 
are also deck.gl visualizations that require saved query_context for data 
retrieval. Without these, charts of those types might not be properly handled, 
potentially leading to incorrect behavior or unhandled errors.
   </div>
   
   
   <details>
   <summary>
   <b>Code suggestion</b>
   </summary>
   <blockquote>Check the AI-generated fix before applying</blockquote>
   <div id="code">
   
   
   ````suggestion
       "deck_screengrid",
       "deck_heatmap",
       "deck_contour",
   )
   ````
   
   </div>
   </details>
   
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #7eca2e</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



##########
superset/mcp_service/dataset/schemas.py:
##########
@@ -307,6 +308,13 @@ def _parse_json_field(obj: Any, field_name: str) -> 
Dict[str, Any] | None:
     return value
 
 
+def _humanize_timestamp(dt: datetime | None) -> str | None:
+    """Convert a datetime to a humanized string like '2 hours ago'."""
+    if dt is None:
+        return None
+    return humanize.naturaltime(datetime.now() - dt)

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>datetime.now() called without timezone 
information</b></div>
   <div id="fix">
   
   Add timezone information to `datetime.now()` call. Use 
`datetime.now(timezone.utc)` or `datetime.now(tz=timezone.utc)` to ensure 
timezone-aware datetime objects.
   </div>
   
   
   <details>
   <summary>
   <b>Code suggestion</b>
   </summary>
   <blockquote>Check the AI-generated fix before applying</blockquote>
   <div id="code">
   
   
   ```
    -from datetime import datetime
    +from datetime import datetime, timezone
    @@ -315,1 +315,1 @@
    -    return humanize.naturaltime(datetime.now() - dt)
    +    return humanize.naturaltime(datetime.now(timezone.utc) - dt)
   ```
   
   </div>
   </details>
   
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #7eca2e</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



##########
superset/mcp_service/chart/schemas.py:
##########
@@ -271,6 +272,13 @@ def validate_identifier_or_form_data_key(self) -> 
"GetChartInfoRequest":
         return self
 
 
+def _humanize_timestamp(dt: datetime | None) -> str | None:
+    """Convert a datetime to a humanized string like '2 hours ago'."""
+    if dt is None:
+        return None
+    return humanize.naturaltime(datetime.now() - dt)

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>datetime.now() called without timezone argument</b></div>
   <div id="fix">
   
   Add timezone argument to `datetime.now()` call. Use 
`datetime.now(timezone.utc)` to ensure timezone-aware datetime objects.
   </div>
   
   
   <details>
   <summary>
   <b>Code suggestion</b>
   </summary>
   <blockquote>Check the AI-generated fix before applying</blockquote>
   <div id="code">
   
   
   ````suggestion
       return humanize.naturaltime(datetime.now(timezone.utc) - dt)
   ````
   
   </div>
   </details>
   
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #7eca2e</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