feat: Add PWA file handler for CSV/XLS/Parquet uploads#36191
Conversation
01bff52 to
3867b87
Compare
3867b87 to
1ceb7b4
Compare
d8540f3 to
44e08de
Compare
44e08de to
0e0589c
Compare
|
CodeAnt AI is reviewing your PR. |
|
CodeAnt AI finished reviewing your PR. |
💡 Enhance Your PR ReviewsWe noticed that 3 feature(s) are not configured for this repository. Enabling these features can help improve your code quality and workflow: 🚦 Quality GatesStatus: Quality Gates are not enabled at the organization level 🎫 Jira Ticket ComplianceStatus: Jira credentials file not found. Please configure Jira integration in your settings ⚙️ Custom RulesStatus: No custom rules configured. Add rules via organization settings or .codeant/review.json in your repository Want to enable these features? Contact your organization admin or check our documentation for setup instructions. |
b603f99 to
44d2515
Compare
fb79e10 to
04b9a3e
Compare
04b9a3e to
b1c1ca1
Compare
|
LGTM! Not sure if SVG is supported, but that'd be neat to not require more flavors of logo file. Not sure if the the screenshot image can just link to the one(s) from the readme/docs, but the goal is to automate those so they're always current, in the near future. Barring the above, rebase and go for it! |
- Change route from /file-handler to /superset/file-handler to match Flask blueprint - Add Service-Worker-Allowed header for root scope registration - Add proper square icons (192x192, 512x512) for PWA install - Add wide and narrow screenshots for PWA install prompt - Update tests to use new route path 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add webworker lib reference for ServiceWorkerGlobalScope types - Fix UploadFile type casting for fileListOverride - Fix window type assertion with unknown intermediate cast - Add required properties to error file handle mock 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The webworker lib reference was adding ServiceWorker types globally, which conflicted with useBeforeUnload test. Use local type declarations instead. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
04b9a3e to
d1c1a7d
Compare
Code Review Agent Run #693f87Actionable Suggestions - 0Additional Suggestions - 3
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
|
|
||
| let type: 'csv' | 'excel' | 'columnar' | null = null; | ||
| let extensions: string[] = []; | ||
|
|
||
| if (fileName.endsWith('.csv')) { | ||
| type = 'csv'; | ||
| extensions = ['csv']; | ||
| } else if (fileName.endsWith('.xls') || fileName.endsWith('.xlsx')) { | ||
| type = 'excel'; | ||
| extensions = ['xls', 'xlsx']; | ||
| } else if (fileName.endsWith('.parquet')) { | ||
| type = 'columnar'; | ||
| extensions = ['parquet']; |
There was a problem hiding this comment.
Suggestion: The file type detection logic only recognizes .csv, .xls, .xlsx, and .parquet extensions, ignoring other formats that the existing upload modal already supports (notably .tsv for delimited text and .zip for columnar uploads). This causes a valid TSV or zipped columnar file that can be uploaded via the standard UI to be rejected as "Unsupported file type" when opened via the PWA file handler, leading to inconsistent behavior between entry points. [logic error]
Severity Level: Major ⚠️
- ❌ PWA file-launch rejects .tsv desktop uploads.
- ❌ PWA file-launch rejects zipped columnar (.zip) uploads.
- ⚠️ Inconsistent behavior vs UploadDataModal (upload UI).
- ⚠️ User-facing redirect to welcome page on open.| let type: 'csv' | 'excel' | 'columnar' | null = null; | |
| let extensions: string[] = []; | |
| if (fileName.endsWith('.csv')) { | |
| type = 'csv'; | |
| extensions = ['csv']; | |
| } else if (fileName.endsWith('.xls') || fileName.endsWith('.xlsx')) { | |
| type = 'excel'; | |
| extensions = ['xls', 'xlsx']; | |
| } else if (fileName.endsWith('.parquet')) { | |
| type = 'columnar'; | |
| extensions = ['parquet']; | |
| const extension = fileName.split('.').pop() || ''; | |
| let type: 'csv' | 'excel' | 'columnar' | null = null; | |
| let extensions: string[] = []; | |
| if (extension === 'csv' || extension === 'tsv') { | |
| type = 'csv'; | |
| // Match the CSV behavior in UploadDataModal (supports csv and tsv) | |
| extensions = ['csv', 'tsv']; | |
| } else if (extension === 'xls' || extension === 'xlsx') { | |
| type = 'excel'; | |
| extensions = ['xls', 'xlsx']; | |
| } else if (extension === 'parquet' || extension === 'zip') { | |
| // Columnar uploads also support zipped files | |
| type = 'columnar'; | |
| extensions = ['parquet', 'zip']; |
Steps of Reproduction ✅
1. Navigate to the PWA file-handler route (the component is mounted at
/superset/file-handler and defined in superset-frontend/src/pages/FileHandler/index.tsx).
The launchQueue consumer is registered in useEffect at lines 52-112, specifically
launchQueue.setConsumer(...) at lines 66-108.
2. From the desktop, open a supported-but-unchecked file type (example: a tab-separated
file test.tsv or a zipped columnar file test.zip). The OS will invoke the PWA and the
LaunchQueue consumer receives the file handle; the consumer callback receives launchParams
and executes the code starting at line 73 (const fileHandle = launchParams.files[0];).
3. FileHandler reads the File object via fileHandle.getFile() (line 74) and computes
fileName at line 75. The current logic checks
fileName.endsWith('.csv'/.xls/.xlsx/.parquet) (lines 80-88) and will not match '.tsv' or
'.zip'.
4. Because '.tsv' and '.zip' are not recognized, the else branch at lines 89-97 runs: a
danger toast is added with the message 'Unsupported file type...' and the user is
redirected to '/superset/welcome/' (lines 90-96). The upload modal is never opened.
5. Contrast with the existing UploadDataModal behavior: allowedExtensionsToAccept includes
'.tsv' for csv and '.zip' for columnar at src/features/databases/UploadDataModel/index.tsx
lines 166-170, and validateUploadFileExtension (lines 178-192) accepts those extensions.
This shows the FileHandler rejection is inconsistent with the modal's supported
extensions.
6. Reproduced in tests: the component tests in
superset-frontend/src/pages/FileHandler/index.test.tsx simulate launchQueue file handles
and expect the modal to open for various extensions (see tests for csv/xls/xlsx/parquet).
Adding a test case for 'test.tsv' or 'test.zip' will fail with the current FileHandler
logic (it will trigger the unsupported-file branch).Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** superset-frontend/src/pages/FileHandler/index.tsx
**Line:** 76:88
**Comment:**
*Logic Error: The file type detection logic only recognizes `.csv`, `.xls`, `.xlsx`, and `.parquet` extensions, ignoring other formats that the existing upload modal already supports (notably `.tsv` for delimited text and `.zip` for columnar uploads). This causes a valid TSV or zipped columnar file that can be uploaded via the standard UI to be rejected as "Unsupported file type" when opened via the PWA file handler, leading to inconsistent behavior between entry points.
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.
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Bito Automatic Review Skipped – PR Already Merged |
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Cover remaining 6.1 features across existing and new pages: MCP server: - Add MCP_PARSE_REQUEST_ENABLED to configuration reference - Add Audit Events section (MCP tool calls appear in Action Log) - Add Tool Pagination section documenting cursor-based pagination (#37674) Using AI with Superset: - Expand Available Tools Reference into categorized sections covering all new tools added in the MCP tool library expansion - Document preview-first workflow for generate_chart / update_chart Creating Your First Dashboard: - AG Grid server-side column filters (#35683): filter types, AND/OR logic, pagination interaction - Time Shift for AG Grid Interactive Table (#37072) - Dynamic currency formatting via currency_code_column dataset field (#36416) - ECharts option editor in Explore for JSON overrides (#37868) - Table chart: export behavior with search filter active (#36281) - Dataset folders: organizing datasets into groups (#36239) - PWA file handler: opening CSV/XLS/Parquet from OS file manager (#36191) - Share database connection option when adding a new database (#37940) Exploring Data: - Dialect-aware Format SQL (applies selected database dialect) (#39393) - SQL Lab tips section and time range natural language expressions (consolidates content from batch 4 for master branch) Importing/Exporting: - Dashboard import overwrite behavior: charts are replaced not duplicated (#36551) - UUID in REST API POST responses for dataset/chart/dashboard (#37806) New pages: - docs/docs/using-superset/embedding.mdx: embedded SDK quick start, resolvePermalinkUrl callback (#36924), DISABLE_EMBEDDED_SUPERSET_LOGOUT feature flag (#37537), URL parameters, guest token security notes - docs/admin_docs/configuration/aws-iam.mdx: cross-account IAM authentication for Aurora and Redshift via STS AssumeRole (#37585), configuration reference, trust policy setup guide Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
User description
SUMMARY
Make Superset a progressive web app (PWA) by adding a manifest file.
Also add functionality to allow CSV/XLS/Parquet file uploads from the desktop.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION
CodeAnt-AI Description
Add PWA install and desktop file-handler for CSV/Excel/Parquet
What Changed
Impact
✅ Installable desktop app via browser PWA prompt✅ Open CSV/Excel/Parquet files from desktop into Superset upload flow✅ Clearer errors and consistent redirect when file handling fails or is unsupported💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.