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 deprecated unused fields #29831

Merged
merged 5 commits into from
Dec 27, 2023
Merged

chore: Remove deprecated unused fields #29831

merged 5 commits into from
Dec 27, 2023

Conversation

sharat87
Copy link
Member

@sharat87 sharat87 commented Dec 24, 2023

These fields were used in migrations, that re now deleted. So these fields became unused now.

Don't merge. Will cause a minor conflict in UserData.java.

Summary by CodeRabbit

  • Refactor

    • Simplified user and workspace data structures by removing deprecated fields.
    • Streamlined the handling of application layouts and themes.
    • Updated test suites to reflect changes in data models and service logic.
  • Bug Fixes

    • Corrected user role setting logic in seed data configuration.
  • Chores

    • Cleaned up unused imports and test assertions to align with the latest codebase structure.
  • Documentation

    • Updated comments to reflect migration from organizations to workspaces.
  • New Features

    • Users can now provide consent for Intercom integration directly through their profile settings.

@github-actions github-actions bot added the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label Dec 24, 2023
@sharat87 sharat87 marked this pull request as ready for review December 24, 2023 12:28
Copy link
Contributor

coderabbitai bot commented Dec 24, 2023

Walkthrough

Walkthrough

The overarching theme of the changes is the migration from an organization-centric model to a workspace-centric model within an application's codebase. This transition involves the removal of deprecated fields and methods related to organizations, refactoring of classes to align with the new workspace structure, and changing the handling of user roles and permissions. There's also an update to the Mongo configuration and a cleanup of tests to reflect the new domain logic.

Changes

File Path Change Summary
.../settings.test.tsx Removed isAutoGeneratedOrganization property from mockWorkspaceData.
.../MongoConfig.java Added "migrate-public-apps-single-pg" string to a list; updated comments.
.../server/domains/Application.java
.../Layout.java
.../Workspace.java
.../Collection.java
.../Theme.java
.../User.java
.../UserData.java
.../ce/ActionCollectionCE.java
.../ce/NewActionCE.java
Removed deprecated fields and methods related to organizations; updated workspace-related data structure and handling.
.../DatabaseChangelog2.java Removed unused import and migratePublicAppsSinglePg method.
.../SeedMongoData.java
.../ThemeServiceTest.java
.../services/ce/GitServiceCETest.java
.../services/ce/ThemeImportableServiceCETest.java
.../solutions/ImportApplicationServiceTests.java
Updated test logic to align with workspace-centric model and removed outdated assertions and initializations.

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 with CodeRabbit Bot (@coderabbitai)

  • You can directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • You can tag CodeRabbit on specific lines of code or entire files in the PR by tagging @coderabbitai in a comment. Examples:
    • @coderabbitai generate unit tests for this file
    • @coderabbitai modularize this function
  • You can tag @coderabbitai in a PR comment and ask questions about the PR and the codebase. Examples:
    • @coderabbitai gather interesting statistics about this repository and render them in a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai generate unit tests for the src/utils.ts file.

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Comment on lines 19 to 24
@JsonView(Views.Public.class)
String applicationId;

// Organizations migrated to workspaces, kept the field as deprecated to support the old migration
@Deprecated
@JsonView(Views.Public.class)
String organizationId;

@JsonView(Views.Public.class)
String workspaceId;

Copy link
Contributor

@coderabbitai coderabbitai bot Dec 24, 2023

Choose a reason for hiding this comment

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

💡 NOTE
Codebase verification is a beta feature.

The search results show that datasourceStorage.getWorkspaceId() is being used in the codebase to set workspaceId properties, which aligns with the transition from organizations to workspaces. However, the usage in CreateDBTablePageSolutionCEImpl.java is inconsistent with this pattern, as it uses organizationId and orgId keys with workspace IDs as their values.

Given this information, it appears that the usage in CreateDBTablePageSolutionCEImpl.java may need to be reviewed to ensure it is consistent with the rest of the codebase and the transition to workspaces. It's possible that these keys are retained for backward compatibility with analytics or other systems, but this should be confirmed.

The findings suggest that there may be an issue with the usage of organizationId in CreateDBTablePageSolutionCEImpl.java, and it should be verified whether this is intentional for backward compatibility or an oversight that needs correction.

Analysis chain

Ensure that there are no remaining references to the removed organizationId field in the codebase, including database queries and any serialization/deserialization logic that may have depended on this field.


The search for references to organizationId in the codebase has returned multiple hits. Each of these needs to be examined to determine if they are part of the deprecated functionality that should have been removed or if they are valid in the current context of the codebase.

Given the output, it seems that organizationId is still being used in various places in the codebase. However, without more context about each usage, it's not possible to definitively say whether these are issues that need to be addressed or if they are acceptable uses of organizationId. For example, the references in migration scripts or in classes that have not been refactored yet might be expected.

To proceed, we need to examine a few of these instances to understand their context. Let's start by looking at the references in FieldNameCE.java, Action.java, and CreateDBTablePageSolutionCEImpl.java to see if they are part of the deprecated functionality.


The references to organizationId in FieldNameCE.java and Action.java are marked as deprecated, which is consistent with the PR's objective to phase out such fields. However, the usage in CreateDBTablePageSolutionCEImpl.java is ambiguous because it uses organizationId as a key but assigns it a workspace ID value, which could either be intentional for backward compatibility or an oversight.

To clarify the usage in CreateDBTablePageSolutionCEImpl.java, we need to investigate whether the key name should be updated to workspaceId to match the value being assigned from datasourceStorage.getWorkspaceId().


The context from CreateDBTablePageSolutionCEImpl.java shows that datasourceStorage.getWorkspaceId() is being assigned to keys named organizationId and orgId. This suggests that the keys might be retained for backward compatibility. However, without additional context, it's not clear if this is the correct approach or if it's an oversight.

To gain a better understanding, we should look for additional usages of datasourceStorage.getWorkspaceId() to see if it is consistently being used in place of organizationId and whether the key names have been updated elsewhere in the codebase.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Search for references to 'organizationId' in the codebase.
rg --type java 'organizationId'

Length of output: 2528



Script:

#!/bin/bash
# Examine the context of 'organizationId' in FieldNameCE.java, Action.java, and CreateDBTablePageSolutionCEImpl.java
rg --type java -C 5 'organizationId' app/server/appsmith-server/src/main/java/com/appsmith/server/constants/ce/FieldNameCE.java
rg --type java -C 5 'organizationId' app/server/appsmith-server/src/main/java/com/appsmith/server/domains/Action.java
rg --type java -C 5 'organizationId' app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/CreateDBTablePageSolutionCEImpl.java

Length of output: 1825



Script:

#!/bin/bash
# Check the usage of datasourceStorage.getWorkspaceId() to determine if it should replace 'organizationId'
rg --type java -C 5 'datasourceStorage.getWorkspaceId()' app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/CreateDBTablePageSolutionCEImpl.java

Length of output: 937



Script:

#!/bin/bash
# Search for additional usages of 'datasourceStorage.getWorkspaceId()' to understand its context
rg --type java 'datasourceStorage.getWorkspaceId()' -C 5

Length of output: 6852

Copy link
Member Author

Choose a reason for hiding this comment

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

That's used for analytics. Changing that would mean potentially breaking our analytics, and renaming that may not be worth the trouble.

Copy link
Contributor

Choose a reason for hiding this comment

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

@sharat87 Understood, the usage of organizationId for analytics purposes will remain as is to ensure stability. No further action is required on this matter. If there's anything else that needs attention, please let me know.


If you found this review helpful, would you consider giving us a shout-out on X?
Thank you for using CodeRabbit!

@sharat87
Copy link
Member Author

/ok-to-test

Copy link

The provided command lacks any tags. Please execute '/ok-to-test' again, specifying the tags you want to include or use @tag.All to run all specs.
Explore the tags documentation here

Copy link

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/7329640434.
Commit: ``.
Cypress dashboard url: Click here!
It seems like there are some failures 😔. We are not able to recognize it, please check this manually here.

@sharat87
Copy link
Member Author

/ok-to-test tags="@tag.All"

Copy link

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/7329806347.
Workflow: Appsmith External Integration Test Workflow.
Tags: ``.

Copy link

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/7329806347.
Commit: ``.
Cypress dashboard: Click here!
The following are new failures, please fix them before merging the PR:

  1. cypress/e2e/Sanity/Datasources/MockDBs_Spec.ts

To know the list of identified flaky tests - Refer here

Copy link

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/7329806347.
Commit: ``.
Cypress dashboard: Click here!
The following are new failures, please fix them before merging the PR:

  1. cypress/e2e/Sanity/Datasources/MockDBs_Spec.ts

To know the list of identified flaky tests - Refer here

@sharat87 sharat87 merged commit b6e7e8e into release Dec 27, 2023
13 of 14 checks passed
@sharat87 sharat87 deleted the chore/cleanup branch December 27, 2023 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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