Open
Conversation
Add client-side validation to reject files exceeding 20MB before sending to the API, preventing GPU timeouts from oversized uploads. - Add FILE_TOO_LARGE error code and createFileTooLargeError factory - Add MAX_FILE_SIZE constant (20MB) in shared request module - Validate file size after blob conversion in both process and queue APIs - Skip validation for React Native files that lack .size property - Add unit tests for size limit enforcement
commit: |
Add optional maxFileSize field to ModelDefinition so models can override the default 20MB limit. lucy-restyle-v2v (longform video) gets a 100MB limit while all other models keep the 20MB default.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
FILE_TOO_LARGEerror code andcreateFileTooLargeError()factory function.size)Changes
src/utils/errors.ts— New error code + factorysrc/shared/request.ts—MAX_FILE_SIZEconstant, size validation infileInputToBlob()src/process/client.ts— Pass field name tofileInputToBlob()for error messagessrc/queue/client.ts— Pass field name tofileInputToBlob()for error messagestests/unit.test.ts— 4 new tests (over/at/under limit for process + queue)Testing
Note
Medium Risk
Changes input processing for both
processandqueueAPIs by adding size checks that can cause previously-accepted requests to fail before hitting the server; React Native uploads bypass size validation.Overview
Adds client-side upload size validation in the SDK by enforcing a default 20MB limit on all file-like inputs after conversion to a
BlobinfileInputToBlob, raising a newFILE_TOO_LARGEDecartSDKErrorwith field-specific messaging.Introduces an optional per-model
maxFileSizeoverride (wired through bothprocessandqueueclients) and setslucy-restyle-v2vto 100MB. Unit tests are expanded to cover reject/accept behavior at the boundary for both APIs and the per-model override.Written by Cursor Bugbot for commit 47ac803. This will update automatically on new commits. Configure here.