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: Remove unused new from JSON exports/responses #34652

Merged
merged 3 commits into from
Jul 10, 2024
Merged

Conversation

sharat87
Copy link
Member

@sharat87 sharat87 commented Jul 3, 2024

This field isn't used on client and so shouldn't be sent across.

EE PR at https://github.com/appsmithorg/appsmith-ee/pull/4466. All pass.

/test all

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/9853291119
Commit: 22f7383
Cypress dashboard.
Tags: @tag.All
Spec:


Tue, 09 Jul 2024 09:02:56 UTC

Summary by CodeRabbit

  • Bug Fixes

    • Resolved JSON formatting issues in several export fixture files.
    • Removed unnecessary field values from action configurations to ensure cleaner and more efficient data handling.
  • Refactor

    • Updated the isNew method's annotation in BaseDomain.java to improve JSON serialization behavior.

sharat87 added 2 commits July 3, 2024 07:33
This field isn't used on client and so shouldn't be sent across.

/test sanity

<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/9756721589>
> Commit: ea11761
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=9756721589&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Sanity`

<!-- end of auto-generated comment: Cypress test results  -->




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

## Summary by CodeRabbit

- **Bug Fixes**
- Improved data handling by modifying visibility annotations, enhancing
security and data privacy.

- **Tests**
- Updated tests to align with changes in data visibility, ensuring
accurate validation of JSON responses.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Copy link
Contributor

coderabbitai bot commented Jul 3, 2024

Walkthrough

The recent changes involve cleanup and streamlining of JSON fixture files and Java classes. The modifications primarily include the removal of the new key in various configurations to improve clarity and consistency, alongside some annotation adjustments in Java methods. Overall, these updates simplify the configurations and improve code quality without altering the overall functionality.

Changes

File(s) Change Summary
app/client/cypress/fixtures/PartialImportExport/CustomJsLibsExportedOnly.json Removed the new key from the jsonwebtoken library entry in the customJSLibList field.
app/client/cypress/fixtures/PartialImportExport/DatasourceExportedOnly.json Eliminated the "new": true field from a datasource configuration entry.
app/client/cypress/fixtures/PartialImportExport/JSExportedOnly.json Removed an unnecessary comma after the last element in the actionCollectionList.
app/client/cypress/fixtures/PartialImportExport/QueriesExportedOnly.json Adjusted structure and removed specific field values from InsertQuery, DeleteQuery, and UpdateQuery. No change to SelectQuery.
.../app/client/.../BaseDomain.java Changed the isNew() method annotation from @JsonView(Views.Public.class) to @JsonIgnore.
.../server/.../CommonConfigTest.java Removed the new field assertion in the objectMapper_BeanCreated_WithPublicJsonViewAsDefault method.

Poem

When code's refined, the system sings,
As json keys take flight on wings.
Fields removed, annotations changed,
A cleaner path, now well arranged.
🌟 The rabbit hops with joy anew,
For code that's simple, clear, and true.
Efficient flows in every hue. 💻


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.

@sharat87 sharat87 changed the title chore/no new 2 chore: Remove unused new from JSON exports/responses Jul 3, 2024
@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
@sharat87 sharat87 added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Jul 3, 2024
@sharat87 sharat87 added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Jul 9, 2024
@sharat87 sharat87 marked this pull request as ready for review July 9, 2024 09:18
@sharat87 sharat87 requested review from nidhi-nair, nsarupr and abhvsn July 9, 2024 09:19
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 ed42302 and 22f7383.

Files selected for processing (6)
  • app/client/cypress/fixtures/PartialImportExport/CustomJsLibsExportedOnly.json (1 hunks)
  • app/client/cypress/fixtures/PartialImportExport/DatasourceExportedOnly.json (1 hunks)
  • app/client/cypress/fixtures/PartialImportExport/JSExportedOnly.json (1 hunks)
  • app/client/cypress/fixtures/PartialImportExport/QueriesExportedOnly.json (1 hunks)
  • app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/BaseDomain.java (2 hunks)
  • app/server/appsmith-server/src/test/java/com/appsmith/server/configurations/CommonConfigTest.java (1 hunks)
Files skipped from review due to trivial changes (4)
  • app/client/cypress/fixtures/PartialImportExport/CustomJsLibsExportedOnly.json
  • app/client/cypress/fixtures/PartialImportExport/DatasourceExportedOnly.json
  • app/client/cypress/fixtures/PartialImportExport/JSExportedOnly.json
  • app/server/appsmith-server/src/test/java/com/appsmith/server/configurations/CommonConfigTest.java
Additional context used
Path-based instructions (1)
app/client/cypress/fixtures/PartialImportExport/QueriesExportedOnly.json (1)

Pattern app/client/cypress/**/**.*: Follow best practices for Cypress code and e2e automation.
Avoid using cy.wait in code.
Avoid using cy.pause in code.
Use variables for locators, not strings.
Use data-* attributes for selectors; avoid Xpaths and CSS attributes.
Avoid selectors like .btn.submit or button[type=submit].
Perform logins via API with LoginFromAPI.
Only interact with controlled sites/servers.
Ensure tests can run with it.only and are independent.
Use before, beforeEach, after, afterEach correctly; clean state before tests.
Check new specs for flakiness by running them 10 times on CI.
Use multiple assertions; don't treat Cypress as unit tests.
Use constants for strings.
Include datasource operations in before hooks.

Additional comments not posted (4)
app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/BaseDomain.java (1)

82-84: Change approved: isNew() method annotation updated

The annotation change from @JsonView(Views.Public.class) to @JsonIgnore ensures the isNew() method is no longer serialized in JSON responses, aligning with the PR objective.

app/client/cypress/fixtures/PartialImportExport/QueriesExportedOnly.json (3)

1-1: Change approved: InsertQuery configuration updated

The removal of specific field values like insert_form.formData.* aligns with the PR objective of eliminating unused fields. No issues are found.


1-1: Change approved: DeleteQuery configuration updated

The removal of specific field values like data_table.triggeredRow.id aligns with the PR objective of eliminating unused fields. No issues are found.


1-1: Change approved: UpdateQuery configuration updated

The removal of specific field values like update_form.fieldState.* aligns with the PR objective of eliminating unused fields. No issues are found.

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.

Minor comment!

@@ -78,7 +79,7 @@ public abstract class BaseDomain implements Persistable<String>, AppsmithDomain,
protected Set<Policy> policies = new HashSet<>();

@Override
@JsonView(Views.Public.class)
@JsonIgnore
public boolean isNew() {
return this.getId() == null;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

If this is not being used anywhere in the code does it make sense to remove this piece of code completely.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh it's being used in the server code, quite a bit. It's also important in pg, where we use this in our overridden .save method in BaseCake. Just that the client doesn't need it, so we should send it across. Server very much uses and needs it.

@sharat87 sharat87 requested a review from abhvsn July 10, 2024 01:11
@sharat87 sharat87 merged commit 92461d5 into release Jul 10, 2024
89 checks passed
@sharat87 sharat87 deleted the chore/no-new-2 branch July 10, 2024 05:29
Shivam-z pushed a commit to Shivam-z/appsmith that referenced this pull request Jul 10, 2024
…4652)

This field isn't used on client and so shouldn't be sent across.

EE PR at https://github.com/appsmithorg/appsmith-ee/pull/4466. All pass.

**/test all**



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


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

## Summary by CodeRabbit

- **Bug Fixes**
  - Resolved JSON formatting issues in several export fixture files.
- Removed unnecessary field values from action configurations to ensure
cleaner and more efficient data handling.

- **Refactor**
- Updated the `isNew` method's annotation in `BaseDomain.java` to
improve JSON serialization behavior.

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

2 participants