-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
fix: added an autocommit migration for theme settings. #35554
Conversation
WalkthroughThe recent changes enhance the migration capabilities of the server schema within the application. New logic has been implemented to manage theme settings during migrations from schema version 6 to 9. Additionally, the version retrieval process has been simplified, improving clarity and robustness. Test adjustments ensure that these changes are accurately reflected in the testing framework. Overall, these updates aim to streamline the migration process and enhance application performance. Changes
Assessment against linked issues
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this 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
Outside diff range, codebase verification and nitpick comments (3)
app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaMigration.java (1)
147-150
: Ensure consistency in migration logic.The addition of cases 7 and 8 for theme settings migration appears correct. However, ensure that any dependencies or prerequisites for these migrations are met before execution. Consider adding comments to clarify the purpose of these migrations.
+ // Migrate theme settings for schema versions 7 and 8
app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/MigrationHelperMethods.java (2)
1187-1218
: Confirm initialization logic for theme settings.The method correctly initializes
ApplicationDetail
andThemeSetting
objects if they are null. This ensures that theme settings are always present. Consider adding logging or comments to indicate when initialization occurs for better traceability.+ // Initialize theme settings if not already present
1220-1233
: Ensure default values are set correctly.The method correctly assigns default values for
appMaxWidth
,density
, andsizing
. This ensures consistency in theme settings. Consider adding comments to explain the choice of default values for clarity.+ // Set default values for theme settings
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (5)
- app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaMigration.java (1 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaVersions.java (2 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaVersionsFallback.java (1 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/MigrationHelperMethods.java (2 hunks)
- app/server/appsmith-server/src/test/java/com/appsmith/server/migrations/JsonSchemaVersionsTest.java (1 hunks)
Additional comments not posted (3)
app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaVersions.java (1)
22-22
: Simplified version retrieval logic.The removal of the feature flag annotation and the direct return of
super.getServerVersion()
simplifies the method. Ensure that this change aligns with the intended behavior across the codebase.Verification successful
Simplified version retrieval logic verified.
The removal of the feature flag annotation and the direct return of
super.getServerVersion()
does not appear to impact any conditional logic or feature flag-dependent behavior in the current codebase. The change aligns with the intended simplification of the method.
- No conditional logic or feature flag dependencies: The search results did not reveal any conditional logic or feature flag dependencies directly related to
getServerVersion
.This change is consistent with the overall design and should not affect other parts of the application.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the impact of removing the feature flag annotation from `getServerVersion`. # Test: Search for references to `getServerVersion` to ensure no conditional logic depends on the feature flag. rg --type java 'getServerVersion'Length of output: 9295
Script:
#!/bin/bash # Description: Check for any feature flag or conditional logic related to `getServerVersion` in migration and test files. # Check for feature flag usage in migration files rg --type java 'feature flag' app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/ # Check for conditional logic related to `getServerVersion` in test files rg --type java 'if.*getServerVersion' app/server/appsmith-server/src/test/Length of output: 807
app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaVersionsFallback.java (1)
7-7
: Server version incremented to 9.The server version has been updated from
7
to9
, indicating changes in schema compatibility. Ensure that this increment is well-documented and aligns with the migration logic.app/server/appsmith-server/src/test/java/com/appsmith/server/migrations/JsonSchemaVersionsTest.java (1)
53-53
: Updated test assertion for server version.The test now asserts that the server version equals the fallback version, aligning with the simplified version retrieval logic. Ensure that this reflects the intended behavior change and verify test coverage.
Verification successful
Test coverage for
getServerVersion
appears comprehensive.The search results indicate that
getServerVersion
is tested in multiple contexts across different test files. This suggests that the test coverage for this method is indeed comprehensive and should reflect the intended behavior change. If there are specific scenarios or edge cases you are concerned about, you may want to review the individual test cases to ensure they align with the new logic.
- Files with relevant tests:
JsonSchemaMigrationTest.java
JsonSchemaVersionsTest.java
CommonGitServiceCETest.java
AutoCommitServiceTest.java
ExportServiceTests.java
ImportServiceTests.java
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify test coverage for server version retrieval logic. # Test: Search for tests related to `getServerVersion` to ensure comprehensive coverage. rg --type java 'getServerVersion'Length of output: 9295
public Integer getServerVersion() { | ||
return super.getServerVersion() + 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will you be cleaning this up later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, that is when we remove a secondary class with autocommit flags.
} | ||
|
||
// since these are primitive values we don't have concept of null, hence putting it to the default of 1. | ||
if (themeSetting.getDensity() == 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When would we arrive at this scenario?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are not expected to land on this scenario by default, Even if we don't have the density and sizing values not present while deserialising we would start with 1, right? (if not then it's for that).
Failed server tests
|
Failed server tests
|
There was a problem hiding this 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.yaml
Review profile: CHILL
Files selected for processing (1)
- app/server/appsmith-server/src/test/java/com/appsmith/server/migrations/JsonSchemaMigrationTest.java (2 hunks)
Files skipped from review due to trivial changes (1)
- app/server/appsmith-server/src/test/java/com/appsmith/server/migrations/JsonSchemaMigrationTest.java
Failed server tests
|
There was a problem hiding this 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.yaml
Review profile: CHILL
Files selected for processing (1)
- app/server/appsmith-server/src/test/java/com/appsmith/server/imports/internal/ImportServiceTests.java (1 hunks)
## Description > > > Fixes #35536 ## Automation /ok-to-test tags="@tag.Git" ### 🔍 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/10315694999> > Commit: f03353b > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=10315694999&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.Git` > Spec: > <hr>Fri, 09 Aug 2024 08:16:04 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** - Enhanced migration logic for server schema versions, ensuring proper handling of theme settings during migrations from version 6 to 9. - Introduced methods to establish and set default theme settings for applications during migration. - **Bug Fixes** - Simplified server version retrieval process, ensuring consistent versioning behavior. - **Tests** - Updated tests to reflect changes in server version expectations, removing unnecessary assertions related to feature flags. - Streamlined validation logic in migration tests to focus solely on expected schema versions. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Description
Fixes #35536
Automation
/ok-to-test tags="@tag.Git"
🔍 Cypress test results
Tip
🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/10315694999
Commit: f03353b
Cypress dashboard.
Tags:
@tag.Git
Spec:
Fri, 09 Aug 2024 08:16:04 UTC
Communication
Should the DevRel and Marketing teams inform users about this change?
Summary by CodeRabbit
New Features
Bug Fixes
Tests