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


##########
superset/commands/tag/export.py:
##########
@@ -23,33 +23,56 @@
 import yaml
 from superset.daos.chart import ChartDAO
 from superset.daos.dashboard import DashboardDAO
+from superset.daos.tag import TagDAO
 from superset.extensions import feature_flag_manager
 from superset.tags.models import TagType
+from superset.commands.export.models import ExportModelsCommand
 from superset.commands.tag.exceptions import TagNotFoundError
 
 
-# pylint: disable=too-few-public-methods
-class ExportTagsCommand:
+class ExportTagsCommand(ExportModelsCommand):
+    dao = TagDAO
     not_found = TagNotFoundError
 
+    def __init__(
+        self,
+        model_ids: Optional[list[int]] = None,
+        export_related: bool = True,
+        *,
+        dashboard_ids: Optional[Union[int, List[Union[int, str]]]] = None,
+        chart_ids: Optional[Union[int, List[Union[int, str]]]] = None,
+    ):
+        self.model_ids = model_ids or []
+        self.export_related = export_related
+        self.dashboard_ids = dashboard_ids
+        self.chart_ids = chart_ids

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>CWE-1104: Parent Contract Violated</b></div>
   <div id="fix">
   
   `ExportTagsCommand.__init__` accepts `model_ids: Optional[list[int]] = None` 
but its parent `ExportModelsCommand` requires `model_ids: list[int]`. All 12+ 
other subclasses follow the required `list[int]` pattern. Additionally, the 
refactored `run()` never calls `self.dao.find_by_ids(self.model_ids)`, so 
`TagNotFoundError` is never raised — the override defeats the parent contract 
entirely. (See also: 
[CWE-1104](https://cwe.mitre.org/data/definitions/1104.html))
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #8da84c</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