Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: remove bloat from large files during upload (WIP) #21757

Merged
merged 47 commits into from
Apr 27, 2023

Conversation

ayushpahwa
Copy link
Contributor

@ayushpahwa ayushpahwa commented Mar 24, 2023

Description

Currently, we try to upload large files by converting their binaries into strings which leads to bloat in size. This is because converting to bytes in a multi-byte encoding usually takes a larger space and white characters are also included. We were also doing multiple modifications which were just adding to the bloat.

Hence, we are now converting the binary data into an array buffer to prevent this. This buffer is added to the multi-part form data request as a new part and we add a pointer in the pace of the data which used to be present earlier. This allows us to have minimal bloat on the payload while sending the request.

TLDR: fix for uploading large files by changing the data type used for upload.

TODO:

  • Client side payload changes
  • Server side double escape logic fixes
  • Server side tests
  • Server side refactor
  • Cypress tests

Fixes #20642

Media

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • Manual

Test Plan

Add Testsmith test cases links that relate to this PR

Issues raised during DP testing

Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR)

Checklist:

Dev activity

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • PR is being merged under a feature flag

QA activity:

  • Test plan has been approved by relevant developers
  • Test plan has been peer reviewed by QA
  • Cypress test cases have been added and approved by either SDET or manual QA
  • Organized project review call with relevant stakeholders after Round 1/2 of QA
  • Added Test Plan Approved label after reveiwing all Cypress test

Summary by CodeRabbit

  • New Features

    • Enhanced handling of blob data during action execution, optimizing file uploads based on size.
    • Introduced a new constant for file size limits to improve data handling consistency.
    • Added a new ParamProperty class to manage parameter properties more effectively with additional attributes.
  • Bug Fixes

    • Improved validation logic for handling malformed and missing data in execution actions.
  • Documentation

    • Updated test cases to ensure clarity and enhance the robustness of the test suite.
  • Refactor

    • Modularized the executeAction method for improved clarity and maintainability in handling multipart requests.

@ayushpahwa ayushpahwa requested a review from nidhi-nair March 24, 2023 14:15
@github-actions github-actions bot added Bug Something isn't working File upload issues Issues related to uploading any type of files from within Appsmith High This issue blocks a user from building or impacts a lot of users Needs Triaging Needs attention from maintainers to triage Enhancement New feature or request and removed Bug Something isn't working labels Mar 24, 2023
@nidhi-nair nidhi-nair changed the title feat: remove bloat from large files during upload feat: remove bloat from large files during upload (WIP) Mar 31, 2023
@nidhi-nair nidhi-nair removed their request for review March 31, 2023 02:56
@github-actions github-actions bot added Query & JS Pod Issues related to the query & JS Pod Bug Something isn't working Data Platform Pod Issues related to the underlying data platform labels Apr 4, 2023
@ayushpahwa
Copy link
Contributor Author

/build-deploy-preview

@github-actions
Copy link

github-actions bot commented Apr 4, 2023

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/4604011159.
Workflow: On demand build Docker image and deploy preview.
skip-tests: . env: .
PR: 21757.

@github-actions github-actions bot removed the Bug Something isn't working label Apr 4, 2023
@nidhi-nair
Copy link
Contributor

/build-deploy-preview skip-tests=true

@github-actions
Copy link

github-actions bot commented Apr 4, 2023

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/4604390921.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 21757.

@github-actions github-actions bot added the Bug Something isn't working label Apr 4, 2023
@github-actions
Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/4811243479.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 21757.
recreate: .

@github-actions
Copy link

Deploy-Preview-URL: https://ce-21757.dp.appsmith.com

@ayushpahwa
Copy link
Contributor Author

/ok-to-test sha=2af0e67

@github-actions
Copy link

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/4812288796.
Workflow: Appsmith External Integration Test Workflow.
Commit: 2af0e67.
PR: 21757.
Perf tests will be available at https://app.appsmith.com/app/performance-infra-dashboard/pr-details-638dd7cd2913ba43778b915e?pr=21757&runId=4812288796_1

@github-actions
Copy link

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/4812288796.
Commit: 2af0e67.
The following are new failures, please fix them before merging the PR:

  1. cypress/integration/Regression_TestSuite/ClientSideTests/Autocomplete/Autocomplete_JS_spec.ts

  2. cypress/integration/Regression_TestSuite/ClientSideTests/Templates/Fork_Template_spec.js
  3. cypress/integration/Regression_TestSuite/ServerSideTests/QueryPane/S3_1_spec.js
  4. cypress/integration/SanitySuite/Datasources/Airtable_Basic_Spec.ts
To know the list of identified flaky tests - Refer here

@nidhi-nair
Copy link
Contributor

/ok-to-test

@github-actions
Copy link

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/4814760577.
Workflow: Appsmith External Integration Test Workflow.
Commit: ``.
PR: 21757.
Perf tests will be available at https://app.appsmith.com/app/performance-infra-dashboard/pr-details-638dd7cd2913ba43778b915e?pr=21757&runId=4814760577_1

@ayushpahwa ayushpahwa added the Test Plan Approved Manual/Cypress tests covers changes made on the PR. Else, add skip-testPlan label if not applicable label Apr 27, 2023
@github-actions
Copy link

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/4814760577.
Commit: ``.
The following are new failures, please fix them before merging the PR:

  1. cypress/integration/Regression_TestSuite/ClientSideTests/Git/GitDiscardChange/DiscardChanges_spec.js

  2. cypress/integration/Regression_TestSuite/ClientSideTests/Git/GitSync/GitSyncedApps_spec.js
  3. cypress/integration/Regression_TestSuite/ClientSideTests/Widgets/CurrencyInput/CurrencyInput_spec.js
  4. cypress/integration/Regression_TestSuite/ClientSideTests/Workspace/LeaveWorkspaceTest_spec.js
  5. cypress/integration/Regression_TestSuite/ServerSideTests/GenerateCRUD/Postgres1_Spec.ts
  6. cypress/integration/Regression_TestSuite/ServerSideTests/GenerateCRUD/Postgres2_Spec.ts
  7. cypress/integration/Regression_TestSuite/ServerSideTests/Postgres_DataTypes/Array_Spec.ts
  8. cypress/integration/Regression_TestSuite/ServerSideTests/QueryPane/S3_1_spec.js
  9. cypress/integration/SmokeSuite/FormLogin/EnableFormLogin_spec.js
To know the list of identified flaky tests - Refer here

@github-actions
Copy link

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/4814760577.
Commit: ``.
All cypress tests have passed 🎉

1 similar comment
@github-actions
Copy link

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/4814760577.
Commit: ``.
All cypress tests have passed 🎉

@ayushpahwa ayushpahwa merged commit ddfc329 into release Apr 27, 2023
@ayushpahwa ayushpahwa deleted the feat/20642-file-upload-bloat-removal branch April 27, 2023 03:33
@Nikhil-Nandagopal Nikhil-Nandagopal added Integrations Product Issues related to a specific integration and removed Data Platform Pod Issues related to the underlying data platform labels Aug 5, 2024
Copy link
Contributor

coderabbitai bot commented Aug 5, 2024

Warning

Rate limit exceeded

@github-actions[bot] has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 2 minutes and 58 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between 425376f and e6f6699.

Walkthrough

The recent updates enhance the application's capability to handle complex data structures, particularly with blob uploads and action executions. Key improvements include a more flexible paramProperties structure in the API, the introduction of a file size limit constant, and refined handling of multipart requests in execution services. These changes collectively aim to optimize memory usage, ensure better data validation, and improve maintainability across the codebase.

Changes

Files Change Summary
app/client/src/api/ActionAPI.tsx, app/server/appsmith-interfaces/src/main/java/com/appsmith/external/dtos/ExecuteActionDTO.java Expanded paramProperties structure for greater flexibility and introduced blobValuesMap for improved blob data handling.
app/client/src/constants/WidgetConstants.tsx, app/client/src/widgets/FilePickerWidgetV2/widget/index.tsx Added FILE_SIZE_LIMIT_FOR_BLOBS constant to centralize file size constraints, replacing hardcoded values in file picker logic.
app/client/src/sagas/ActionExecution/PluginActionSaga.ts, app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/NewActionServiceCEImpl.java Enhanced blob handling in saga and service classes, improving memory efficiency and modularizing multipart request processing.
app/server/appsmith-interfaces/src/main/java/com/appsmith/external/dtos/ParamProperty.java, app/server/appsmith-server/src/test/java/com/appsmith/server/services/ce/NewActionServiceCEImplTest.java Introduced ParamProperty class for structured parameter handling and updated test cases to validate new functionalities related to blob processing.

Assessment against linked issues

Objective Addressed Explanation
File size limit in payload must match actual file size (20642)
Improve blob handling to avoid payload size discrepancies (20642)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added Verified When issue is retested post its fixed and removed Bug Something isn't working labels Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request File upload issues Issues related to uploading any type of files from within Appsmith High This issue blocks a user from building or impacts a lot of users Integrations Product Issues related to a specific integration Needs Triaging Needs attention from maintainers to triage Query & JS Pod Issues related to the query & JS Pod Test Plan Approved Manual/Cypress tests covers changes made on the PR. Else, add skip-testPlan label if not applicable Verified When issue is retested post its fixed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: File size is larger in payload than actual
7 participants