Skip to content

fix: Table preview - dimension fallback and API validation#1394

Draft
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/table-preview-dimensions
Draft

fix: Table preview - dimension fallback and API validation#1394
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/table-preview-dimensions

Conversation

@sentry

@sentry sentry Bot commented May 29, 2026

Copy link
Copy Markdown

This PR addresses the issue DALGO-BACKEND-1VW where table chart previews failed with "No dimensions found after normalization!" when dimensions, dimension_col, and extra_dimension were all None in the payload.

Root Cause:

  1. The normalize_dimensions function for table charts only checked payload.dimensions and did not implement the intended fallback to dimension_col or extra_dimension when payload.dimensions was empty or None.
  2. The /api/charts/chart-data-preview/ endpoint lacked early input validation to reject payloads for table charts that had no dimension fields specified, leading to a ValueError further down the call stack.

Changes Made:

  1. ddpui/core/charts/charts_service.py (normalize_dimensions): Implemented the fallback logic for table charts. If payload.dimensions is empty or None, it now checks payload.dimension_col and payload.extra_dimension to populate the dimensions list, aligning with the function's docstring and behavior for other chart types.
  2. ddpui/api/charts_api.py (get_chart_data_preview): Added early validation. For table chart previews, if no dimension fields (dimensions, dimension_col, extra_dimension) are provided in the payload, an HttpError(400) is now raised with a clear message, preventing the request from proceeding with invalid input.
  3. ddpui/core/charts/charts_service.py (get_chart_data_table_preview): Downgraded the logger.error to logger.warning for the ValueError raised when no dimensions are found. This is because the API layer now handles this validation upfront with a 400 response, making the ValueError an expected outcome for invalid input rather than an unhandled error.

Fixes DALGO-BACKEND-1VW

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants