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


##########
superset/models/core.py:
##########
@@ -1343,6 +1379,30 @@ def execute_async(
 sqla.event.listen(Database, "after_delete", 
security_manager.database_after_delete)
 
 
+def _evict_engine_cache(
+    mapper: Any,  # noqa: ANN401
+    connection: Any,  # noqa: ANN401

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Weak type hints on event handler</b></div>
   <div id="fix">
   
   The `_evict_engine_cache` function uses `Any` types with `# noqa: ANN401` 
suppression, violating project type-hints standards (AGENTS.md: "Type hints 
required for all new Python code"). Compare with `database_after_update` and 
`database_after_delete` in `security/manager.py` (lines 1822-1835) which use 
proper `Mapper` and `Connection` types from SQLAlchemy. Both types are 
available: `Connection` is already imported at line 54, and `Mapper` only 
requires adding it to line 59's `sqlalchemy.orm` import.
   </div>
   
   
   <details>
   <summary>
   <b>Code suggestion</b>
   </summary>
   <blockquote>Check the AI-generated fix before applying</blockquote>
   <div id="code">
   
   
   ```
    --- a/superset/models/core.py
    +++ b/superset/models/core.py
    @@ -1382,8 +1382,8 @@ def _evict_engine_cache(
    
     def _evict_engine_cache(
    -    mapper: Any,  # noqa: ANN401
    -    connection: Any,  # noqa: ANN401
    +    mapper: Mapper,
    +    connection: Connection,
         target: "Database",
     ) -> None:
         """Evict all cached engines for a database when it is updated or 
deleted."
   ```
   
   </div>
   </details>
   
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #6b5287</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