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


##########
superset/translations/ru/LC_MESSAGES/messages.po:
##########
@@ -4586,6 +4586,9 @@ msgstr "Не удалось создать датасет"
 msgid "Dataset could not be duplicated."
 msgstr "Датасет не может быть дублирован"
 
+msgid "Dataset could not be restored."
+msgstr ""

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Missing Russian translation</b></div>
   <div id="fix">
   
   The new message `Dataset could not be restored.` has an empty `msgstr`. 
Compare with similar error messages in this file: `Dataset could not be 
created.` → `msgstr "Не удалось создать датасет"` and `Dataset could not be 
updated.` → `msgstr "Не удалось обновить датасет"`. Apply the same pattern to 
produce `msgstr "Не удалось восстановить датасет"`.
   </div>
   
   
   <details>
   <summary>
   <b>Code suggestion</b>
   </summary>
   <blockquote>Check the AI-generated fix before applying</blockquote>
   <div id="code">
   
   
   ```
    --- superset/translations/ru/LC_MESSAGES/messages.po (lines 4589-4590) ---
    4589: msgid "Dataset could not be restored."
    4590:-msgstr ""
    4590:+msgstr "Не удалось восстановить датасет"
    4591: 
    4592:  msgid "Dataset could not be updated."
   ```
   
   </div>
   </details>
   
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #a2a80b</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/translations/sk/LC_MESSAGES/messages.po:
##########
@@ -4664,6 +4664,9 @@ msgstr "Sadu dat sa nepodarilo vytvoriť."
 msgid "Dataset could not be duplicated."
 msgstr "Sadu dat sa nepodarilo duplikovať."
 
+msgid "Dataset could not be restored."
+msgstr ""

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Missing translation string</b></div>
   <div id="fix">
   
   The `msgstr` field is empty, causing Slovak users to see untranslated 
English text "Dataset could not be restored." instead of a proper Slovak 
translation. Apply the established translation pattern: "Sadu dat sa nepodarilo 
obnoviť."
   </div>
   
   
   <details>
   <summary>
   <b>Code suggestion</b>
   </summary>
   <blockquote>Check the AI-generated fix before applying</blockquote>
   <div id="code">
   
   
   ```
    --- superset/translations/sk/LC_MESSAGES/messages.po (lines 4667-4668)---
    4667:  msgid "Dataset could not be restored."
    4668: -msgstr ""
    4668: +msgstr "Sadu dat sa nepodarilo obnoviť."
    4669: +
   ```
   
   </div>
   </details>
   
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #a2a80b</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



##########
tests/unit_tests/databases/commands/delete_test.py:
##########
@@ -0,0 +1,90 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from datetime import datetime
+
+import pytest
+from pytest_mock import MockerFixture
+from sqlalchemy.orm.session import Session
+
+
+def test_delete_database_blocked_by_soft_deleted_dataset(
+    mocker: MockerFixture,
+    session: Session,
+) -> None:

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Missing Flask app context fixture</b></div>
   <div id="fix">
   
   Tests call `DeleteDatabaseCommand.validate()` which imports `db` from 
`superset.extensions` and performs database operations requiring a Flask app 
context. Add `app_context: None` fixture parameter alongside `session: Session` 
to match the established pattern in similar tests (e.g., 
`test_soft_delete_mixin.py:94`).
   </div>
   
   
   <details>
   <summary>
   <b>Code suggestion</b>
   </summary>
   <blockquote>Check the AI-generated fix before applying</blockquote>
   <div id="code">
   
   
   ```
    --- a/tests/unit_tests/databases/commands/delete_test.py
    +++ b/tests/unit_tests/databases/commands/delete_test.py
    @@ -22,7 +22,7 @@ from sqlalchemy.orm.session import Session
    
    
     def test_delete_database_blocked_by_soft_deleted_dataset(
    -    mocker: MockerFixture,
    +    app_context: None,
    +    mocker: MockerFixture,
         session: Session,
     ) -> None:
         """A database whose only datasets are soft-deleted must NOT be 
deletable.
    @@ -64,7 +64,8 @@ def test_delete_database_blocked_by_soft_deleted_dataset(
    
    
     def test_delete_database_allowed_when_no_datasets(
    -    mocker: MockerFixture,
    +    app_context: None,
    +    mocker: MockerFixture,
         session: Session,
     ) -> None:
         """With no datasets at all (soft-deleted or active), validation 
passes."""
   ```
   
   </div>
   </details>
   
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #a2a80b</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/translations/ca/LC_MESSAGES/messages.po:
##########
@@ -4688,6 +4688,9 @@ msgstr "El conjunt de dades no s'ha pogut crear."
 msgid "Dataset could not be duplicated."
 msgstr "El conjunt de dades no s'ha pogut duplicar."
 
+msgid "Dataset could not be restored."
+msgstr ""
+
 msgid "Dataset could not be updated."

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Missing Catalan translation</b></div>
   <div id="fix">
   
   Empty translation string for user-facing error "Dataset could not be 
restored." will display untranslated English text to Catalan users. The error 
originates from `_("Dataset could not be restored.")` in `exceptions.py`. Fill 
in the Catalan translation following the established pattern (e.g., "El conjunt 
de dades no s'ha pogut [verb].").
   </div>
   
   
   <details>
   <summary>
   <b>Code suggestion</b>
   </summary>
   <blockquote>Check the AI-generated fix before applying</blockquote>
   <div id="code">
   
   
   ````suggestion
   msgstr "El conjunt de dades no s'ha pogut restaurar."
    
   msgid "Dataset could not be updated."
   ````
   
   </div>
   </details>
   
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #a2a80b</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/translations/uk/LC_MESSAGES/messages.po:
##########
@@ -4574,6 +4574,9 @@ msgstr "Не вдалося створити набір даних."
 msgid "Dataset could not be duplicated."
 msgstr "Не вдалося дублювати набір даних."
 
+msgid "Dataset could not be restored."
+msgstr ""

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Missing Ukrainian translation</b></div>
   <div id="fix">
   
   The `msgstr` for "Dataset could not be restored." is empty (`msgstr ""`). 
Ukrainian users will see the untranslated English error message when dataset 
restore operations fail. Add the Ukrainian translation to match the pattern of 
other dataset error messages in this file (e.g., "Не вдалося оновити набір 
даних." on line 4581).
   </div>
   
   
   <details>
   <summary>
   <b>Code suggestion</b>
   </summary>
   <blockquote>Check the AI-generated fix before applying</blockquote>
   <div id="code">
   
   
   ```
    --- superset/translations/uk/LC_MESSAGES/messages.po (lines 4577-4578) ---
    4577: msgid "Dataset could not be restored."
    4578:-msgstr ""
    4578:+msgstr "Не вдалося відновити набір даних."
    4579:
   ```
   
   </div>
   </details>
   
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #a2a80b</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/translations/pt_BR/LC_MESSAGES/messages.po:
##########
@@ -4822,6 +4822,9 @@ msgstr "Não foi possível criar o conjunto de dados."
 msgid "Dataset could not be duplicated."
 msgstr "Não foi possível duplicar o conjunto de dados."
 
+msgid "Dataset could not be restored."
+msgstr ""

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Missing translation string</b></div>
   <div id="fix">
   
   The `msgstr` is empty for the new translation entry "Dataset could not be 
restored.". Portuguese (Brazilian) users will see untranslated English text 
when this error is displayed. Following the established pattern in this file 
(e.g., "Dataset could not be duplicated." → "Não foi possível duplicar o 
conjunto de dados."), the translation should be "Não foi possível restaurar o 
conjunto de dados.".
   </div>
   
   
   <details>
   <summary>
   <b>Code suggestion</b>
   </summary>
   <blockquote>Check the AI-generated fix before applying</blockquote>
   <div id="code">
   
   
   ```
    --- superset/translations/pt_BR/LC_MESSAGES/messages.po
    +++ superset/translations/pt_BR/LC_MESSAGES/messages.po
    @@ -4823,7 +4823,7 @@ msgstr "Não foi possível duplicar o conjunto de 
dados."
    
     msgid "Dataset could not be restored."
    -msgstr ""
    +msgstr "Não foi possível restaurar o conjunto de dados."
    
     msgid "Dataset could not be updated."
     msgstr "Não foi possível atualizar o conjunto de dados."
   ```
   
   </div>
   </details>
   
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #a2a80b</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



##########
tests/integration_tests/dashboard_utils.py:
##########
@@ -35,10 +37,29 @@ def get_table(
     schema: Optional[str] = None,
 ):
     schema = schema or get_example_default_schema()
+    # Bypass the soft-delete listener so the helper finds rows previously
+    # soft-deleted by other tests in the same session. Without the
+    # bypass, the listener hides them and a subsequent INSERT collides
+    # with the underlying ``(database_id, catalog, schema, table_name)``
+    # unique constraint that survives soft-delete.
+    #
+    # Match rows whose catalog is either unset (NULL) or the database
+    # default — these are "the same physical table" the way
+    # ``DatasetDAO.validate_uniqueness`` treats them (``table.catalog or
+    # default``). Example rows are seeded with ``catalog = NULL`` while a
+    # connection that reports a default catalog (e.g. Postgres) would
+    # normalize to that default, so both must qualify. This still excludes
+    # an unrelated third catalog variant of the same table_name. Within the
+    # matched set, prefer live rows over soft-deleted ones via
+    # ``ORDER BY deleted_at IS NULL DESC``.
+    catalog = database.get_default_catalog()
     return (
         db.session.query(SqlaTable)
+        .execution_options(**{SKIP_VISIBILITY_FILTER_CLASSES: {SqlaTable}})
         .filter_by(database_id=database.id, schema=schema, 
table_name=table_name)
-        .one_or_none()
+        .filter(or_(SqlaTable.catalog.is_(None), SqlaTable.catalog == catalog))

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Duplicate catalog matching logic</b></div>
   <div id="fix">
   
   The inline `or_(SqlaTable.catalog.is_(None), SqlaTable.catalog == catalog)` 
logic duplicates `DatasetDAO._catalog_identity_filter` (lines 159-182 in 
`superset/daos/dataset.py`). The duplicate creates divergence risk if one copy 
is updated without the other — they must stay in sync to correctly treat NULL 
and default-catalog tables as the same physical table.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #a2a80b</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/translations/lv/LC_MESSAGES/messages.po:
##########
@@ -4603,6 +4603,9 @@ msgstr "Datu kopu nevarēja izveidot."
 msgid "Dataset could not be duplicated."
 msgstr "Datu kopu nevarēja dublēt."
 
+msgid "Dataset could not be restored."
+msgstr ""

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Missing translation for new msgid</b></div>
   <div id="fix">
   
   The new message `msgid "Dataset could not be restored."` has an empty 
`msgstr` on line 4607. Users whose locale is set to Latvian will see the 
untranslated English text. Compare with adjacent messages: line 4604 uses "Datu 
kopu nevarēja dublēt" and line 4610 uses "Datu kopu nevarēja atjaunināt" — the 
infinitive form "atjaunot" (from existing translation at line 10797: "Atjaunot 
filtru") is the correct verb for "restore".
   </div>
   
   
   <details>
   <summary>
   <b>Code suggestion</b>
   </summary>
   <blockquote>Check the AI-generated fix before applying</blockquote>
   <div id="code">
   
   
   ```
    --- superset/translations/lv/LC_MESSAGES/messages.po (lines 4606-4608) ---
    4606: msgid "Dataset could not be restored."
    4607:-msgstr ""
    4607:+msgstr "Datu kopu nevarēja atjaunot."
    4608: 
    4609: msgid "Dataset could not be updated."
   ```
   
   </div>
   </details>
   
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #a2a80b</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/translations/pl/LC_MESSAGES/messages.po:
##########
@@ -4833,6 +4833,9 @@ msgstr "Nie udało się utworzyć zestawu danych."
 msgid "Dataset could not be duplicated."
 msgstr "Nie udało się zduplikować zestawu danych."
 
+msgid "Dataset could not be restored."
+msgstr ""

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Missing Polish translation</b></div>
   <div id="fix">
   
   Empty `msgstr` leaves Polish users with untranslated error message. Use the 
consistent pattern from neighboring entries: "Nie udało się [verb] zestawu 
danych."
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #a2a80b</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/translations/cs/LC_MESSAGES/messages.po:
##########
@@ -4664,6 +4664,9 @@ msgstr "Sadu dat se nepodařilo vytvořit."
 msgid "Dataset could not be duplicated."
 msgstr "Sadu dat se nepodařilo duplikovat."
 
+msgid "Dataset could not be restored."
+msgstr ""

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Missing Czech translation</b></div>
   <div id="fix">
   
   The `msgstr` is empty for the new translation entry. Czech users will see 
the untranslated English message "Dataset could not be restored." instead of a 
proper translation. Provide the Czech equivalent following the established 
pattern in this file.
   </div>
   
   
   <details>
   <summary>
   <b>Code suggestion</b>
   </summary>
   <blockquote>Check the AI-generated fix before applying</blockquote>
   <div id="code">
   
   
   ```
    --- a/superset/translations/cs/LC_MESSAGES/messages.po
    +++ b/superset/translations/cs/LC_MESSAGES/messages.po
    @@ -4665,7 +4665,7 @@ msgstr "Sadu dat se nepodařilo duplikovat."
    
     msgid "Dataset could not be restored."
    -msgstr ""
    +msgstr "Sadu dat se nepodařilo obnovit."
    
     msgid "Dataset could not be updated."
     msgstr "Sadu dat se nepodařilo aktualizovat."
   ```
   
   </div>
   </details>
   
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #a2a80b</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