codeant-ai-for-open-source[bot] commented on code in PR #45551:
URL: https://github.com/apache/superset/pull/45551#discussion_r4351257786
##########
superset/commands/dashboard/restore_version.py:
##########
@@ -43,3 +53,35 @@ class
RestoreDashboardVersionCommand(BaseRestoreVersionCommand):
not_found_exc = DashboardNotFoundError
forbidden_exc = DashboardForbiddenError
failed_exc = DashboardUpdateFailedError
+
+ def run(self) -> RestoreResult:
+ """Restore, confirming a reported chart-purge race before surfacing it.
+
+ The transaction has rolled back by the time the race reaches here,
+ so a fresh read sees the purge's commit. Only when one of the charts
+ whose membership the restore was changing is really gone is the
+ retryable :class:`ChartPurgedDuringRestoreError` raised. Otherwise,
+ or when the confirming read itself fails, the restore fails the
+ ordinary way.
+ """
+ try:
+ return super().run()
+ except ChartPurgedDuringRestoreError as ex:
+ slices: sa.Table = Slice.__table__
+ try:
+ remaining: set[int] = set(
+ db.session.execute(
+
sa.select(slices.c.id).where(slices.c.id.in_(ex.chart_ids))
Review Comment:
✅ **Customized review instruction saved!**
**Instruction:**
> Do not recommend changing the post-rollback chart-ID check to return a
retryable 409 unless membership reconstruction is UUID-aware; integer-ID lookup
can resolve a replacement chart.
**Applied to:**
- `superset/commands/dashboard/restore_version.py`
---
💡 *To manage or update this instruction, visit: [CodeAnt AI
Settings](https://app.codeant.ai/org/settings/learnings)*
--
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]