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


##########
superset/dashboards/schemas.py:
##########
@@ -395,6 +397,11 @@ class DashboardPutSchema(BaseDashboardSchema):
         allow_none=True,
         validate=Length(0, 500),
     )
+    description = fields.String(
+        metadata={"description": description_description},
+        allow_none=True,
+        validate=Length(0, 255),
+    )

Review Comment:
   
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Inconsistent description length validation</b></div>
   <div id="fix">
   
   The description field in DashboardPutSchema includes a Length(0, 255) 
validation that unnecessarily limits description length to 255 characters. 
Since the database model uses Text (unlimited) and other schemas like 
DashboardGetResponseSchema and ImportV1DashboardSchema don't impose this limit, 
this validation should be removed for consistency. This prevents users from 
updating dashboards with descriptions longer than 255 characters, impacting 
functionality in production environments where longer descriptions might be 
needed.
   </div>
   
   <details>
   <summary>
   <b>Code suggestion</b>
   </summary>
   <blockquote>Check the AI-generated fix before applying</blockquote>
   <div id="code">
   
   
   ````suggestion
       description = fields.String(
           metadata={"description": description_description},
           allow_none=True,
       )
   ````
   
   </div>
   </details>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run <a 
href=https://github.com/apache/superset/pull/36071#issuecomment-3515979798>#728dbc</a></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-frontend/src/dashboard/components/Header/index.jsx:
##########
@@ -422,6 +422,7 @@ const Header = () => {
       owners: dashboardInfo.owners,
       roles: dashboardInfo.roles,
       slug,
+      description: dashboardInfo.description,

Review Comment:
   
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Missing useCallback dependency for dashboard 
description</b></div>
   <div id="fix">
   
   The overwriteDashboard function now includes description in the save data, 
but the useCallback dependencies are missing dashboardInfo.description. This 
can cause a stale closure, where saving after changing the description might 
persist the old value instead of the updated one, leading to data inconsistency 
in production.
   </div>
   
   <details>
   <summary>
   <b>Code suggestion</b>
   </summary>
   <blockquote>Check the AI-generated fix before applying</blockquote>
   <div id="code">
   
   
   ```
    -    boundActionCreators.onSave(data, dashboardInfo.id, 
SAVE_TYPE_OVERWRITE);
    -  }, [
    -    actualLastModifiedTime,
    -    boundActionCreators,
    -    colorNamespace,
    -    colorScheme,
    -    customCss,
    -    dashboardInfo.certification_details,
    -    dashboardInfo.certified_by,
    -    dashboardInfo.common?.conf?.SUPERSET_DASHBOARD_POSITION_DATA_LIMIT,
    -    dashboardInfo.id,
    -    dashboardInfo.metadata,
    -    dashboardInfo.owners,
    -    dashboardInfo.roles,
    -    dashboardInfo.tags,
    -    dashboardTitle,
    -    layout,
    -    refreshFrequency,
    -    shouldPersistRefreshFrequency,
    -    slug,
    -  ]);
    +    boundActionCreators.onSave(data, dashboardInfo.id, 
SAVE_TYPE_OVERWRITE);
    +  }, [
    +    actualLastModifiedTime,
    +    boundActionCreators,
    +    colorNamespace,
    +    colorScheme,
    +    customCss,
    +    dashboardInfo.certification_details,
    +    dashboardInfo.certified_by,
    +    dashboardInfo.common?.conf?.SUPERSET_DASHBOARD_POSITION_DATA_LIMIT,
    +    dashboardInfo.description,
    +    dashboardInfo.id,
    +    dashboardInfo.metadata,
    +    dashboardInfo.owners,
    +    dashboardInfo.roles,
    +    dashboardInfo.tags,
    +    dashboardTitle,
    -    layout,
    -    refreshFrequency,
    -    shouldPersistRefreshFrequency,
    -    slug,
    -  ]);
    +    layout,
    +    refreshFrequency,
    +    shouldPersistRefreshFrequency,
    +    slug,
    +  ]);
   ```
   
   </div>
   </details>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run <a 
href=https://github.com/apache/superset/pull/36071#issuecomment-3515979798>#728dbc</a></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