Skip to content

ref(dashboards): Remove top_n and stacked_area display type handling#114903

Open
DominikB2014 wants to merge 3 commits intomasterfrom
dominikb2014/feat/disallow-update-deprecated-display-type-widgets
Open

ref(dashboards): Remove top_n and stacked_area display type handling#114903
DominikB2014 wants to merge 3 commits intomasterfrom
dominikb2014/feat/disallow-update-deprecated-display-type-widgets

Conversation

@DominikB2014
Copy link
Copy Markdown
Contributor

@DominikB2014 DominikB2014 commented May 5, 2026

Summary

The 1080 backfill migration (1080_backfill_deprecated_dashboard_widget_display_types) converted every top_n and stacked_area widget to area, so neither value can appear in the database anymore. Strip the now-dead handling end-to-end:

  • Remove STACKED_AREA_CHART, TOP_N, and DEPRECATED_TYPES from DashboardWidgetDisplayTypes.
  • Drop the create-time and update-time deprecation branches in DashboardWidgetSerializer.
  • Drop the slack unfurl mappings for the two types.
  • Remove the stacked_area entry from generate_dashboard_artifact.DISPLAY_TYPE_BLOCKLIST.
  • Fix is_table_display_type, which relied on as_text_choices()[TABLE] happening to land on "table" because the enum id matched the list position; shrinking TYPES exposed that fragility. Switched to get_type_name(TABLE).
  • Update the 1080 migration test to reference the historic display-type ids by integer literal since the constants no longer exist.

… 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>
@DominikB2014 DominikB2014 requested review from a team as code owners May 5, 2026 19:30
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label May 5, 2026
DominikB2014 and others added 2 commits May 5, 2026 15:42
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>
@DominikB2014 DominikB2014 requested review from a team as code owners May 5, 2026 20:01
@DominikB2014 DominikB2014 changed the title feat(dashboards): Disallow updates to widgets with deprecated display types ref(dashboards): Remove top_n and stacked_area display type handling May 5, 2026
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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"),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 40e1fcc. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants