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

chore: refactor customJs lib import flow for pg transaction support #34622

Merged
merged 20 commits into from
Jul 9, 2024

Conversation

AnaghHegde
Copy link
Member

@AnaghHegde AnaghHegde commented Jul 2, 2024

Description

Please refer this document for more details - https://www.notion.so/appsmith/Transaction-Handling-in-PG-468cf8d4255749c3915699e59e91dc2f

Automation

/ok-to-test tags="@tag.Git, @tag.ImportExport, @tag.Templates"

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/9855863943
Commit: b9dfe1d
Cypress dashboard.
Tags: @tag.Git, @tag.ImportExport, @tag.Templates
Spec:


Tue, 09 Jul 2024 11:25:30 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

  • New Features
    • Introduced support for managing custom JavaScript libraries, including dry run operations.
  • Enhancements
    • Enhanced dry operation handling with new methods and improved logic for managing custom JavaScript libraries.

@AnaghHegde AnaghHegde self-assigned this Jul 2, 2024
Copy link
Contributor

coderabbitai bot commented Jul 2, 2024

Warning

Rate limit exceeded

@AnaghHegde has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 13 minutes and 41 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 7cb411e and b9dfe1d.

Walkthrough

The changes introduce a mechanism for handling dry run operations for CustomJSLib objects in the Appsmith Server. A new field customJSLibsDryOps and associated business logic were added to manage these operations without persisting data. Changes span multiple files, adding methods, updating interfaces, and incorporating new dry operation functionality into repository and service layers.

Changes

File Path Change Summary
app/server/.../MappedImportableResourcesCE_DTO.java Added customJSLibsDryOps field of type Map<String, List<CustomJSLib>>.
app/server/.../CustomJSLibServiceCE.java Added method persistCustomJSLibMetaDataIfDoesNotExistAndGetDTO with new parameters.
app/server/.../CustomJSLibServiceCEImpl.java Added overloaded method, dry run handling logic, and private method for dry operations.
app/server/.../DryOperationRepository.java Added CustomJSLibRepository integration, save method, and handling logic in executeAllDbOps.

Sequence Diagram(s)

Persist Custom JS Library with Dry Run Handling

sequenceDiagram
    participant Client
    participant Controller
    participant CustomJSLibService
    participant DryOperationRepository
    
    Client->>+Controller: Request to persist CustomJSLib
    Controller->>+CustomJSLibService: Call persistCustomJSLibMetaDataIfDoesNotExistAndGetDTO
    alt isDryOps == true
        CustomJSLibService-->>+DryOperationRepository: addDryOpsForEntity(CustomJSLib, customJSLibsDryOps)
    else
        CustomJSLibService-->>+DryOperationRepository: saveCustomJSLibToDb
    end
    DryOperationRepository-->>-CustomJSLibService: Response
    CustomJSLibService-->>-Controller: Response with CustomJSLibContextDTO
    Controller-->>-Client: Return CustomJSLibContextDTO
Loading

Poem

In a world where code takes flight,
Comes a change to set things right.
customJSLibsDryOps by the name,
Handles dry runs, no more the same.
Repositories now wisely store,
Dry runs neatly, ever more.
🎉🐇 Code evolves, we cheer, encore! 🎉


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 Configration 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.

@AnaghHegde AnaghHegde requested review from abhvsn and removed request for a team, nidhi-nair and sondermanish July 2, 2024 05:57
Copy link
Contributor

@abhvsn abhvsn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AnaghHegde Changes looks fine but do we want to continue with separate maps for each entity? If not let's try and move away from it right now otherwise we are taking on debt early on in this refactor 🙏🏽.

@AnaghHegde
Copy link
Member Author

@abhvsn I will work on this once i get more clarity on the page and actions refactor. These flows might require some changes hence i am going to stick to this approach for now.

Base automatically changed from pg-transaction-datsoure-import-flow to release July 3, 2024 14:35
…o pg-transaction-customJsLib-import-flow
@AnaghHegde AnaghHegde requested a review from abhvsn July 3, 2024 14:39
@github-actions github-actions bot added the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label Jul 3, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between d1def50 and 5f96873.

Files selected for processing (1)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/DryOperationRepository.java (4 hunks)
Additional context used
Path-based instructions (1)
app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/DryOperationRepository.java (1)

Pattern **/*.*: Do not use cy.wait in code.
Do call the add function.
Do not keep duplicate lines in code.
Descriptive test names are used to clearly convey the intent of each test.

Additional comments not posted (5)
app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/DryOperationRepository.java (5)

5-5: Import statement for CustomJSLib looks good.

The import is necessary for the new functionality.


26-26: Addition of customJSLibRepository field looks good.

The new field is required for managing CustomJSLib entities.


35-35: Addition of CustomJSLib to repoByEntityClass map looks good.

This addition is necessary for repository management.


51-53: Addition of saveCustomJSLibToDb method looks good.

The new method is required for saving CustomJSLib entities to the database.


77-86: Update to executeAllDbOps method looks good.

The updated method now includes handling for CustomJSLib entities, which is necessary for saving CustomJSLib entities during dry run operations.

@AnaghHegde AnaghHegde added the ok-to-test Required label for CI label Jul 3, 2024
abhvsn
abhvsn previously approved these changes Jul 4, 2024
Copy link
Contributor

@abhvsn abhvsn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving now to unblock, but let's address the debt while refactoring for pages and application import flow.

@AnaghHegde AnaghHegde added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Jul 5, 2024
…o pg-transaction-customJsLib-import-flow
@AnaghHegde AnaghHegde added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Jul 8, 2024
@AnaghHegde AnaghHegde added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Jul 9, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 5f96873 and 7cb411e.

Files selected for processing (1)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/jslibs/base/CustomJSLibServiceCEImpl.java (5 hunks)
Files skipped from review as they are similar to previous changes (1)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/jslibs/base/CustomJSLibServiceCEImpl.java

@sondermanish
Copy link
Contributor

We are deferring unit tests to another PR

@AnaghHegde AnaghHegde added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Jul 9, 2024
@AnaghHegde AnaghHegde added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Jul 9, 2024
@AnaghHegde AnaghHegde merged commit 0941014 into release Jul 9, 2024
69 of 71 checks passed
@AnaghHegde AnaghHegde deleted the pg-transaction-customJsLib-import-flow branch July 9, 2024 11:45
Shivam-z pushed a commit to Shivam-z/appsmith that referenced this pull request Jul 10, 2024
…ppsmithorg#34622)

## Description
Please refer this document for more details -
https://www.notion.so/appsmith/Transaction-Handling-in-PG-468cf8d4255749c3915699e59e91dc2f



## Automation

/ok-to-test tags="@tag.Git, @tag.ImportExport, @tag.Templates"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/9855863943>
> Commit: b9dfe1d
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=9855863943&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Git, @tag.ImportExport, @tag.Templates`
> Spec:
> <hr>Tue, 09 Jul 2024 11:25:30 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Introduced support for managing custom JavaScript libraries, including
dry run operations.
- **Enhancements**
- Enhanced dry operation handling with new methods and improved logic
for managing custom JavaScript libraries.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ok-to-test Required label for CI skip-changelog Adding this label to a PR prevents it from being listed in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants