Skip to content

feat: add 20MB file size limit for uploads#82

Open
AdirAmsalem wants to merge 2 commits intomainfrom
feat/file-size-limit
Open

feat: add 20MB file size limit for uploads#82
AdirAmsalem wants to merge 2 commits intomainfrom
feat/file-size-limit

Conversation

@AdirAmsalem
Copy link
Contributor

@AdirAmsalem AdirAmsalem commented Feb 12, 2026

Summary

  • Add client-side validation to reject files exceeding 20MB before sending to the API, preventing GPU timeouts from oversized video uploads (Lucy Edit Pro v2v supports up to 5s input)
  • Add FILE_TOO_LARGE error code and createFileTooLargeError() factory function
  • Validate file size after blob conversion in both process and queue APIs (skips React Native files lacking .size)

Changes

  • src/utils/errors.ts — New error code + factory
  • src/shared/request.tsMAX_FILE_SIZE constant, size validation in fileInputToBlob()
  • src/process/client.ts — Pass field name to fileInputToBlob() for error messages
  • src/queue/client.ts — Pass field name to fileInputToBlob() for error messages
  • tests/unit.test.ts — 4 new tests (over/at/under limit for process + queue)

Testing

  • 91 tests passing
  • Typecheck clean
  • Biome format clean

Note

Medium Risk
Changes input processing for both process and queue APIs 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 Blob in fileInputToBlob, raising a new FILE_TOO_LARGE DecartSDKError with field-specific messaging.

Introduces an optional per-model maxFileSize override (wired through both process and queue clients) and sets lucy-restyle-v2v to 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.

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
@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 12, 2026

Open in StackBlitz

npm i https://pkg.pr.new/DecartAI/sdk/@decartai/sdk@82

commit: 47ac803

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant