ref(dashboards): Remove top_n and stacked_area display type handling#114903
ref(dashboards): Remove top_n and stacked_area display type handling#114903DominikB2014 wants to merge 3 commits intomasterfrom
Conversation
… types Reject PUT requests that touch widgets whose saved display_type is in DashboardWidgetDisplayTypes.DEPRECATED_TYPES (stacked_area, top_n). Previously these widgets were creatable-blocked but updatable, which left existing deprecated widgets indefinitely editable. Clients now need to delete and recreate them with a supported display type. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
The 1080 backfill migration converted all top_n and stacked_area widgets to area, so neither value can appear in the database anymore. Drop the enum entries, the DEPRECATED_TYPES list, the create-time and update-time validator branches, the slack unfurl mappings, and the generate_dashboard_artifact blocklist entry. Also reverts the prior commit's update_widget rejection (no widgets remain to reject) and fixes is_table_display_type which relied on the TYPES list position matching the TABLE id; switched to get_type_name so future enum changes don't silently swap which type is "table". Update the 1080 backfill test to use raw integer ids (2, 7) for the historic display types since the constants no longer exist on the model. Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 40e1fcc. Configure here.
| (BAR_CHART, "bar"), | ||
| (TABLE, "table"), | ||
| (BIG_NUMBER, "big_number"), | ||
| (TOP_N, "top_n"), |
There was a problem hiding this comment.
Enum removal breaks serialization for unmigrated DB rows
High Severity
Removing STACKED_AREA_CHART = 2 and TOP_N = 7 from DashboardWidgetDisplayTypes.TYPES causes get_type_name() to return None for any database rows that still store those integer values. The backfill migration 1080 is marked is_post_deployment = True and requires manual execution, so there is a window after this code deploys — and potentially an indefinite one if the migration hasn't been triggered yet — where API responses will contain "displayType": null for affected widgets. This breaks dashboard rendering for any organization with unmigrated deprecated widgets.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 40e1fcc. Configure here.


Summary
The 1080 backfill migration (
1080_backfill_deprecated_dashboard_widget_display_types) converted everytop_nandstacked_areawidget toarea, so neither value can appear in the database anymore. Strip the now-dead handling end-to-end:STACKED_AREA_CHART,TOP_N, andDEPRECATED_TYPESfromDashboardWidgetDisplayTypes.DashboardWidgetSerializer.stacked_areaentry fromgenerate_dashboard_artifact.DISPLAY_TYPE_BLOCKLIST.is_table_display_type, which relied onas_text_choices()[TABLE]happening to land on"table"because the enum id matched the list position; shrinkingTYPESexposed that fragility. Switched toget_type_name(TABLE).