feat(dashboards): Validate display type against dataset config#115951
feat(dashboards): Validate display type against dataset config#115951DominikB2014 wants to merge 6 commits into
Conversation
Reject widget create/update requests whose (widget_type, display_type) combination isn't allowed by the frontend Widget Builder's type selector (e.g. table on tracemetrics, table on preprod-app-size).
- Add SERVER_TREE to SPANS config to match frontend spans dataset config. - Reset widget_type on context every to_internal_value so stale values don't leak between widgets when the serializer is used with many=True.
The AI Agents Overview prebuilt config omits widget_type for the traces table widget, so create_widget defaults it to error-events. Subsequent PUTs round-trip widget_type=error-events alongside the agents_traces_table display type, which would otherwise fail the new dataset validation.
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 08d107b. Configure here.
| DashboardWidgetTypes.RELEASE_HEALTH: { | ||
| "supported_display_types": _DEFAULT_CHART_AND_TABLE_TYPES | ||
| }, | ||
| DashboardWidgetTypes.METRICS: {"supported_display_types": _DEFAULT_CHART_AND_TABLE_TYPES}, |
There was a problem hiding this comment.
Unreachable METRICS entry in DATASET_CONFIG is dead code
Low Severity
The DATASET_CONFIG entry keyed by DashboardWidgetTypes.METRICS (id=3) is unreachable dead code. In DashboardWidgetTypes.TYPES, the name "metrics" maps to RELEASE_HEALTH (id=2), not METRICS (id=3). So get_id_for_type_name("metrics") returns 2, and DATASET_CONFIG.get(3) is never hit through the validation flow. The entry for DashboardWidgetTypes.RELEASE_HEALTH on line 139 is the one that actually gets used when widgetType: "metrics" is sent.
Reviewed by Cursor Bugbot for commit 08d107b. Configure here.
error-events is the create_widget default whenever a request omits widget_type, so any system/legacy display type from a prebuilt config that lacks widget_type ends up here (e.g. AGENTS_TRACES_TABLE from the AI Agents Overview dashboard). Removing the config entry lets the existing "no config = skip" branch handle it.


Rejects widget create/update requests whose
(widget_type, display_type)combination isn't allowed by the frontend Widget Builder's type selector (e.g.tableontracemetrics,tableonpreprod-app-size). Allowed combinations live in a newDATASET_CONFIGmap keyed bywidget_type.For example, in the ui trace metrics don't support tables, so we shouldn't let them be saved as tables