Skip to content

fix(semantic-layer): explain a refused semantic view batch in the add modal - #45902

Draft
mikebridge wants to merge 1 commit into
apache:masterfrom
mikebridge:sc-128972-bulk-create-limit-feedback
Draft

mikebridge wants to merge 1 commit into
apache:masterfrom
mikebridge:sc-128972-bulk-create-limit-feedback

Conversation

@mikebridge

Copy link
Copy Markdown
Contributor

SUMMARY

TL;DR: When someone selects more semantic views than the server allows in one request, the Add Semantic View modal now tells them so, using the server's own message with the configured limit, instead of a generic "An error occurred" toast. The selection stays in place so they can trim it and retry.

Background. Bulk semantic view creation refuses an oversized batch up front, before it looks up any view with the provider, and answers with HTTP 400 and a message such as "Too many views in one request: 101 provided, at most 100 allowed." The limit is operator-configurable, so the UI cannot hard-code it.

Problem. The modal only parsed HTTP 422 responses (the per-view partial-success shape). A 400 fell through to the generic failure path, so the user never saw why the batch was refused or what the limit is.

Changes.

  • creationResult.ts: a small batchRefusalMessage helper that accepts only a plain string message from the 400 body; anything else yields the generic message rather than echoing an unexpected body.
  • AddSemanticViewModal.tsx: the save handler shows that message inline (in the existing failure list) and as a danger toast, leaves the selected views untouched, and does not call the success or hide callbacks. HTTP 422 handling and every other status are unchanged.
  • Tests: four new cases covering the default limit, a non-default limit (no hard-coded number in the UI), and two malformed 400 bodies that must keep the generic text.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before: selecting more views than the limit and clicking Add shows the toast "An error occurred while adding semantic views".
After: the toast and the inline failure list read "Too many views in one request: 101 provided, at most 100 allowed." and the selection is kept.

TESTING INSTRUCTIONS

  1. Set SEMANTIC_VIEW_BULK_CREATE_MAX_VIEWS = 2 in superset_config.py and restart.
  2. Open a semantic layer that exposes at least three views, open Add Semantic View, select three views and click Add.
  3. Expect the limit message inline and as a toast, with the three views still selected. Deselect one and click Add again; the two views are created as before.
  4. Automated: cd superset-frontend && npx jest src/features/semanticViews.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

… modal

The bulk creation endpoint refuses an oversized batch with HTTP 400 before any
provider lookup, naming the configured limit. The Add Semantic View modal only
parsed HTTP 422 bodies, so that refusal surfaced as the generic failure toast.
Show the host's refusal inline and as a toast, keep the selection so the user
can trim it and retry, and fall back to the generic message for anything other
than a plain string message.
@netlify

netlify Bot commented Oct 30, 2026

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit a7e4818
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6ae4f240763de6ece98418b0
😎 Deploy Preview https://deploy-preview-45902--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov

codecov Bot commented Oct 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.73%. Comparing base (9e4292e) to head (a7e4818).
⚠️ Report is 9 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #45902   +/-   ##
=======================================
  Coverage   84.73%   84.73%           
=======================================
  Files        3069     3069           
  Lines      205771   205780    +9     
  Branches    48396    48399    +3     
=======================================
+ Hits       174354   174362    +8     
- Misses      28123    28124    +1     
  Partials     3294     3294           
Flag Coverage Δ
javascript 80.98% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant