Skip to content

fix(charts): show user-friendly error for HTTP 413 payload too large - #37131

Merged
rusackas merged 3 commits into
apache:masterfrom
Vansh5632:fix/http-413-chart-export-error-handling
Jun 24, 2026
Merged

rusackas merged 3 commits into
apache:masterfrom
Vansh5632:fix/http-413-chart-export-error-handling

Conversation

@Vansh5632

@Vansh5632 Vansh5632 commented Jan 14, 2026 •

Copy link
Copy Markdown
Contributor

fix(charts): show user-friendly error for HTTP 413 payload too large

fixes: #36887

SUMMARY

This PR fixes a poor user experience when exporting large chart datasets that exceed nginx/reverse proxy payload size limits (HTTP 413 errors). Previously, these errors would open in a new browser tab showing raw JSON or HTML error pages. Now, users see friendly toast notifications explaining the issue.

Key Changes:

  • Added SupersetClient.postBlob() method to enable AJAX-based chart exports with error handling
  • Replaced form submission (postForm) with AJAX requests (postBlob) for all chart exports
  • Implemented HTTP 413-specific error detection and user-friendly toast notifications
  • Added comprehensive error handling in both Explore and Dashboard views
  • Exported downloadBlob utility function for reuse across components

Technical Implementation:

  • Modified exportChart in exploreUtils/index.js to use try-catch with SupersetClient.postBlob()
  • Updated useExploreAdditionalActionsMenu to handle errors from CSV, JSON, and Excel exports
  • Updated Dashboard's Chart.jsx to handle errors from table exports
  • All changes maintain backward compatibility with existing export functionality
### TESTING INSTRUCTIONS

**Automated Tests:**
```bash
cd superset-frontend
npm run test -- exploreUtils.test.jsx

Expected Behavior:

  • ✅ Small exports: Downloads work normally with correct filenames
  • ✅ Large exports (HTTP 413): Toast notification appears, user stays on page
  • ✅ Other errors (HTTP 500): Generic error toast appears
  • ✅ No console errors or warnings

ADDITIONAL INFORMATION

  • Has associated issue: Fixes poor UX for large dataset exports hitting proxy limits
  • Required feature flags: None
  • Changes UI: Adds toast notifications for export errors
  • Includes DB Migration: No
  • Introduces new feature or API: Yes - adds SupersetClient.postBlob() method (internal API)
  • Removes existing feature or API: No

Additional Notes:

  • All 8 modified files include comprehensive unit tests
  • Pre-commit checks passing (prettier, oxlint, eslint, TypeScript)
  • Changes are backward compatible - only affects error handling path
  • No database migrations required
  • No feature flags needed

@netlify

netlify Bot commented Jan 14, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 86094c2
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6a3b9758e7a416000890fb71
😎 Deploy Preview https://deploy-preview-37131--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.

@Vansh5632
Vansh5632 marked this pull request as ready for review January 14, 2026 18:15
@dosubot dosubot Bot added api Related to the REST API change:frontend Requires changing the frontend labels Jan 14, 2026

@bito-code-review bito-code-review Bot left a comment •

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.

Code Review Agent Run #effd4d

Actionable Suggestions - 1
  • superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/index.jsx - 1
Additional Suggestions - 2
  • superset-frontend/packages/superset-ui-core/src/connection/SupersetClientClass.ts - 1
    • JSDoc return description mismatch · Line 152-157
      The JSDoc for the new postBlob method states it 'returns a blob', but the implementation returns Promise. While the Response can be used to access the blob via response.blob(), the documentation should match the actual return type to avoid confusion for callers expecting a blob directly.
      Code suggestion
       @@ -152,7 +152,7 @@
      -  /**
      -   * POST request that returns a blob for file downloads.
      -   * Unlike postForm, this uses AJAX so errors can be caught and handled.
      -   * @param endpoint - API endpoint
      -   * @param payload - Request payload
      -   * @returns Promise resolving to Response with blob
      -   */
      +  /**
      +   * POST request that returns a Promise<Response> for file downloads.
      +   * Unlike postForm, this uses AJAX so errors can be caught and handled.
      +   * @param endpoint - API endpoint
      + * @param payload - Request payload
      +   * @returns Promise resolving to Response with blob
      +   */
  • superset-frontend/src/explore/exploreUtils/exploreUtils.test.jsx - 1
    • Deprecated test structure · Line 306-306
      The added test code uses describe blocks, which are deprecated per project guidelines in favor of flat test structures. The existing code includes a TODO comment to migrate from describe blocks, and this addition continues the pattern. Consider refactoring to individual test() calls to support the ongoing testing strategy migration.
Review Details
  • Files reviewed - 8 · Commit Range: f4ac865..f4ac865
    • superset-frontend/packages/superset-ui-core/src/connection/SupersetClient.ts
    • superset-frontend/packages/superset-ui-core/src/connection/SupersetClientClass.ts
    • superset-frontend/packages/superset-ui-core/src/connection/types.ts
    • superset-frontend/src/dashboard/components/gridComponents/Chart/Chart.jsx
    • superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/index.jsx
    • superset-frontend/src/explore/exploreUtils/exploreUtils.test.jsx
    • superset-frontend/src/explore/exploreUtils/index.js
    • superset-frontend/src/utils/export.ts
  • Files skipped - 0
  • Tools
    • Eslint (Linter) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@codeant-ai-for-open-source

Copy link
Copy Markdown
Contributor

CodeAnt AI is reviewing your PR.


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@github-actions github-actions Bot removed the api Related to the REST API label Jan 15, 2026
reAuthenticate: () => getInstance().reAuthenticate(),
request: request => getInstance().request(request),
getCSRFToken: () => getInstance().getCSRFToken(),
postBlob: (endpoint, payload) => getInstance().postBlob(endpoint, payload),

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.

Suggestion: The wrapper uses two separate parameters (endpoint, payload) but callers likely pass a single request object; this will cause the instance postBlob to receive an unexpected shape (the whole request as endpoint and payload undefined), leading to runtime errors—forward the single request argument to the instance method. [logic error]

Severity Level: Critical 🚨
- ❌ Explore export (exportChart) fails producing no download.
- ❌ Dashboard chart/table export fails to download.
- ⚠️ Browser console shows uncaught export-related errors.
- ⚠️ Automated tests for exports may start failing.
Suggested change
postBlob: (endpoint, payload) => getInstance().postBlob(endpoint, payload),
postBlob: request => getInstance().postBlob(request),
Steps of Reproduction ✅
1. Ensure SupersetClient is configured and the singleton exists by calling
SupersetClient.configure(...). (See
superset-frontend/packages/superset-ui-core/src/connection/SupersetClient.ts around
getInstance()/configure; the wrapper live at line 54.)

2. Trigger a UI chart export that the PR description changed to use postBlob — e.g., click
"Download CSV" in Explore which calls exportChart in exploreUtils (PR changes reference
exploreUtils/index.js:exportChart). That code calls SupersetClient.postBlob(request) with
a single request object (request contains endpoint, payload, filename metadata).

3. At runtime the wrapper in SupersetClient.ts line 54 executes, treating the single
object as the `endpoint` parameter and leaving `payload` undefined, then calls
getInstance().postBlob(endpoint, payload) with unexpected shapes.

4. If SupersetClientClass.postBlob expects a single request object, the instance method
receives wrong arguments and may throw, return an error, or produce malformed network
requests — observed as export failures or uncaught exceptions in the browser console and
failed downloads.

Note: the reproduction maps to the PR description which replaced form submissions with
SupersetClient.postBlob usage in exploreUtils and Dashboard chart export flows; the
wrapper at SupersetClient.ts:54 must forward the same single-argument shape used by those
callers.
Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-frontend/packages/superset-ui-core/src/connection/SupersetClient.ts
**Line:** 54:54
**Comment:**
	*Logic Error: The wrapper uses two separate parameters `(endpoint, payload)` but callers likely pass a single request object; this will cause the instance `postBlob` to receive an unexpected shape (the whole request as `endpoint` and `payload` undefined), leading to runtime errors—forward the single request argument to the instance method.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.

| 'postBlob'
| 'put'
| 'request'
| 'init'

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.

Suggestion: Adding 'postBlob' to the Pick list assumes SupersetClientClass already declares that method; if it doesn't, the Pick will not include it and consumers expecting postBlob will break. Make postBlob an optional member on the exported interface (typed to the correct request/response types) or ensure the class exposes the method. This preserves backward compatibility while providing proper types for the new API. [type error]

Severity Level: Critical 🚨
- ❌ TypeScript build failure blocking CI pipelines.
- ❌ Explore exportChart runtime TypeError on export.
- ❌ Dashboard chart export runtime errors.
- ⚠️ Consumers relying on SupersetClient typings mismatched.
Suggested change
| 'init'
| 'put'
| 'request'
| 'init'
| 'isAuthenticated'
| 'reAuthenticate'
| 'getGuestToken'
> {
// `postBlob` may be a new API implemented on SupersetClientClass.
// Declare it optional here to avoid breaking consumers if the class
// implementation isn't present at compile time, and provide a precise type.
postBlob?: (request: RequestConfig) => Promise<SupersetClientResponse>;
Steps of Reproduction ✅
1. Run TypeScript build for the frontend package: from repo root run `cd superset-frontend
&& npm run build` (this triggers tsc for packages). Type errors originate from
`superset-frontend/packages/superset-ui-core/src/connection/types.ts:152` where the Pick
includes `'postBlob'`. Expect TypeScript error like: "Type '"postBlob"' is not assignable
to parameter of type 'keyof SupersetClientClass'".

2. Inspect the imported class at
`superset-frontend/packages/superset-ui-core/src/connection/SupersetClientClass` (import
path from `types.ts` line 1: `import SupersetClientClass from './SupersetClientClass';`).
If that class file does not declare a `postBlob` member, the Pick in `types.ts` will fail
compilation as shown in step 1.

3. If TypeScript checking is skipped (e.g., during a Babel-only transpile or in a runtime
test environment), consumer code added in this PR calls `SupersetClient.postBlob(...)`
from Explore export functions (PR description references
`superset-frontend/src/explore/exploreUtils/index.js` exportChart usage). At runtime, if
`SupersetClientClass` instance lacks `postBlob`, this results in a runtime TypeError:
"SupersetClient.postBlob is not a function" when `exportChart` calls it.

4. Confirm by opening the PR-modified consumers:
`superset-frontend/src/explore/exploreUtils/index.js` (exportChart),
`superset-frontend/src/dashboard/Chart.jsx` (table export), and
`superset-frontend/src/hooks/useExploreAdditionalActionsMenu` (CSV/Excel/JSON exports). If
these files call `SupersetClient.postBlob` but `SupersetClientClass` does not declare it,
either TypeScript build fails (step 1) or runtime failures occur (step 3). If the addition
to the Pick was intentional, verify `SupersetClientClass` implements `postBlob` in
`superset-frontend/packages/superset-ui-core/src/connection/SupersetClientClass.ts`.
Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-frontend/packages/superset-ui-core/src/connection/types.ts
**Line:** 158:158
**Comment:**
	*Type Error: Adding `'postBlob'` to the Pick list assumes `SupersetClientClass` already declares that method; if it doesn't, the Pick will not include it and consumers expecting `postBlob` will break. Make `postBlob` an optional member on the exported interface (typed to the correct request/response types) or ensure the class exposes the method. This preserves backward compatibility while providing proper types for the new API.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.

@codeant-ai-for-open-source

Copy link
Copy Markdown
Contributor

CodeAnt AI finished reviewing your PR.

@bito-code-review

bito-code-review Bot commented Jan 15, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #c52491

Actionable Suggestions - 0
Review Details
  • Files reviewed - 8 · Commit Range: f4ac865..8d28df5
    • superset-frontend/packages/superset-ui-core/src/connection/SupersetClient.ts
    • superset-frontend/packages/superset-ui-core/src/connection/SupersetClientClass.ts
    • superset-frontend/packages/superset-ui-core/src/connection/types.ts
    • superset-frontend/src/dashboard/components/gridComponents/Chart/Chart.jsx
    • superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/index.jsx
    • superset-frontend/src/explore/exploreUtils/exploreUtils.test.jsx
    • superset-frontend/src/explore/exploreUtils/index.js
    • superset-frontend/src/utils/export.ts
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@codeant-ai-for-open-source

Copy link
Copy Markdown
Contributor

CodeAnt AI is running Incremental review


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@codeant-ai-for-open-source

Copy link
Copy Markdown
Contributor

CodeAnt AI Incremental review completed.

@Vansh5632

Copy link
Copy Markdown
Contributor Author

@rusackas your review is appreciated

@bito-code-review bito-code-review Bot left a comment •

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.

Code Review Agent Run #715822

Actionable Suggestions - 1
  • superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/useExploreAdditionalActionsMenu.test.jsx - 1
Review Details
  • Files reviewed - 9 · Commit Range: 8d28df5..ff0cbb2
    • superset-frontend/packages/superset-ui-core/src/connection/SupersetClient.ts
    • superset-frontend/packages/superset-ui-core/src/connection/SupersetClientClass.ts
    • superset-frontend/packages/superset-ui-core/src/connection/types.ts
    • superset-frontend/src/dashboard/components/gridComponents/Chart/Chart.jsx
    • superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/index.jsx
    • superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/useExploreAdditionalActionsMenu.test.jsx
    • superset-frontend/src/explore/exploreUtils/exploreUtils.test.jsx
    • superset-frontend/src/explore/exploreUtils/index.js
    • superset-frontend/src/utils/export.ts
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Copilot AI left a comment

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.

Pull request overview

This PR improves error handling for chart exports that fail due to HTTP 413 (Payload Too Large) errors by replacing form-based submissions with AJAX requests. This allows the application to catch errors and display user-friendly toast notifications instead of opening raw error pages in new browser tabs.

Changes:

  • Added SupersetClient.postBlob() method for AJAX-based blob downloads with error handling
  • Refactored exportChart() to use AJAX requests and throw errors with proper status codes
  • Updated export functions in Explore and Dashboard views to catch and display user-friendly error messages for HTTP 413 and other errors

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
superset-frontend/src/utils/export.ts Exported downloadBlob utility function for reuse
superset-frontend/packages/superset-ui-core/src/connection/types.ts Added postBlob to SupersetClientInterface
superset-frontend/packages/superset-ui-core/src/connection/SupersetClientClass.ts Implemented postBlob() method
superset-frontend/packages/superset-ui-core/src/connection/SupersetClient.ts Exposed postBlob in SupersetClient singleton
superset-frontend/src/explore/exploreUtils/index.js Replaced postForm with postBlob and added error handling
superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/index.jsx Added try-catch error handling to all export functions; fixed shareByEmail and copyLink implementation
superset-frontend/src/dashboard/components/gridComponents/Chart/Chart.jsx Added error handling to exportTable function
superset-frontend/src/explore/exploreUtils/exploreUtils.test.jsx Added comprehensive tests for new export functionality
superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/useExploreAdditionalActionsMenu.test.jsx Added tests for 413 error handling
Comments suppressed due to low confidence (1)

superset-frontend/src/dashboard/components/gridComponents/Chart/Chart.jsx:597

  • The dependency array is missing boundActionCreators.addDangerToast which is used in the catch block at lines 567 and 579. While boundActionCreators is memoized, it's better to explicitly include boundActionCreators.addDangerToast in the dependency array for clarity and to match the pattern used elsewhere in this file (e.g., line 268 includes both boundActionCreators.logEvent and boundActionCreators.changeFilter).
    [
      slice.slice_id,
      slice.viz_type,
      isCached,
      formData,
      maxRows,
      dataMask[props.id]?.ownState,
      chartState,
      props.id,
      boundActionCreators.logEvent,
      queriesResponse,
      startExport,
      resetExport,
      streamingThreshold,
    ],

@@ -279,57 +294,108 @@ export const useExploreAdditionalActionsMenu = (
startExport,

Copilot AI Jan 21, 2026

Copy link

Choose a reason for hiding this comment

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

The dependency array is missing addDangerToast which is used in the catch block at lines 271 and 283. This could lead to stale closures where the function references an outdated version of addDangerToast. Add addDangerToast to the dependency array.

Suggested change
startExport,
startExport,
addDangerToast,

Copilot uses AI. Check for mistakes.
@bito-code-review

bito-code-review Bot commented Jan 22, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #0eaaee

Actionable Suggestions - 0
Additional Suggestions - 2
  • superset-frontend/src/explore/exploreUtils/exploreUtils.test.jsx - 2
    • Weakened test assertion · Line 450-454
      The test for streaming export removed the check that the onStartStreamingExport handler is called with expected arguments, which weakens test coverage for this code path. While the code currently works, the test no longer verifies the handler invocation.
    • Duplicate test case · Line 115-123
      The test 'getExploreUrl generate proper save slice url' is identical to the preceding 'getExploreUrl preserves main URLs params' test, leading to unnecessary duplication. Removing it will clean up the test suite without affecting functionality.
      Code suggestion
       @@ -115,9 +115,0 @@
      -test('getExploreUrl generate proper save slice url', () => {
      -  const url = getExploreUrl({
      -    formData,
      -    endpointType: 'json',
      -    force: false,
      -    curUrl: 'superset.com?foo=bar',
      -  });
      -  compareURI(URI(url), URI('/superset/explore_json/').search({ foo: 'bar' }));
      -});
Review Details
  • Files reviewed - 9 · Commit Range: ff0cbb2..791634b
    • superset-frontend/packages/superset-ui-core/src/connection/SupersetClient.ts
    • superset-frontend/packages/superset-ui-core/src/connection/SupersetClientClass.ts
    • superset-frontend/packages/superset-ui-core/src/connection/types.ts
    • superset-frontend/src/dashboard/components/gridComponents/Chart/Chart.jsx
    • superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/index.jsx
    • superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/useExploreAdditionalActionsMenu.test.jsx
    • superset-frontend/src/explore/exploreUtils/exploreUtils.test.jsx
    • superset-frontend/src/explore/exploreUtils/index.js
    • superset-frontend/src/utils/export.ts
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@rusackas

Copy link
Copy Markdown
Member

Thanks for the work thus far @Vansh5632. This has been open a while obviously, and has a bunch of conflicts and unresolved bot suggestions. Sorry for our slow turnaround on things (we're trying to close the gap and get the backlog under control). Let us know if you're still able to pick it back up, but I'll mark it as draft for now while it awaits work. Holler if I can help.

@rusackas
rusackas marked this pull request as draft June 10, 2026 01:56
@Vansh5632

Copy link
Copy Markdown
Contributor Author

Thanks for the update @rusackas . I completely understand the situation, and no worries about the turnaround time. I'll take a look at the merge conflicts and unresolved bot suggestions to see what I can resolve. Once I have addressed the issues and the PR is ready again, I'll let you know. I appreciate your support and will reach out if I need any help.

@Vansh5632
Vansh5632 marked this pull request as ready for review June 11, 2026 08:05
@dosubot dosubot Bot added explore Namespace | Anything related to Explore viz:charts:export Related to exporting charts labels Jun 11, 2026

@bito-code-review bito-code-review Bot left a comment •

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.

Code Review Agent Run #d807d9

Actionable Suggestions - 2
  • superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/index.tsx - 1
  • superset-frontend/packages/superset-ui-core/src/connection/SupersetClientClass.ts - 1
Additional Suggestions - 1
  • superset-frontend/packages/superset-ui-core/src/connection/SupersetClient.ts - 1
    • Missing test coverage for postBlob · Line 55-55
      The `postBlob` method is correctly exposed on the `SupersetClient` singleton and the interface contract is satisfied. However, the test file `SupersetClient.test.ts` does not include `postBlob` in its method-exposure assertions (lines 39-54) or pre-configure throw tests (lines 56-70), creating a gap in test coverage for this public API method.
Filtered by Review Rules

Bito filtered these suggestions based on rules created automatically for your feedback. Manage rules.

  • superset-frontend/src/utils/export.ts - 1
  • superset-frontend/src/explore/exploreUtils/exportChart.test.ts - 1
    • Incorrect regex in timestamp filename test · Line 450-450
Review Details
  • Files reviewed - 9 · Commit Range: f4ac865..a780f2b
    • superset-frontend/packages/superset-ui-core/src/connection/SupersetClient.ts
    • superset-frontend/packages/superset-ui-core/src/connection/SupersetClientClass.ts
    • superset-frontend/packages/superset-ui-core/src/connection/types.ts
    • superset-frontend/src/dashboard/components/gridComponents/Chart/Chart.tsx
    • superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/index.tsx
    • superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/useExploreAdditionalActionsMenu.test.jsx
    • superset-frontend/src/explore/exploreUtils/exportChart.test.ts
    • superset-frontend/src/explore/exploreUtils/index.ts
    • superset-frontend/src/utils/export.ts
  • Files skipped - 1
    • superset-frontend/package-lock.json - Reason: Filter setting
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Eslint (Linter) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Comment on lines +402 to +424
} catch (error) {
const exportError = error as Error & {
status?: number;
statusText?: string;
response?: { status?: number };
};
const status = exportError.status || exportError.response?.status;
if (status === 413) {
addDangerToast(
t(
'Export failed: The chart data is too large to download (413). Please try reducing the date range, limiting rows, or using fewer columns.',
),
);
} else {
const errorMessage =
exportError.message ||
exportError.statusText ||
t(
'Failed to export chart data. Please try again or contact your administrator.',
);
addDangerToast(errorMessage);
}
}

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.

Semantic duplication in error handling

The exportCSV function duplicates the same error handling logic that already exists in the handleExportError callback (lines 437-462). This creates semantic duplication and inconsistent error messages (note the 413 error message differs: 'Export failed: The chart data is too large to download (413).' vs 'The chart data is too large to download.'). Use handleExportError(error) instead.

Code Review Run #d807d9


Should Bito avoid suggestions like this for future reviews? (Manage Rules)

  • Yes, avoid them

Comment on lines +160 to +170
async postBlob(
endpoint: string,
payload: Record<string, any>,
): Promise<Response> {
await this.ensureAuth();
return this.post({
endpoint,
postPayload: payload,
parseMethod: 'raw',
});
}

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.

Missing Unit Tests for postBlob

The new postBlob method lacks unit tests. Rule [11730] requires comprehensive unit tests for new tools covering success paths, error scenarios, and edge cases. Compare with postForm which has tests at lines 668-775 in the same test file.

Code Review Run #d807d9


Should Bito avoid suggestions like this for future reviews? (Manage Rules)

  • Yes, avoid them

*/
async postBlob(
endpoint: string,
payload: Record<string, any>,

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.

Suggestion: Replace Record<string, any> with a stricter payload type (such as an existing reusable request payload type or Record<string, unknown>) so the new API method does not introduce any. [custom_rule]

Severity Level: Minor ⚠️

Why it matters? 🤔

The new postBlob method is TypeScript code and its payload parameter uses Record<string, any>, which directly introduces the any type. This matches the rule against new or modified TypeScript/TSX code using any, so the suggestion is valid.

Fix in Cursor | Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-frontend/packages/superset-ui-core/src/connection/SupersetClientClass.ts
**Line:** 162:162
**Comment:**
	*Custom Rule: Replace `Record<string, any>` with a stricter payload type (such as an existing reusable request payload type or `Record<string, unknown>`) so the new API method does not introduce `any`.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment on lines +444 to +493
const exportCSVPivoted = useCallback(async () => {
if (!canDownloadCSV) {
return null;
}
try {
await exportChart({
formData: latestQueryFormData as QueryFormData,
ownState,
resultType: 'post_processed',
resultFormat: 'csv',
});
} catch (error) {
handleExportError(error);
}
return null;
}, [canDownloadCSV, latestQueryFormData, ownState, handleExportError]);

const exportJson = useCallback(
() =>
canDownloadCSV
? exportChart({
formData: latestQueryFormData as QueryFormData,
ownState,
resultType: 'results',
resultFormat: 'json',
})
: null,
[canDownloadCSV, latestQueryFormData, ownState],
);
const exportJson = useCallback(async () => {
if (!canDownloadCSV) {
return null;
}
try {
await exportChart({
formData: latestQueryFormData as QueryFormData,
ownState,
resultType: 'results',
resultFormat: 'json',
});
} catch (error) {
handleExportError(error);
}
return null;
}, [canDownloadCSV, latestQueryFormData, ownState, handleExportError]);

const exportExcel = useCallback(
() =>
canDownloadCSV
? exportChart({
formData: latestQueryFormData as QueryFormData,
ownState,
resultType: 'results',
resultFormat: 'xlsx',
})
: null,
[canDownloadCSV, latestQueryFormData, ownState],
);
const exportExcel = useCallback(async () => {
if (!canDownloadCSV) {
return null;
}
try {
await exportChart({
formData: latestQueryFormData as QueryFormData,
ownState,
resultType: 'results',
resultFormat: 'xlsx',
});
} catch (error) {
handleExportError(error);
}
return null;
}, [canDownloadCSV, latestQueryFormData, ownState, handleExportError]);

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.

🟠 Architect Review — HIGH

The error-handling coverage in Explore is incomplete: the "Export Current View → Export to .CSV" server path calls exportChart(...) without awaiting or wrapping it in try/catch, so HTTP 413 and other export failures reject the Promise without showing the new user-friendly toast.

Suggestion: Mirror the pattern used by exportCSV/exportCSVPivoted/exportJson/exportExcel by making the current-view CSV server path async, awaiting exportChart, and routing any caught errors through handleExportError so 413 and other failures consistently surface as toasts.

Fix in Cursor | Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is an **Architect / Logical Review** comment left during a code review. These reviews are first-class, important findings — not optional suggestions. Do NOT dismiss this as a 'big architectural change' just because the title says architect review; most of these can be resolved with a small, localized fix once the intent is understood.

**Path:** superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/index.tsx
**Line:** 444:493
**Comment:**
	*HIGH: The error-handling coverage in Explore is incomplete: the "Export Current View → Export to .CSV" server path calls exportChart(...) without awaiting or wrapping it in try/catch, so HTTP 413 and other export failures reject the Promise without showing the new user-friendly toast.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
If a suggested approach is provided above, use it as the authoritative instruction. If no explicit code suggestion is given, you MUST still draft and apply your own minimal, localized fix — do not punt back with 'no suggestion provided, review manually'. Keep the change as small as possible: add a guard clause, gate on a loading state, reorder an await, wrap in a conditional, etc. Do not refactor surrounding code or expand scope beyond the finding.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix

Comment on lines +408 to +416
const extension = resultFormat === 'xlsx' ? 'xlsx' : resultFormat;
const timestamp = new Date()
.toISOString()
.replace(/[:.]/g, '-')
.slice(0, -5);
const filename = `chart_export_${timestamp}.${extension}`;

const blob = await response.blob();
downloadBlob(blob, filename);

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.

🟠 Architect Review — HIGH

The download filename is now derived solely from the requested resultFormat, which ignores the actual response type; for multi-query table-like exports the backend returns a ZIP (Content-Type application/zip and "zip" download headers), so the frontend saves ZIP content with a .csv/.xlsx extension.

Suggestion: Inspect response headers (Content-Disposition/Content-Type) before naming the file, using a .zip extension and/or server-provided filename when the backend bundles multi-query results as a ZIP, and only fall back to the resultFormat-derived extension when no explicit type is provided.

Fix in Cursor | Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is an **Architect / Logical Review** comment left during a code review. These reviews are first-class, important findings — not optional suggestions. Do NOT dismiss this as a 'big architectural change' just because the title says architect review; most of these can be resolved with a small, localized fix once the intent is understood.

**Path:** superset-frontend/src/explore/exploreUtils/index.ts
**Line:** 408:416
**Comment:**
	*HIGH: The download filename is now derived solely from the requested resultFormat, which ignores the actual response type; for multi-query table-like exports the backend returns a ZIP (Content-Type application/zip and "zip" download headers), so the frontend saves ZIP content with a .csv/.xlsx extension.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
If a suggested approach is provided above, use it as the authoritative instruction. If no explicit code suggestion is given, you MUST still draft and apply your own minimal, localized fix — do not punt back with 'no suggestion provided, review manually'. Keep the change as small as possible: add a guard clause, gate on a loading state, reorder an await, wrap in a conditional, etc. Do not refactor surrounding code or expand scope beyond the finding.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix

Comment on lines +165 to +169
return this.post({
endpoint,
postPayload: payload,
parseMethod: 'raw',
});

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.

Suggestion: postBlob forwards postPayload without overriding the default stringify: true, so string fields are JSON-stringified again by callApi. Export callers already pass form_data as a JSON string, which becomes double-encoded (extra quotes), and the backend then parses it as a string instead of an object, causing export requests to fail (typically 400) instead of downloading. Pass stringify: false (or send a prebuilt FormData) to preserve raw form field values. [api mismatch]

Severity Level: Critical 🚨
- ❌ Dashboard chart CSV export returns HTTP 400, no download.
- ❌ Explore view chart exports fail against /api/v1/chart/data.
- ⚠️ Users see error toasts instead of downloaded export files.
Steps of Reproduction ✅
1. Open a dashboard and trigger CSV export for a chart; tests at
`superset-frontend/src/dashboard/components/gridComponents/Chart/Chart.test.tsx:8-31` show
that clicking "Export to .CSV" calls `exportChart(...)` from
`src/explore/exploreUtils/index.ts`.

2. In
`superset-frontend/src/dashboard/components/gridComponents/Chart/Chart.tsx:19-37,559-567`,
the `exportChart` function is invoked with `resultFormat: 'csv'` and `resultType: 'full'`,
and `onStartStreamingExport` left as `null`, so the non-streaming export path is used.

3. Inside `superset-frontend/src/explore/exploreUtils/index.ts:18-69`, `exportChart`
builds the payload and, for the v1 API (`url = '/api/v1/chart/data'`), calls
`SupersetClient.postBlob(url as string, { form_data: safeStringify(payload) })` at lines
41-47 and 65-67, where `safeStringify` (see
`plugins/preset-chart-deckgl/src/utils/safeStringify.ts:4-24`) returns a JSON string.

4. `SupersetClient.postBlob` in
`packages/superset-ui-core/src/connection/SupersetClientClass.ts:160-169` forwards this
payload via `this.post({ endpoint, postPayload: payload, parseMethod: 'raw' })` without
specifying `stringify`, so `request` flows into `callApiAndParseWithTimeout` and then
`callApi` in `packages/superset-ui-core/src/connection/callApi/callApi.ts:8-23,80-100`,
where `stringify` defaults to `true` and each form field value is transformed with
`valueString = stringify ? JSON.stringify(value) : String(value)`, causing `form_data`
(already a JSON string) to be JSON-stringified again and sent as `'"{...}"'` in the
multipart form body.

5. On the backend, `superset/charts/data/api.py:47-55` handles `/api/v1/chart/data` POST
requests by checking `request.form.get("form_data")` and running
`json.loads(request.form["form_data"])`; with the double-encoded payload this produces a
plain string instead of a dict, so `_create_query_context_from_form` (which expects a
dict, see `superset/tasks/async_queries.py:1-14`) raises a `ValidationError`, and
`ChartDataRestApi.data` catches this and returns `self.response_400(...)`, causing the
chart export HTTP 400 error and preventing the file from downloading.

Fix in Cursor | Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-frontend/packages/superset-ui-core/src/connection/SupersetClientClass.ts
**Line:** 165:169
**Comment:**
	*Api Mismatch: `postBlob` forwards `postPayload` without overriding the default `stringify: true`, so string fields are JSON-stringified again by `callApi`. Export callers already pass `form_data` as a JSON string, which becomes double-encoded (extra quotes), and the backend then parses it as a string instead of an object, causing export requests to fail (typically 400) instead of downloading. Pass `stringify: false` (or send a prebuilt `FormData`) to preserve raw form field values.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

@bito-code-review

bito-code-review Bot commented Jun 12, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #c9aadf

Actionable Suggestions - 0
Filtered by Review Rules

Bito filtered these suggestions based on rules created automatically for your feedback. Manage rules.

  • superset-frontend/packages/superset-ui-core/test/connection/SupersetClientClass.test.ts - 1
  • superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/useExploreAdditionalActionsMenu.test.jsx - 1
Review Details
  • Files reviewed - 5 · Commit Range: a780f2b..3824405
    • superset-frontend/packages/superset-ui-core/test/connection/SupersetClient.test.ts
    • superset-frontend/packages/superset-ui-core/test/connection/SupersetClientClass.test.ts
    • superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/index.tsx
    • superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/useExploreAdditionalActionsMenu.test.jsx
    • superset-frontend/src/explore/exploreUtils/exportChart.test.ts
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Eslint (Linter) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@rusackas rusackas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Vansh5632 still shows conflicts and a few unrelated package-lock.json changes have crept in, and frontend-build/pre-commit are red. I'll see if I can help with a rebase to move this forward... the export logic itself reads fine.

Comment on lines +406 to +408
const response = await SupersetClient.postBlob(url as string, {
form_data: safeStringify(payload),
});

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.

Suggestion: form_data is being pre-serialized with safeStringify, but SupersetClient.postBlob() sends postPayload through callApi, which JSON-stringifies each form field again. This double-encodes the payload (e.g. "\"{...}\""), so backend form parsing receives a string instead of an object and can fail when accessing expected keys. Pass the raw payload object (or disable form-field stringification for this request) to keep request format compatible with existing chart export endpoints. [api mismatch]

Severity Level: Critical 🚨
- ❌ Explore JSON/CSV/XLSX exports raise 500 on parse.
- ❌ Backend /explore_json endpoint crashes on form_data access.
- ⚠️ Dashboard chart exports using legacy path likely fail.
Steps of Reproduction ✅
1. Trigger a chart data export (e.g. CSV/XLSX/JSON) from Explore so the frontend calls
`exportChart(...)` in `superset-frontend/src/explore/exploreUtils/index.ts` (function
starting around line 360). Because `onStartStreamingExport` is falsy, execution enters the
`else` branch and sends a POST via `SupersetClient.postBlob(url as string, { form_data:
safeStringify(payload) })` at lines 406–408.

2. `SupersetClient.postBlob` is implemented in
`superset-frontend/packages/superset-ui-core/src/connection/SupersetClientClass.ts` lines
41–50, where it calls `this.post({ endpoint, postPayload: payload, parseMethod: 'raw' })`.
That in turn calls `request(...)` in the same file, which invokes
`callApiAndParseWithTimeout` at lines 222–235.

3. `callApiAndParseWithTimeout` in
`superset-frontend/packages/superset-ui-core/src/connection/callApi/callApiAndParseWithTimeout.ts`
lines 25–38 delegates to `callApi(rest)`, implemented in
`superset-frontend/packages/superset-ui-core/src/connection/callApi/callApi.ts` lines
63–78. Because the method is POST and `postPayload` is an object, the block at lines
135–171 builds a `FormData` body. For the `form_data` key whose value is already a JSON
string from `safeStringify(payload)`, the code executes `JSON.stringify(value)` at line
155, producing a double-encoded string such as `"\"{...}\""` that is appended to the form
data (lines 146–166).

4. On the backend, chart requests are parsed by `get_form_data()` in
`superset/views/utils.py` lines 202–236. It reads `request.form.get("form_data")` into
`request_form_data` at line 221 and passes it to `loads_request_json()` at lines 195–199,
which calls `json.loads` once. For the double-encoded `"\"{...}\""` value, `json.loads`
returns a plain string instead of a dict. `get_form_data` then executes
`parsed_form_data.get("queries")` at line 228, but since `parsed_form_data` is a string,
this raises `AttributeError: 'str' object has no attribute 'get'`, causing chart export
endpoints like `explore_json` in `superset/views/core.py` lines 297–80 (and
`/api/v1/chart/data` when using form-data) to fail with a 500 instead of returning the
requested export file.

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-frontend/src/explore/exploreUtils/index.ts
**Line:** 406:408
**Comment:**
	*Api Mismatch: `form_data` is being pre-serialized with `safeStringify`, but `SupersetClient.postBlob()` sends `postPayload` through `callApi`, which JSON-stringifies each form field again. This double-encodes the payload (e.g. `"\"{...}\""`), so backend form parsing receives a string instead of an object and can fail when accessing expected keys. Pass the raw `payload` object (or disable form-field stringification for this request) to keep request format compatible with existing chart export endpoints.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment on lines +467 to +471
formData: latestQueryFormData as QueryFormData,
ownState,
resultType: 'results',
resultFormat: 'json',
});

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.

Suggestion: The "Export All Data → JSON" path now calls the API with resultType: 'results', which returns only the current-view/result subset instead of the full dataset. This breaks the "all data" contract and can silently truncate exports; use the full-export result type for this menu action. [logic error]

Severity Level: Critical 🚨
- ❌ Explore "Export All Data → JSON" returns partial dataset.
- ❌ JSON export semantics differ from CSV full-data export.
- ⚠️ Users may trust truncated JSON as complete data.
Steps of Reproduction ✅
1. Open the Explore view for any chart; the Explore header uses
`useExploreAdditionalActionsMenu` from
`superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/index.tsx` to
build the "Data Export Options" menu (see menu construction around lines 208–230 in the
tool output).

2. In `useExploreAdditionalActionsMenu`, the "Export All Data" submenu is defined with
children that include an item labeled `t('Export to .JSON')` whose `onClick` handler calls
`exportJson()` (lines 32–47 in the menu snippet at the bottom of `index.tsx` as returned
by the BulkRead tool).

3. The `exportJson` callback is defined earlier in the same file at lines 162–177 (tool
output): it calls `exportChart({ formData: latestQueryFormData as QueryFormData, ownState,
resultType: 'results', resultFormat: 'json' })`, which is precisely the snippet at lines
467–471 in the PR diff.

4. In `superset-frontend/src/explore/exploreUtils/index.ts` lines 19–49, `exportChart`
forwards `resultType` into the v1 `/api/v1/chart/data` payload; elsewhere in
`useExploreAdditionalActionsMenu` the "Export Current View → CSV" path explicitly
documents that `resultType: 'results'` is used "to export the *current view* (as opposed
to 'full')". Therefore, clicking "Data Export Options → Export All Data → Export to .JSON"
invokes the current-view export mode rather than the full export mode, causing the
exported JSON to include only the current results instead of the full dataset whenever
those differ.

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/index.tsx
**Line:** 467:471
**Comment:**
	*Logic Error: The "Export All Data → JSON" path now calls the API with `resultType: 'results'`, which returns only the current-view/result subset instead of the full dataset. This breaks the "all data" contract and can silently truncate exports; use the full-export result type for this menu action.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment on lines +484 to +488
formData: latestQueryFormData as QueryFormData,
ownState,
resultType: 'results',
resultFormat: 'xlsx',
});

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.

Suggestion: The "Export All Data → Excel" flow also uses resultType: 'results', so it exports the current result slice rather than the full dataset expected by the menu label. This creates inconsistent behavior versus CSV all-data export and causes partial Excel downloads. [logic error]

Severity Level: Critical 🚨
- ❌ "Export All Data → Excel" omits expected rows.
- ❌ Excel export behavior inconsistent with CSV full export.
- ⚠️ Analysts may misinterpret incomplete Excel downloads.
Steps of Reproduction ✅
1. Open the Explore view for any chart; the Explore header wires in
`useExploreAdditionalActionsMenu` from
`superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/index.tsx` to
populate the "Data Export Options → Export All Data" submenu (see menu items pushed into
`allDataChildren` at lines 32–85 in the tool output).

2. For the "Export All Data → Export to Excel" item, the `onClick` handler calls
`exportExcel()` (lines 71–85 of the menu snippet in `index.tsx`), which is specifically
used under the "Export All Data" group, not the "Export Current View" group.

3. The `exportExcel` callback is defined earlier in the same file at lines 179–194 (tool
output): it calls `exportChart({ formData: latestQueryFormData as QueryFormData, ownState,
resultType: 'results', resultFormat: 'xlsx' })`, matching the PR diff snippet at lines
484–488.

4. In contrast, the "Export All Data → Export to .CSV" path in `index.tsx` uses
`exportChart` with `resultType: 'full'` (lines 70–143), while the "Export Current View →
CSV" current-view path explicitly uses `resultType: 'results'` and comments that
`'results'` corresponds to exporting the *current view* rather than the full dataset.
Because the Excel all-data item reuses `resultType: 'results'`, clicking "Export All Data
→ Export to Excel" exports only the current-view slice instead of the full dataset,
leading to partial Excel files whenever the current view is a subset of the full data.

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/index.tsx
**Line:** 484:488
**Comment:**
	*Logic Error: The "Export All Data → Excel" flow also uses `resultType: 'results'`, so it exports the current result slice rather than the full dataset expected by the menu label. This creates inconsistent behavior versus CSV all-data export and causes partial Excel downloads.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

@bito-code-review

bito-code-review Bot commented Jun 23, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #ac6759

Actionable Suggestions - 0
Filtered by Review Rules

Bito filtered these suggestions based on rules created automatically for your feedback. Manage rules.

  • superset-frontend/src/explore/exploreUtils/exportChart.test.ts - 2
Review Details
  • Files reviewed - 8 · Commit Range: 3824405..4d1517e
    • superset-frontend/packages/superset-ui-core/src/connection/SupersetClientClass.ts
    • superset-frontend/packages/superset-ui-core/test/connection/SupersetClientClass.test.ts
    • superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/index.tsx
    • superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/useExploreAdditionalActionsMenu.test.jsx
    • superset-frontend/src/explore/exploreUtils/exportChart.test.ts
    • superset-frontend/src/explore/exploreUtils/index.ts
    • superset-frontend/src/utils/export.test.ts
    • superset-frontend/src/utils/export.ts
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Eslint (Linter) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Translation Regression Detected

A source change in this PR renamed or reworded strings, invalidating existing translations (they are now #, fuzzy) in fr. Please resolve the affected .po files before merging.

Note: intentionally deleting a translatable string is not a regression and is not flagged here — only translations invalidated by a renamed/reworded source string are.

Language Fuzzy before Fuzzy after New
fr 1004 1014 +10

How to fix

1. Install dependencies (if not already set up):

pip install -r superset/translations/requirements.txt
sudo apt-get install gettext   # or: brew install gettext

2. Re-extract strings and sync .po files:

./scripts/translations/babel_update.sh

This rewrites superset/translations/messages.pot from the current source files and merges the changes into every .po file. Strings whose msgid changed will be marked #, fuzzy.

3. Resolve the fuzzy entries in the affected language files (fr):

grep -n '#, fuzzy' superset/translations/<lang>/LC_MESSAGES/messages.po

For each fuzzy entry, either rewrite the msgstr to match the new string and remove the #, fuzzy line, or clear the msgstr to "" if you cannot provide a translation.

4. Commit your changes to the .po files.

@codecov

codecov Bot commented Jun 24, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 78.43137% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.42%. Comparing base (a57b5f6) to head (502986a).

Files with missing lines Patch % Lines
...ashboard/components/gridComponents/Chart/Chart.tsx 25.00% 12 Missing ⚠️
...mponents/useExploreAdditionalActionsMenu/index.tsx 80.43% 9 Missing ⚠️
...uperset-frontend/src/explore/exploreUtils/index.ts 95.45% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master   #37131   +/-   ##
=======================================
  Coverage   64.42%   64.42%           
=======================================
  Files        2654     2654           
  Lines      145386   145434   +48     
  Branches    33557    33569   +12     
=======================================
+ Hits        93658    93697   +39     
- Misses      50031    50040    +9     
  Partials     1697     1697           
Flag Coverage Δ
javascript 68.75% <78.43%> (+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.

Rebased onto current master to clear a stale-base translation
regression in the babel-extract check.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@rusackas
rusackas force-pushed the fix/http-413-chart-export-error-handling branch from 4d1517e to 86094c2 Compare June 24, 2026 08:37
Rename useExploreAdditionalActionsMenu.test.jsx to .test.tsx and add
proper typing, aligning with the all-TypeScript frontend convention.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@rusackas rusackas added the merge-if-green If approved and tests are green, please go ahead and merge it for me label Jun 24, 2026
@bito-code-review

bito-code-review Bot commented Jun 24, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #f522b6

Actionable Suggestions - 0
Additional Suggestions - 1
  • superset-frontend/src/explore/exploreUtils/exportChart.test.ts - 1
    • Missing defensive mock · Line 412-412
      The test at line 409 calls `exportChart` with `onStartStreamingExport` but does not mock `SupersetClient.postBlob`. If the implementation is refactored to call `postBlob` in this path, the test would fail with an unhandled promise rejection. While the current implementation correctly skips `postBlob` when streaming is enabled, defensive mocking prevents future regressions.
      Code suggestion
       @@ -411,1 +411,5 @@
         const mockStreamingHandler = jest.fn();
      + SupersetClient.postBlob.mockResolvedValue({
      +   blob: jest.fn().mockResolvedValue(new Blob()),
      + });
         await exportChart({
Review Details
  • Files reviewed - 12 · Commit Range: 86094c2..502986a
    • superset-frontend/packages/superset-ui-core/src/connection/SupersetClient.ts
    • superset-frontend/packages/superset-ui-core/src/connection/SupersetClientClass.ts
    • superset-frontend/packages/superset-ui-core/src/connection/types.ts
    • superset-frontend/packages/superset-ui-core/test/connection/SupersetClient.test.ts
    • superset-frontend/packages/superset-ui-core/test/connection/SupersetClientClass.test.ts
    • superset-frontend/src/dashboard/components/gridComponents/Chart/Chart.tsx
    • superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/index.tsx
    • superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/useExploreAdditionalActionsMenu.test.tsx
    • superset-frontend/src/explore/exploreUtils/exportChart.test.ts
    • superset-frontend/src/explore/exploreUtils/index.ts
    • superset-frontend/src/utils/export.test.ts
    • superset-frontend/src/utils/export.ts
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Eslint (Linter) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@rusackas
rusackas merged commit 6f12d17 into apache:master Jun 24, 2026
66 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:frontend Requires changing the frontend explore Namespace | Anything related to Explore merge-if-green If approved and tests are green, please go ahead and merge it for me packages size/XL viz:charts:export Related to exporting charts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chart download shows raw JSON 413 error instead of user-friendly message when request payload is too large

4 participants