mikebridge commented on PR #40130:
URL: https://github.com/apache/superset/pull/40130#issuecomment-4606702015

   Thanks @richardfogaca (and the PR review agent) — all three of your 
functional concerns are addressed:
   
   **`superset/datasets/api.py:963` — restore can produce two live datasets at 
one physical table** (the headline concern): fixed in `0591115434` with 
two-layer defense:
   
   1. `RestoreDatasetCommand.validate()` overrides the base with an 
`_has_active_logical_duplicate(model)` check that raises a new 
`DatasetLogicalDuplicateError` (HTTP 422) when another active dataset 
references the same `(database_id, catalog, schema, table_name)`.
   2. `DatasetDAO.validate_uniqueness` and `validate_update_uniqueness` now run 
with `execution_options(**{SKIP_VISIBILITY_FILTER_CLASSES: {SqlaTable}})`, so a 
soft-deleted row also blocks new creates at the same logical identity. Closes 
the gap from the create side.
   
   Mirrors the slug-conflict pattern on dashboards. Integration tests at 
`tests/integration_tests/datasets/soft_delete_tests.py:200-289` cover both the 
restore-blocked and create-blocked flows.
   
   **`superset/commands/dataset/importers/v1/utils.py:228` — restore-via-import 
path**: same commit adds the duplicate check before `existing.deleted_at = 
None`, raising `ImportFailedError` with a descriptive message if a live 
duplicate exists. Aligns the importer behaviour with the explicit restore 
endpoint.
   
   **`superset/daos/datasource.py:101` — Core-select bypass in 
`build_dataset_query`**: same commit adds an explicit `ds_q = 
ds_q.where(ds_table.c.deleted_at.is_(None))` predicate. Soft-deleted datasets 
no longer count toward `GET /api/v1/datasource/` totals or pagination slots.
   
   Test coverage at integration level + unit level for the restore-side guard. 
Thanks for the precise, mechanism-naming write-up — the "logical-vs-physical 
uniqueness" framing was exactly what made the three concerns hang together.


-- 
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