bito-code-review[bot] commented on code in PR #44169:
URL: https://github.com/apache/superset/pull/44169#discussion_r4038121734
##########
tests/unit_tests/models/dashboard_test.py:
##########
@@ -698,3 +699,40 @@ def
test_tabs_places_a_node_the_layout_reaches_twice_only_once(
assert "skipping layout node TAB-1, the layout reaches it more than once"
in (
caplog.text
)
+
+
+def test_datasets_trimmed_for_slices_keeps_colliding_ids_separate() -> None:
+ """Keys slices by (datasource_type, datasource_id) to avoid id collisions.
+
+ SqlaTable and SemanticView use independent auto-increment id spaces, so a
+ table chart and a semantic-view chart can carry the same datasource_id.
+ Grouping by the bare id would merge the table chart into the semantic-view
+ group (whose non-table datasource is dropped), losing the table chart's
+ metadata from the dashboard payload.
+ """
+ table_datasource = Mock(spec=BaseDatasource)
+ table_datasource.table_name = "orders"
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Test AttributeError on spec mock</b></div>
<div id="fix">
`Mock(spec=BaseDatasource)` only permits attributes defined on
`BaseDatasource`, but `table_name` lives on `SqlaTable`
(connectors/sqla/models.py:1566), not the base class. Setting it raises
`AttributeError`, so this new test fails at line 714. The attribute is never
read afterward — drop the line or use `Mock(spec=SqlaTable)`.
</div>
<details>
<summary>
<b>Code suggestion</b>
</summary>
<blockquote>Check the AI-generated fix before applying</blockquote>
<div id="code">
````suggestion
````
</div>
</details>
</div>
<small><i>Code Review Run #3980ed</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]