Repository navigation
fix(dataset): return an actionable error when an archived dataset holds the name #46376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -226,15 +226,23 @@ class DatasetRestoreFailedError(UpdateFailedError): | |||||||||||||||
| class DatasetSoftDeletedTwinExistsError(CommandException): | ||||||||||||||||
| """A soft-deleted dataset holds the physical table the caller targets. | ||||||||||||||||
|
|
||||||||||||||||
| Single source of the blocked-by-hidden-twin message: the create command, | ||||||||||||||||
| ``get_or_create_dataset``, and any future caller raise this so the | ||||||||||||||||
| wording (restore pointer, executable recoveries only) cannot drift | ||||||||||||||||
| between surfaces. | ||||||||||||||||
| Creation callers supply the dataset name for user-facing recovery guidance. | ||||||||||||||||
| Callers without a name retain the UUID and restore endpoint. | ||||||||||||||||
| """ | ||||||||||||||||
|
|
||||||||||||||||
| status = 422 | ||||||||||||||||
|
|
||||||||||||||||
| def __init__(self, dataset_uuid: str) -> None: | ||||||||||||||||
| def __init__(self, dataset_uuid: str, dataset_name: str | None = None) -> None: | ||||||||||||||||
| if dataset_name is not None: | ||||||||||||||||
| super().__init__( | ||||||||||||||||
| _( | ||||||||||||||||
| 'Dataset "%(name)s" already exists in Recently Archived. ' | ||||||||||||||||
| "Restore it to use the existing dataset, or delete it permanently " | ||||||||||||||||
| "before creating a new dataset with the same name.", | ||||||||||||||||
|
Comment on lines
+239
to
+241
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The previous message ended "…or use a different table name", and that option is gone. Restore and Delete permanently are limited to the dataset's editors and admins, so a user who can create datasets on this database but never owned the archived one gets no action they can take. Suggest restoring the alternative and adding an ask-an-owner-or-admin path:
Suggested change
The docs paragraph in |
||||||||||||||||
| name=dataset_name, | ||||||||||||||||
| ) | ||||||||||||||||
| ) | ||||||||||||||||
| return | ||||||||||||||||
| super().__init__( | ||||||||||||||||
| _( | ||||||||||||||||
| "A soft-deleted dataset (uuid %(uuid)s) already references " | ||||||||||||||||
|
|
||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: When archived datasets share a table name across schemas or catalogs, Recently Archived displays only that name, so this error cannot identify which row to restore or purge.
Assessment: 🟠
Major· 🔁Occurrence: Rarely· 🏷️Incomplete implementationPrompt for AI Agent 🤖