fix(tables): route large CSV imports to the background job instead of 413#4927
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview In On the tables list, bulk CSV upload splits large vs small files: async imports use Reviewed by Cursor Bugbot for commit a821d4c. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit fcc28f7. Configure here.
|
@greptile review |
Greptile SummaryThis PR restores size-based dispatch for CSV imports that was dropped in a prior refactor, fixing 413 errors for files ≥8 MB. Large files are uploaded directly to storage (bypassing the 10 MB proxy cap) and imported via the existing background worker; small files keep the synchronous POST path unchanged.
Confidence Score: 5/5Safe to merge — the bug fix is well-contained, the async dispatch path reuses the existing background worker, and the sync path is unchanged. The size-based routing logic is straightforward, the tray/cancel wiring mirrors the pattern already used elsewhere in the codebase, and the removal of client-side row-limit checks is intentional (server enforces via DB trigger). No incorrect state transitions, missing guards, or data-loss paths were found. No files require special attention; the two suggestions in import-csv-dialog.tsx are minor correctness polish. Important Files Changed
Reviews (3): Last reviewed commit: "fix(tables): guard importId on async can..." | Re-trigger Greptile |
Greptile SummaryThis PR re-introduces the size-based dispatch that was dropped in a prior refactor: files ≥ 8 MB are uploaded directly to storage and imported via the background worker (bypassing the 10 MB proxy cap), while smaller files continue to use the synchronous path. The preview parse is capped at 512 KB so large files are never fully read on the main thread, and
Confidence Score: 3/5The core routing fix is solid, but the async error path surfaces two toast notifications on failure in both changed files. The double-toast bug is present on both the list-view upload and the dialog async path: when an upload fails, users see two separate error messages every time. This is a real, reproducible defect on the new code path. tables.tsx — the catch block inside the asyncFiles loop and the mutation's onError both call toast.error; import-csv-dialog.tsx — the inline onError passed to importAsyncMutation.mutate and the hook's onError do the same. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User selects CSV] --> B{File size}
B -->|ge 8 MB async path| C[Upload direct to storage]
B -->|lt 8 MB sync path| D[POST via proxy]
C --> C1[Kickoff background worker]
C1 --> C2[ImportProgressMenu tray tracks progress]
C1 --> C4{Error?}
C4 -->|Yes| C5[endUpload + double toast warning]
C4 -->|No| C2
D --> D2{Error?}
D2 -->|Yes| D3[submitError in dialog]
D2 -->|No| D4[Toast success]
A2[Open ImportCsvDialog] --> P1[parseCsvPreview 512 KB slice]
P1 --> P2[Show mapping UI]
P2 --> B2{File size}
B2 -->|ge 8 MB| C
B2 -->|lt 8 MB| D
Reviews (2): Last reviewed commit: "fix(tables): drop duplicate error toast ..." | Re-trigger Greptile |
|
@greptile review |

Summary
ImportProgressMenutray in the tables list view for live background-import progress.0/1); plain "importing in the background" toast.Type of Change
Testing
Tested manually — imported a 10MB CSV (background job kicks off, no 413, tray shows progress) and a small CSV (sync path, header counter).
bun run lintandbun run check:api-validation:strictpass.Checklist