You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "mikebridge (via GitHub)" <gi...@apache.org> on 2026/10/20 16:21:34 UTC
[PR] fix(semantic-layers): show per-view errors when adding semantic views [superset]
mikebridge opened a new pull request, #45524:
URL: https://github.com/apache/superset/pull/45524
### SUMMARY
The Add Semantic View modal now shows which views could not be created and why, without losing track of views that were created successfully.
**What users saw:** an all-failed request showed only a generic toast. A partially successful request listed failed names but omitted the server's validation messages.
**Why:** the API returns per-view errors in both its 201 partial-success and 422 all-failed responses. The modal did not read the rejected 422 body or display the per-view details.
**What this changes:**
- Display each failed view's name and validation message inline, including field-error mappings, as escaped text.
- Keep the modal open for failures. Mark confirmed successes as already added, refresh the underlying list, and exclude those successes from the next retry.
- Keep all-success behavior unchanged: report success and close.
- Use a generic fallback for malformed responses and transport failures; do not display raw transport exception messages.
- Ignore save responses belonging to a closed modal.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before: failure toast without the validation details; successful items could remain selected after a partial result.
After: inline per-view errors and a retry selection containing only views that were not confirmed created.
No screenshots captured: application services were not started. Rendered feedback and retry behavior are covered by RTL tests.
### TESTING INSTRUCTIONS
With `SEMANTIC_LAYERS` enabled:
1. Open Add Semantic View and select multiple views.
2. Make one view fail server validation while another succeeds. Confirm the successful view is marked already added, the error includes the failed view name and message, and the modal stays open.
3. Retry and confirm only the failed view is submitted.
4. Exercise an all-failed request, then an all-success request. Confirm errors remain visible for the former and the modal closes for the latter.
Automated: the touched AddSemanticViewModal Jest/RTL suite covers all-failed 422, mixed 201, all-success, malformed responses, transport failures, text escaping, retry exclusion and a late response after close/reopen. Changed-file hooks include targeted TypeScript checking.
### ADDITIONAL INFORMATION
- [ ] Has associated issue:
- [x] Required feature flags: `SEMANTIC_LAYERS`
- [x] Changes UI
- [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] 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
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(semantic-layers): show per-view errors when adding semantic views [superset]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #45524:
URL: https://github.com/apache/superset/pull/45524#issuecomment-6295978226
## [Codecov](https://app.codecov.io/gh/apache/superset/pull/45524?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:x: Patch coverage is `98.66667%` with `1 line` in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 65.15%. Comparing base ([`3cf94c8`](https://app.codecov.io/gh/apache/superset/commit/3cf94c87aefb900a3bcba7e55e6be4763a2e388d?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`d29d243`](https://app.codecov.io/gh/apache/superset/commit/d29d24300762c0fea97325b2805dc4fe598a4c05?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 1 commits behind head on master.
| [Files with missing lines](https://app.codecov.io/gh/apache/superset/pull/45524?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [...ntend/src/features/semanticViews/creationResult.ts](https://app.codecov.io/gh/apache/superset/pull/45524?src=pr&el=tree&filepath=superset-frontend%2Fsrc%2Ffeatures%2FsemanticViews%2FcreationResult.ts&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2ZlYXR1cmVzL3NlbWFudGljVmlld3MvY3JlYXRpb25SZXN1bHQudHM=) | 97.36% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/45524?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #45524 +/- ##
=======================================
Coverage 65.15% 65.15%
=======================================
Files 3053 3054 +1
Lines 200640 200699 +59
Branches 46820 46852 +32
=======================================
+ Hits 130719 130774 +55
- Misses 66981 66985 +4
Partials 2940 2940
```
| [Flag](https://app.codecov.io/gh/apache/superset/pull/45524/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [javascript](https://app.codecov.io/gh/apache/superset/pull/45524/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `79.37% <98.66%> (+<0.01%)` | :arrow_up: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/superset/pull/45524?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(semantic-layers): show per-view errors when adding semantic views [superset]
Posted by "aminghadersohi (via GitHub)" <gi...@apache.org>.
aminghadersohi merged PR #45524:
URL: https://github.com/apache/superset/pull/45524
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(semantic-layers): show per-view errors when adding semantic views [superset]
Posted by "mikebridge (via GitHub)" <gi...@apache.org>.
mikebridge commented on code in PR #45524:
URL: https://github.com/apache/superset/pull/45524#discussion_r4330992149
##########
superset-frontend/src/features/semanticViews/AddSemanticViewModal.tsx:
##########
@@ -610,47 +623,65 @@ export default function AddSemanticViewModal({
configuration: runtimeData,
}));
- const { json } = await SupersetClient.post({
- endpoint: '/api/v1/semantic_view/',
- jsonPayload: { views: viewsToCreate },
- });
-
- const created = Array.isArray(json?.result?.created)
- ? json.result.created
- : [];
- const errors = Array.isArray(json?.result?.errors)
- ? json.result.errors
- : [];
+ let body: unknown;
+ try {
+ const { json } = await SupersetClient.post({
+ endpoint: '/api/v1/semantic_view/',
+ jsonPayload: { views: viewsToCreate },
+ });
+ body = json;
+ } catch (error) {
+ // SupersetClient rejects non-2xx responses before parsing their body.
+ if (
+ !isRecord(error) ||
+ error.status !== 422 ||
+ typeof error.json !== 'function'
+ ) {
+ throw error;
+ }
+ body = await error.json();
+ }
+ if (gen !== fetchGenRef.current) return;
Review Comment:
Fixed in 6aee861628. A completed creation still refreshes the dataset list and reports success after the modal closes; the generation guard only prevents stale modal-local updates. The close/reopen regression test pins both sides.
##########
superset-frontend/src/features/semanticViews/AddSemanticViewModal.tsx:
##########
@@ -726,12 +757,32 @@ export default function AddSemanticViewModal({
saveLoading={saving}
>
<ModalContent>
+ {creationErrors.length > 0 && (
Review Comment:
Fixed in 6aee861628. An actual runtime configuration change clears the previous creation errors; an unchanged form notification does not. Added a rendered-form regression for changing configuration after a failed save.
##########
superset-frontend/src/features/semanticViews/AddSemanticViewModal.tsx:
##########
@@ -726,12 +757,32 @@ export default function AddSemanticViewModal({
saveLoading={saving}
>
<ModalContent>
+ {creationErrors.length > 0 && (
+ <Alert
+ type="error"
+ showIcon
+ message={t('Some semantic views could not be added')}
+ description={
+ <List
Review Comment:
Fixed in 6aee861628. The details are in a bounded, keyboard-scrollable region. Batches over three failures get a count-only toast, with every name and detail retained in the list. Added a 100-failure case.
##########
superset-frontend/src/features/semanticViews/AddSemanticViewModal.tsx:
##########
@@ -610,47 +623,65 @@ export default function AddSemanticViewModal({
configuration: runtimeData,
}));
- const { json } = await SupersetClient.post({
- endpoint: '/api/v1/semantic_view/',
- jsonPayload: { views: viewsToCreate },
- });
-
- const created = Array.isArray(json?.result?.created)
- ? json.result.created
- : [];
- const errors = Array.isArray(json?.result?.errors)
- ? json.result.errors
- : [];
+ let body: unknown;
+ try {
+ const { json } = await SupersetClient.post({
+ endpoint: '/api/v1/semantic_view/',
+ jsonPayload: { views: viewsToCreate },
+ });
+ body = json;
+ } catch (error) {
+ // SupersetClient rejects non-2xx responses before parsing their body.
+ if (
+ !isRecord(error) ||
+ error.status !== 422 ||
+ typeof error.json !== 'function'
+ ) {
+ throw error;
+ }
+ body = await error.json();
+ }
+ if (gen !== fetchGenRef.current) return;
+ const { created, errors } = parseCreationResult(body);
+ setCreationErrors(errors);
if (created.length > 0) {
+ setAvailableViews(previous =>
+ previous.map(view =>
+ created.includes(view.name)
+ ? { ...view, already_added: true }
+ : view,
+ ),
+ );
+ setSelectedViewNames(previous =>
+ previous.filter(name => !created.includes(name)),
+ );
addSuccessToast(t('%s semantic view(s) added', created.length));
+ onSuccess();
}
if (errors.length > 0) {
- const failedNames = errors
- .map((error: { name?: string }) => error?.name)
- .filter((name: string | undefined): name is string => !!name);
+ const failedNames = errors.map(error => error.name).filter(Boolean);
addDangerToast(
failedNames.length > 0
? t(
'%s semantic view(s) failed to add: %s',
- errors.length,
+ failedNames.length,
Review Comment:
Fixed in 6aee861628. The count comes from server error records, including unnamed ones, rather than the names shown in the toast. Synthetic malformed-response feedback is excluded. Added unnamed and mixed named/unnamed cases; all 44 modal tests pass.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(semantic-layers): show per-view errors when adding semantic views [superset]
Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on PR #45524:
URL: https://github.com/apache/superset/pull/45524#issuecomment-6297522489
## CodeAnt PR Risk: Low Risk
- The PR appears safe to merge; the changes keep partial failures visible while allowing failed semantic views to be retried.
- Malformed responses receive generic feedback, and displayed validation text is rendered as text rather than HTML.
- Tests cover partial and total failures, malformed responses, retry behavior, and responses arriving after the modal closes.
**Assessed commit:** `3dff43286bca`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(semantic-layers): show per-view errors when adding semantic views [superset]
Posted by "fitzee (via GitHub)" <gi...@apache.org>.
fitzee commented on code in PR #45524:
URL: https://github.com/apache/superset/pull/45524#discussion_r4330827191
##########
superset-frontend/src/features/semanticViews/AddSemanticViewModal.tsx:
##########
@@ -610,47 +623,65 @@ export default function AddSemanticViewModal({
configuration: runtimeData,
}));
- const { json } = await SupersetClient.post({
- endpoint: '/api/v1/semantic_view/',
- jsonPayload: { views: viewsToCreate },
- });
-
- const created = Array.isArray(json?.result?.created)
- ? json.result.created
- : [];
- const errors = Array.isArray(json?.result?.errors)
- ? json.result.errors
- : [];
+ let body: unknown;
+ try {
+ const { json } = await SupersetClient.post({
+ endpoint: '/api/v1/semantic_view/',
+ jsonPayload: { views: viewsToCreate },
+ });
+ body = json;
+ } catch (error) {
+ // SupersetClient rejects non-2xx responses before parsing their body.
+ if (
+ !isRecord(error) ||
+ error.status !== 422 ||
+ typeof error.json !== 'function'
+ ) {
+ throw error;
+ }
+ body = await error.json();
+ }
+ if (gen !== fetchGenRef.current) return;
Review Comment:
non-blocking: Cancel/X stay enabled during save (`StandardModal` only disables the primary button), and closing bumps `fetchGenRef`, so this early return drops a response whose views were already committed server-side. Before this change the base code still called `onSuccess()`/toast after close; now the dataset list is not refreshed and the user gets no confirmation that anything was created (the new "closed and reopened" test asserts exactly this). Suggest skipping only the local state updates on a stale generation, but still calling `onSuccess()` (and the success toast) when `created.length > 0`.
##########
superset-frontend/src/features/semanticViews/AddSemanticViewModal.tsx:
##########
@@ -726,12 +757,32 @@ export default function AddSemanticViewModal({
saveLoading={saving}
>
<ModalContent>
+ {creationErrors.length > 0 && (
Review Comment:
non-blocking: `creationErrors` is cleared on layer change, close, and save, but not in `handleRuntimeFormChange`. After a partial failure, changing the source location (e.g. a different schema) replaces the views list while the alert still reports failures for views from the previous configuration. Clearing it when runtime data changes (or when the views list is refetched) avoids stale errors.
##########
superset-frontend/src/features/semanticViews/AddSemanticViewModal.tsx:
##########
@@ -726,12 +757,32 @@ export default function AddSemanticViewModal({
saveLoading={saving}
>
<ModalContent>
+ {creationErrors.length > 0 && (
+ <Alert
+ type="error"
+ showIcon
+ message={t('Some semantic views could not be added')}
+ description={
+ <List
Review Comment:
nit: no height bound. With a large batch failing (e.g. layer unreachable, 100 selected views) the alert pushes the form far down the modal, and the toast concatenates all 100 names. A `max-height` + `overflow-y: auto` on the list, and truncating the toast name list ("a, b, c and 97 more"), would keep it usable.
##########
superset-frontend/src/features/semanticViews/AddSemanticViewModal.tsx:
##########
@@ -610,47 +623,65 @@ export default function AddSemanticViewModal({
configuration: runtimeData,
}));
- const { json } = await SupersetClient.post({
- endpoint: '/api/v1/semantic_view/',
- jsonPayload: { views: viewsToCreate },
- });
-
- const created = Array.isArray(json?.result?.created)
- ? json.result.created
- : [];
- const errors = Array.isArray(json?.result?.errors)
- ? json.result.errors
- : [];
+ let body: unknown;
+ try {
+ const { json } = await SupersetClient.post({
+ endpoint: '/api/v1/semantic_view/',
+ jsonPayload: { views: viewsToCreate },
+ });
+ body = json;
+ } catch (error) {
+ // SupersetClient rejects non-2xx responses before parsing their body.
+ if (
+ !isRecord(error) ||
+ error.status !== 422 ||
+ typeof error.json !== 'function'
+ ) {
+ throw error;
+ }
+ body = await error.json();
+ }
+ if (gen !== fetchGenRef.current) return;
+ const { created, errors } = parseCreationResult(body);
+ setCreationErrors(errors);
if (created.length > 0) {
+ setAvailableViews(previous =>
+ previous.map(view =>
+ created.includes(view.name)
+ ? { ...view, already_added: true }
+ : view,
+ ),
+ );
+ setSelectedViewNames(previous =>
+ previous.filter(name => !created.includes(name)),
+ );
addSuccessToast(t('%s semantic view(s) added', created.length));
+ onSuccess();
}
if (errors.length > 0) {
- const failedNames = errors
- .map((error: { name?: string }) => error?.name)
- .filter((name: string | undefined): name is string => !!name);
+ const failedNames = errors.map(error => error.name).filter(Boolean);
addDangerToast(
failedNames.length > 0
? t(
'%s semantic view(s) failed to add: %s',
- errors.length,
+ failedNames.length,
Review Comment:
nit: switching from `errors.length` to `failedNames.length` undercounts when the server returns an error without a name (the API emits `view_data.get("name")`, which is `None` for a schema-invalid entry): two failures render as "1 semantic view(s) failed to add: customers". Counting server errors separately from the synthetic generic entry keeps the number accurate.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(semantic-layers): show per-view errors when adding semantic views [superset]
Posted by "netlify[bot] (via GitHub)" <gi...@apache.org>.
netlify[bot] commented on PR #45524:
URL: https://github.com/apache/superset/pull/45524#issuecomment-6303182666
### <span aria-hidden="true">✅</span> Deploy Preview for *superset-docs-preview* ready!
| Name | Link |
|:-:|------------------------|
|<span aria-hidden="true">🔨</span> Latest commit | 6aee861628c92499c4f19111652a05e1e27fcee5 |
|<span aria-hidden="true">🔍</span> Latest deploy log | https://app.netlify.com/projects/superset-docs-preview/deploys/6ad7ea6fcbef5ab600a5edaf |
|<span aria-hidden="true">😎</span> Deploy Preview | [https://deploy-preview-45524--superset-docs-preview.netlify.app](https://deploy-preview-45524--superset-docs-preview.netlify.app) |
|<span aria-hidden="true">📱</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br /><br /><br />_Use your smartphone camera to open QR code link._</details> |
|<span aria-hidden="true">🤖</span> Make changes | [Run an agent on this branch](https://app.netlify.com/projects/superset-docs-preview/agent-runs#DctBCoAgEEDRu8y6gYoy6AYdY3RGEjRljCKiu-fuL95_oWhO5YQVoAOrdLi9dXU4jMs0GayS6DiDwyvIjSkzRRTVrLV5lhLzs3E7DPEiZLyz4meypu9pFiYP3w8) |
---
<!-- [superset-docs-preview Preview](https://deploy-preview-45524--superset-docs-preview.netlify.app) -->
_To edit notification comments on pull requests, go to your [Netlify project configuration](https://app.netlify.com/projects/superset-docs-preview/configuration/notifications#deploy-notifications)._
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org