Skip to content

chore: json migration changes#34238

Merged
sondermanish merged 2 commits intoreleasefrom
chore/json-version
Jun 14, 2024
Merged

chore: json migration changes#34238
sondermanish merged 2 commits intoreleasefrom
chore/json-version

Conversation

@sondermanish
Copy link
Contributor

@sondermanish sondermanish commented Jun 14, 2024

Description

  • In order to rollout the autocommit we need to increase the server version number from 7 to 8, however we can't do that for all the instance as tenants for which the autocommit flag is disabled would see unneccessary changes. for that reason
    added wrapping Json server version with feature flag..

Fixes #Issue Number
or
Fixes Issue URL

Warning

If no issue exists, please create an issue first, and check with the maintainers if the issue is valid.

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/9511247673
Commit: c8f5fe7
Cypress dashboard url: Click here!

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Introduced a new JSON structure in application.json representing application details like name, pages, settings, and themes.
  • Refactor

    • Enhanced schema version management by replacing static references with instance methods.
  • Tests

    • Updated test cases to incorporate new JsonSchemaVersions and JsonSchemaMigration dependencies.
    • Added a new test file for validating JsonSchemaVersions and feature flag conditions.

@sondermanish sondermanish requested review from a team, abhvsn, sharat87 and vivonk as code owners June 14, 2024 04:54
@sondermanish sondermanish requested a review from nidhi-nair June 14, 2024 04:54
@github-actions github-actions bot added the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label Jun 14, 2024
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 14, 2024

Walkthrough

The recent changes primarily involve the introduction and incorporation of JsonSchemaVersions and JsonSchemaMigration into various components and services of the Appsmith server codebase. These updates include modification of constructors, method implementations, and test cases to use instance methods instead of static references for handling schema versions. Additionally, a new JSON file, application.json, has been added to help with testing and migration of application artifacts.

Changes

File(s) Change Summary
ApplicationExportServiceCEImpl.java, ApplicationExportServiceImpl.java Modified constructors to include JsonSchemaVersions, updated schema version comparisons in method calls.
GitApplicationHelperCECompatibleImpl.java, GitApplicationHelperCEImpl.java, GitApplicationHelperImpl.java Added JsonSchemaVersions dependency in constructors, affecting the initialization and usage of schema versions.
ExportServiceCEImpl.java, ExportServiceImpl.java Introduced JsonSchemaVersions as a dependency in constructors, replacing static references with instance methods in exportByExportableArtifactIdAndBranch.
PartialExportServiceCEImpl.java, PartialExportServiceImpl.java Added JsonSchemaVersions as a constructor parameter and updated method implementations to use instance methods for schema versions.
AutoCommitEligibilityHelperImpl.java Added JsonSchemaVersions field and utilized it for schema version comparisons in auto-commit eligibility.
CommonGitFileUtils.java, CommonGitFileUtilsCE.java Added JsonSchemaVersions to constructors and updated references to schema versions with instance methods.
ResponseUtils.java, ResponseUtilsCE.java Added JsonSchemaVersions dependency through constructors and updated schema version references to use instance methods.
ImportServiceCEImpl.java, ImportServiceImpl.java Added JsonSchemaMigration field and used it in methods to handle schema migrations.
JsonSchemaMigration.java Transitioned from static to instance methods, updated migration logic to use instance variables.
JsonSchemaVersions.java Extended JsonSchemaVersionsFallback, added method to increment server version.
JsonSchemaVersionsFallback.java Added static methods for accessing schema versions without class instantiation.
CreateDBTablePageSolutionImpl.java, CreateDBTablePageSolutionCEImpl.java Added JsonSchemaMigration dependency and used it for artifact migration.
ExportServiceTests.java, CommonGitServiceCETest.java Updated test cases to use instance methods of JsonSchemaVersions and JsonSchemaMigration.
AutoCommitEventHandlerImplTest.java, AutoCommitServiceTest.java, AutoCommitEligibilityHelperTest.java Added JsonSchemaVersions and CachedFeatures, updated references to use instance methods for schema version checks.
GitFileUtilsTest.java, ResponseUtilsTest.java, ImportServiceTests.java Refactored tests to use instance-based JsonSchemaMigration and JsonSchemaVersions.
JsonSchemaMigrationTest.java, JsonSchemaVersionsTest.java Added test cases for migration and version behavior based on feature flag settings.
...application.json Introduced JSON representing an application setup for schema migration testing.

Poem

📜 In the heart of code, schemas align,
With JsonSchemaVersions, our functions now shine.
Migrations to handle, with careful sway,
Artifacts evolving, like dawn’s new day.
Bugs get banished, as tests refine,
In Appsmith’s world, the future's divine.
🐇✨


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.

@sondermanish sondermanish self-assigned this Jun 14, 2024
@sondermanish sondermanish added the ok-to-test Required label for CI label Jun 14, 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: 11

Outside diff range and nitpick comments (1)
app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaMigration.java (1)

Line range hint 85-96: The migrateArtifactToLatestSchema method is marked as deprecated, which is good for visibility but raises a question about its continued necessity. Consider removing or replacing this method if it's no longer needed.

- public ArtifactExchangeJson migrateArtifactToLatestSchema(ArtifactExchangeJson artifactExchangeJson) {
+ // Consider removing this method if it's deprecated and no longer used.
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between dae657e and 8d05708.

Files selected for processing (33)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/applications/exports/ApplicationExportServiceCEImpl.java (2 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/applications/exports/ApplicationExportServiceImpl.java (2 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/applications/git/GitApplicationHelperCECompatibleImpl.java (2 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/applications/git/GitApplicationHelperCEImpl.java (2 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/applications/git/GitApplicationHelperImpl.java (3 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/exports/internal/ExportServiceCEImpl.java (4 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/exports/internal/ExportServiceImpl.java (3 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/exports/internal/partial/PartialExportServiceCEImpl.java (2 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/exports/internal/partial/PartialExportServiceImpl.java (3 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/helpers/AutoCommitEligibilityHelperImpl.java (2 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/CommonGitFileUtils.java (2 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ResponseUtils.java (1 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/CommonGitFileUtilsCE.java (3 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/ResponseUtilsCE.java (3 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/imports/internal/ImportServiceCEImpl.java (2 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/imports/internal/ImportServiceImpl.java (3 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaMigration.java (6 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/solutions/CreateDBTablePageSolutionImpl.java (4 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/CreateDBTablePageSolutionCEImpl.java (2 hunks)
  • app/server/appsmith-server/src/test/java/com/appsmith/server/exports/internal/ExportServiceTests.java (4 hunks)
  • app/server/appsmith-server/src/test/java/com/appsmith/server/git/CommonGitServiceCETest.java (3 hunks)
  • app/server/appsmith-server/src/test/java/com/appsmith/server/git/autocommit/AutoCommitEventHandlerImplTest.java (3 hunks)
  • app/server/appsmith-server/src/test/java/com/appsmith/server/git/autocommit/AutoCommitServiceTest.java (10 hunks)
  • app/server/appsmith-server/src/test/java/com/appsmith/server/git/autocommit/helpers/AutoCommitEligibilityHelperTest.java (13 hunks)
  • app/server/appsmith-server/src/test/java/com/appsmith/server/helpers/GitFileUtilsTest.java (2 hunks)
  • app/server/appsmith-server/src/test/java/com/appsmith/server/helpers/ResponseUtilsTest.java (2 hunks)
  • app/server/appsmith-server/src/test/java/com/appsmith/server/imports/internal/ImportServiceTests.java (7 hunks)
  • app/server/appsmith-server/src/test/java/com/appsmith/server/migrations/JsonSchemaMigrationTest.java (1 hunks)
  • app/server/appsmith-server/src/test/java/com/appsmith/server/migrations/JsonSchemaVersionsTest.java (1 hunks)
  • app/server/appsmith-server/src/test/java/com/appsmith/server/transactions/ImportApplicationTransactionServiceTest.java (2 hunks)
  • app/server/appsmith-server/src/test/resources/com/appsmith/server/migrations/application.json (1 hunks)
Additional comments not posted (60)
app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ResponseUtils.java (1)

12-14: The addition of JsonSchemaVersions to the constructor and its subsequent passing to the superclass constructor is correctly implemented. This change aligns with the PR's objective of integrating JSON schema version handling.

app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaVersions.java (1)

18-26: The implementation of getServerVersion with a feature flag is appropriate. It ensures that the new server version logic is only applied when the feature is enabled. Consider adding a comment explaining the rationale behind incrementing the server version by 1, to aid future maintainers.

app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/CommonGitFileUtils.java (1)

27-35: The addition of JsonSchemaVersions to the constructor and its subsequent passing to the superclass constructor is implemented correctly and is consistent with similar changes across other classes in this PR.

app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaVersionsFallback.java (1)

18-38: The addition of static methods for accessing server and client versions directly is a good practice, especially in contexts where creating an instance is unnecessary or costly. The documentation is clear and helps understand the use cases for these methods.

app/server/appsmith-server/src/main/java/com/appsmith/server/applications/exports/ApplicationExportServiceImpl.java (1)

12-12: The addition of JsonSchemaVersions in the constructor is correctly implemented. Ensure that this new dependency is consistently used across the application where JSON schema versioning is required.

Also applies to: 28-29, 37-38

Verification successful

The usage of JsonSchemaVersions is consistent across the application, following standard dependency injection practices.

  • Instances of JsonSchemaVersions are found in both main and test classes, ensuring comprehensive coverage.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify consistent use of `JsonSchemaVersions` across the application.

# Test: Search for inconsistent usage of `JsonSchemaVersions`. Expect: Consistent usage across the application.
rg --type java $'JsonSchemaVersions'

Length of output: 8904

app/server/appsmith-server/src/main/java/com/appsmith/server/exports/internal/ExportServiceImpl.java (1)

10-10: The addition of JsonSchemaVersions in the constructor is correctly implemented. Ensure that this new dependency is consistently used across the application where JSON schema versioning is required.

Also applies to: 30-31, 40-41

Verification successful

The JsonSchemaVersions class is consistently used across the application in various files, including main application files and tests. There are no inconsistencies observed in its usage.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify consistent use of `JsonSchemaVersions` across the application.

# Test: Search for inconsistent usage of `JsonSchemaVersions`. Expect: Consistent usage across the application.
rg --type java $'JsonSchemaVersions'

Length of output: 8904

app/server/appsmith-server/src/main/java/com/appsmith/server/applications/git/GitApplicationHelperImpl.java (1)

9-9: The addition of JsonSchemaVersions in the constructor is correctly implemented. Ensure that this new dependency is consistently used across the application where JSON schema versioning is required.

Also applies to: 32-33, 43-44

Verification successful

The verification script confirms that JsonSchemaVersions is consistently used across the application, including both test and main directories. The implementation appears to be correct and consistent.

  • Instances of JsonSchemaVersions were found in various main application files, such as:
    • app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ResponseUtils.java
    • app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/CommonGitFileUtils.java
    • app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/ResponseUtilsCE.java
    • app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/CommonGitFileUtilsCE.java
    • app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/helpers/AutoCommitEligibilityHelperImpl.java
    • app/server/appsmith-server/src/main/java/com/appsmith/server/exports/internal/ExportServiceCEImpl.java
    • app/server/appsmith-server/src/main/java/com/appsmith/server/exports/internal/ExportServiceImpl.java
    • app/server/appsmith-server/src/main/java/com/appsmith/server/exports/internal/partial/PartialExportServiceImpl.java
    • app/server/appsmith-server/src/main/java/com/appsmith/server/exports/internal/partial/PartialExportServiceCEImpl.java
    • app/server/appsmith-server/src/main/java/com/appsmith/server/applications/exports/ApplicationExportServiceImpl.java
    • app/server/appsmith-server/src/main/java/com/appsmith/server/applications/exports/ApplicationExportServiceCEImpl.java
    • app/server/appsmith-server/src/main/java/com/appsmith/server/applications/git/GitApplicationHelperCEImpl.java
    • app/server/appsmith-server/src/main/java/com/appsmith/server/applications/git/GitApplicationHelperImpl.java
    • app/server/appsmith-server/src/main/java/com/appsmith/server/applications/git/GitApplicationHelperCECompatibleImpl.java

This indicates that JsonSchemaVersions is being used consistently across the application.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify consistent use of `JsonSchemaVersions` across the application.

# Test: Search for inconsistent usage of `JsonSchemaVersions`. Expect: Consistent usage across the application.
rg --type java $'JsonSchemaVersions'

Length of output: 8904

app/server/appsmith-server/src/main/java/com/appsmith/server/applications/git/GitApplicationHelperCECompatibleImpl.java (1)

9-9: The addition of JsonSchemaVersions in the constructor is correctly implemented. Ensure that this new dependency is consistently used across the application where JSON schema versioning is required.

Also applies to: 31-32, 42-43

Verification successful

The addition of JsonSchemaVersions in the constructor is correctly implemented and consistently used across the application where JSON schema versioning is required.

  • Instances found in both test and main code files confirm consistent usage.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify consistent use of `JsonSchemaVersions` across the application.

# Test: Search for inconsistent usage of `JsonSchemaVersions`. Expect: Consistent usage across the application.
rg --type java $'JsonSchemaVersions'

Length of output: 8904

app/server/appsmith-server/src/main/java/com/appsmith/server/imports/internal/ImportServiceImpl.java (1)

11-11: The addition of JsonSchemaMigration as a dependency in the ImportServiceImpl constructor appears correct and aligns with the PR's objective to manage JSON schema versions more effectively. Ensure that all necessary methods within ImportServiceImpl that require schema migration logic are now utilizing this new dependency.

Also applies to: 32-33, 44-45

app/server/appsmith-server/src/main/java/com/appsmith/server/exports/internal/partial/PartialExportServiceImpl.java (1)

11-11: The integration of JsonSchemaVersions into the PartialExportServiceImpl constructor is implemented correctly. This change supports dynamic schema version management, which is crucial for the system's flexibility in handling different versions of JSON schemas. Verify that the methods using schema version information are now utilizing this new dependency.

Also applies to: 35-36, 49-50

Verification successful

The JsonSchemaVersions is indeed being passed to the constructor of PartialExportServiceImpl and subsequently to the superclass PartialExportServiceCEImpl. Since the superclass handles the jsonSchemaVersions, the integration appears to be correct.

  • JsonSchemaVersions is passed as a parameter to the constructor.
  • It is then passed to the superclass constructor, indicating its usage is managed by the superclass.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that methods using schema versions are now using the JsonSchemaVersions instance.
# Test: Search for JsonSchemaVersions method usages in PartialExportServiceImpl.
rg --type java --files-with-matches $'JsonSchemaVersions' ./app/server/appsmith-server/src/main/java/com/appsmith/server/exports/internal/partial/PartialExportServiceImpl.java | xargs cat | rg $'getServerVersion|getClientVersion'

Length of output: 227



Script:

#!/bin/bash
# Description: Search for all references of JsonSchemaVersions in PartialExportServiceImpl.java to understand its usage.
rg --type java 'JsonSchemaVersions' ./app/server/appsmith-server/src/main/java/com/appsmith/server/exports/internal/partial/PartialExportServiceImpl.java

Length of output: 264



Script:

#!/bin/bash
# Description: Extract the full constructor and class body of PartialExportServiceImpl to understand the usage of jsonSchemaVersions.
ast-grep --lang java --pattern $'class PartialExportServiceImpl {
  $$$
}' ./app/server/appsmith-server/src/main/java/com/appsmith/server/exports/internal/partial/PartialExportServiceImpl.java

Length of output: 193



Script:

#!/bin/bash
# Description: Search for the class definition and constructor of PartialExportServiceImpl to understand the usage of jsonSchemaVersions.
rg --type java --context 10 'class PartialExportServiceImpl' ./app/server/appsmith-server/src/main/java/com/appsmith/server/exports/internal/partial/PartialExportServiceImpl.java

Length of output: 1223



Script:

#!/bin/bash
# Description: Search for the full constructor of PartialExportServiceImpl with increased context lines.
rg --type java --context 30 'class PartialExportServiceImpl' ./app/server/appsmith-server/src/main/java/com/appsmith/server/exports/internal/partial/PartialExportServiceImpl.java

Length of output: 2553

app/server/appsmith-server/src/test/java/com/appsmith/server/migrations/JsonSchemaVersionsTest.java (1)

36-46: The tests in JsonSchemaVersionsTest are well-constructed to verify the behavior of JsonSchemaVersions under different feature flag settings. These tests are crucial for ensuring that the versioning logic behaves as expected when feature flags are toggled. It is recommended to add negative tests or edge cases if not already present.

Also applies to: 48-60

app/server/appsmith-server/src/test/resources/com/appsmith/server/migrations/application.json (1)

1-144: The JSON structure for application.json is well-formed and aligns with the new schema requirements. It includes necessary metadata like artifactJsonType, clientSchemaVersion, and serverSchemaVersion, which are crucial for the migration logic. The detailed structure of pages and their properties ensures that all necessary data is captured for migration tests.

app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaMigration.java (6)

19-20: The injection of JsonSchemaVersions as a dependency is crucial for accessing versioning methods. This change supports the shift from static to instance methods, improving modularity and testability.


21-24: The isCompatible method efficiently checks compatibility based on client and server schema versions. This is a clean and concise implementation.


34-35: The method isAutocommitVersionBump is specific and handles a niche case where the server schema version bump is due to a feature flag. This method is well-documented and clear in its purpose.


38-43: The setSchemaVersions method correctly sets both client and server schema versions using a helper method. This ensures that versions are set correctly across different scenarios.


69-72: The conditional migration logic in migrateApplicationJsonToLatestSchema is robust, handling both standard compatibility and auto-commit version bumps. This ensures that the migration process is flexible and accounts for various scenarios.


Line range hint 106-155: The migrateServerSchema method handles schema migrations across various versions with detailed case handling for each version. This method is well-structured and ensures that all necessary migrations are applied sequentially.

app/server/appsmith-server/src/test/java/com/appsmith/server/migrations/JsonSchemaMigrationTest.java (1)

34-144: The test cases in JsonSchemaMigrationTest are comprehensive, covering scenarios with different feature flags and ensuring that schema versions are updated correctly. The use of mocks and assertions is appropriate and ensures that the migration logic works as expected under various conditions.

app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/helpers/AutoCommitEligibilityHelperImpl.java (2)

36-36: The addition of JsonSchemaVersions to AutoCommitEligibilityHelperImpl allows for checking schema version compatibility directly within auto-commit eligibility logic. This is a strategic integration that enhances the functionality of auto-commit checks.


53-53: The method isServerAutoCommitRequired uses the JsonSchemaVersions to determine if a server schema migration is necessary. This is a critical check that ensures data integrity and consistency across versions.

app/server/appsmith-server/src/test/java/com/appsmith/server/transactions/ImportApplicationTransactionServiceTest.java (2)

88-89: Added dependency JsonSchemaMigration to facilitate schema migration during application import tests.


133-133: Correctly integrated the migrateArtifactToLatestSchema method to ensure JSON artifacts are updated to the latest schema version during tests.

app/server/appsmith-server/src/test/java/com/appsmith/server/helpers/ResponseUtilsTest.java (2)

41-42: Added dependency JsonSchemaVersions to leverage schema version checks in ResponseUtils tests.


190-196: Correctly utilized JsonSchemaVersions methods to simulate different schema version scenarios in unit tests, enhancing test accuracy and reliability.

app/server/appsmith-server/src/main/java/com/appsmith/server/applications/exports/ApplicationExportServiceCEImpl.java (2)

49-65: Updated constructor to include JsonSchemaVersions as a dependency, ensuring schema versions are considered during the application export process.


126-129: Implemented checks for client and server schema migrations in the export process, enhancing data integrity and compatibility.

app/server/appsmith-server/src/main/java/com/appsmith/server/applications/git/GitApplicationHelperCEImpl.java (2)

62-62: Integrated JsonSchemaVersions into the Git application helper to manage schema versions effectively during Git operations.


151-152: Properly updated client and server schema versions in the Git context, ensuring consistency and accurate change tracking.

app/server/appsmith-server/src/test/java/com/appsmith/server/helpers/GitFileUtilsTest.java (2)

67-69: Ensure JsonSchemaMigration is properly autowired and initialized before use.


90-90: The usage of jsonSchemaMigration::migrateArtifactToLatestSchema seems appropriate. Verify that the method handles all edge cases correctly.

Verification successful

The method migrateArtifactToLatestSchema and its associated methods handle edge cases appropriately.

  • setSchemaVersions ensures schema versions are set correctly, defaulting to 0 if null.
  • isCompatible checks for compatibility with the current schema versions.
  • isAutocommitVersionBump handles a specific version bump scenario.
  • migrateServerSchema includes detailed migration steps for various schema versions.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify the method's implementation and its handling of edge cases.
ast-grep --lang java --pattern 'public void migrateArtifactToLatestSchema($$$)'

Length of output: 426



Script:

#!/bin/bash
# Searching for the correct method definition for `migrateArtifactToLatestSchema` in the codebase
rg 'public .* migrateArtifactToLatestSchema\(.*\)' -t java

Length of output: 264



Script:

#!/bin/bash
# Extracting the full implementation of the method `migrateArtifactToLatestSchema`
rg -A 20 'public ArtifactExchangeJson migrateArtifactToLatestSchema\(ArtifactExchangeJson artifactExchangeJson\)' app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaMigration.java

Length of output: 1069



Script:

#!/bin/bash
# Extracting the implementations of the methods called within `migrateArtifactToLatestSchema`
rg -A 20 'public void setSchemaVersions\(ApplicationJson applicationJson\)' app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaMigration.java
rg -A 20 'public boolean isCompatible\(ApplicationJson applicationJson\)' app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaMigration.java
rg -A 20 'public boolean isAutocommitVersionBump\(ApplicationJson applicationJson\)' app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaMigration.java
rg -A 20 'public ApplicationJson migrateServerSchema\(ApplicationJson applicationJson\)' app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaMigration.java

Length of output: 719



Script:

#!/bin/bash
# Extracting the implementations of the methods called within `migrateArtifactToLatestSchema`
rg 'void setSchemaVersions' -A 20 app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaMigration.java
rg 'boolean isCompatible' -A 20 app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaMigration.java
rg 'boolean isAutocommitVersionBump' -A 20 app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaMigration.java
rg 'ApplicationJson migrateServerSchema' -A 20 app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaMigration.java

Length of output: 5119

app/server/appsmith-server/src/main/java/com/appsmith/server/exports/internal/partial/PartialExportServiceCEImpl.java (2)

60-60: The addition of JsonSchemaVersions is correctly placed. Ensure it is properly initialized in the constructor.


81-82: Proper usage of jsonSchemaVersions to set both server and client schema versions in the export JSON. This ensures compatibility during imports.

app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/ResponseUtilsCE.java (2)

33-34: Ensure JsonSchemaVersions is correctly autowired and initialized.


322-323: Correct implementation of schema version checks using JsonSchemaVersions. This is crucial for maintaining compatibility and deciding the auto-update behavior.

app/server/appsmith-server/src/main/java/com/appsmith/server/exports/internal/ExportServiceCEImpl.java (2)

56-56: The addition of JsonSchemaVersions is correctly placed and properly initialized in the constructor. This integration is key for managing JSON schema versions effectively.

Also applies to: 76-76


128-129: Proper usage of jsonSchemaVersions to set both server and client schema versions in the export JSON. This ensures compatibility during imports and is crucial for version management.

app/server/appsmith-server/src/test/java/com/appsmith/server/git/autocommit/helpers/AutoCommitEligibilityHelperTest.java (2)

218-220: Usage of CachedFeatures to manage feature flags within tests is a good practice as it allows for easier manipulation and control over feature toggles during testing.

Also applies to: 276-277, 393-394


411-412: Consider caching the result of getClientVersion() and getServerVersion() if these methods are called frequently to reduce overhead.
[PERFORMANCE]

app/server/appsmith-server/src/test/java/com/appsmith/server/git/autocommit/AutoCommitEventHandlerImplTest.java (2)

444-444: Good use of setServerSchemaVersion to simulate schema version increment in testing server-side migration.


106-107: Ensure JsonSchemaVersions is utilized effectively in tests, considering it's instantiated but not used directly in any test method here.

app/server/appsmith-server/src/test/java/com/appsmith/server/git/autocommit/AutoCommitServiceTest.java (3)

203-205: Good integration of JsonSchemaVersions to dynamically determine the server schema version based on migration eligibility in tests.


234-239: Proper setup of feature flags using CachedFeatures to control test behavior based on release_git_autocommit_feature_enabled. This is crucial for testing feature-flagged functionalities.


280-280: Consistent use of setServerSchemaVersion across multiple test methods to simulate different scenarios of schema version changes. This helps in thoroughly testing the auto-commit logic under various conditions.

Also applies to: 561-561, 634-634

app/server/appsmith-server/src/main/java/com/appsmith/server/imports/internal/ImportServiceCEImpl.java (2)

68-68: Integrate JsonSchemaMigration to handle JSON schema migrations effectively.

This change aligns with the PR's objective to manage JSON schema versions more effectively, enhancing the robustness of the import functionality.


424-424: Implement schema migration in the import process.

The integration of jsonSchemaMigration.migrateArtifactToLatestSchema is crucial for ensuring that artifacts are compatible with the latest schema versions before import, which is a significant improvement in maintaining data integrity.

app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/CreateDBTablePageSolutionCEImpl.java (2)

98-98: Introduce JsonSchemaMigration as a dependency.

This change aligns with the PR's objective to manage JSON schema versions and migrations more effectively. The addition of JsonSchemaMigration as a dependency is crucial for handling schema migrations within this class.


575-575: Incorporate schema migration in fetchTemplateApplication.

The integration of jsonSchemaMigration.migrateArtifactToLatestSchema within fetchTemplateApplication method ensures that the template application is always compliant with the latest JSON schema. This is a critical enhancement for maintaining data integrity and compatibility.

app/server/appsmith-server/src/test/java/com/appsmith/server/exports/internal/ExportServiceTests.java (4)

192-194: The addition of JsonSchemaVersions as a dependency in the ExportServiceTests class is consistent with the PR's objective to manage JSON schema versions more effectively. Ensure that appropriate tests are added or updated to cover the new functionality introduced by this dependency.


735-738: The use of JsonSchemaVersions to obtain the server and client schema versions for comparison in tests is a good practice. This ensures that the tests are always synchronized with the current schema versions used by the application. Consider adding more assertions if necessary to cover all edge cases.


1924-1925: It's good to see that the testApplication object is being set with the latest client and server schema versions. This ensures that the tests reflect the most recent changes in the schema versions and helps in catching any discrepancies early.


2023-2024: Similar to the previous comment, setting the client and server schema versions directly on the testApplication object is a good practice. This will help ensure that any tests involving this application instance are using the correct versions.

app/server/appsmith-server/src/test/java/com/appsmith/server/git/CommonGitServiceCETest.java (1)

299-299: There is a direct cast to ApplicationJson in the map operation. Ensure that this cast is safe by either checking the type before casting or handling a potential ClassCastException.

Verification successful

There is no migrateArtifactToLatestSchema method directly found in the JsonSchemaMigration class. However, there is a migrateArtifactExchangeJsonToLatestSchema method that internally calls migrateApplicationJsonToLatestSchema when the artifact type is APPLICATION. The migrateApplicationJsonToLatestSchema method returns a Mono<ApplicationJson>, ensuring that the cast to ApplicationJson is safe in this context.

  • migrateArtifactExchangeJsonToLatestSchema method:
    • Calls migrateApplicationJsonToLatestSchema if the artifact type is APPLICATION.
    • Returns a Mono<ApplicationJson> for application artifacts.

Thus, the cast to ApplicationJson in the map operation is safe.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Check for type safety before casting to ApplicationJson
grep -C 3 "ApplicationJson" app/server/appsmith-server/src/test/java/com/appsmith/server/git/CommonGitServiceCETest.java

Length of output: 7653



Script:

#!/bin/bash
# Search for the implementation of the migrateArtifactToLatestSchema method
ast-grep --lang java --pattern 'migrateArtifactToLatestSchema($_)' 

Length of output: 68



Script:

#!/bin/bash
# Search for the definition of the jsonSchemaMigration object
rg 'jsonSchemaMigration' --type java

Length of output: 5738



Script:

#!/bin/bash
# Search for the definition of the JsonSchemaMigration class
rg 'class JsonSchemaMigration' --type java

Length of output: 316



Script:

#!/bin/bash
# Search for the migrateArtifactToLatestSchema method within the JsonSchemaMigration class
ast-grep --lang java --pattern 'public $_ migrateArtifactToLatestSchema($_)' app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaMigration.java

Length of output: 520



Script:

#!/bin/bash
# List all methods within the JsonSchemaMigration class to locate the migrateArtifactToLatestSchema method
ast-grep --lang java --pattern 'public $_ $_($_) { $$$ }' app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaMigration.java

Length of output: 3650

app/server/appsmith-server/src/test/java/com/appsmith/server/imports/internal/ImportServiceTests.java (7)

235-240: Proper use of Spring's @Autowired for dependency injection. Good job ensuring that the new dependencies are correctly set up for use in tests.


363-363: Correct application of the migrateArtifactToLatestSchema method in the stream's map operation. This ensures that each artifact is migrated as needed.


756-759: Good update in assertions to use instance methods from JsonSchemaVersions. This change ensures consistency with the new architectural approach.


2724-2724: Proper use of migrateArtifactToLatestSchema within a Mono map operation. This ensures that the application JSON is correctly migrated before further processing.


2736-2738: Correctly updated assertions to use the instance methods of JsonSchemaVersions. This ensures that the tests are aligned with the new instance-based approach.


5032-5033: Properly setting schema versions on the test application instance using the new JsonSchemaVersions methods. This aligns with the updated approach to schema version management.


5130-5131: Identical to previous changes, correctly setting schema versions on the test application instance. Good consistency across test setups.

Comment on lines +233 to +238
@Autowired
JsonSchemaMigration jsonSchemaMigration;

@Autowired
JsonSchemaVersions jsonSchemaVersions;

Copy link
Contributor

Choose a reason for hiding this comment

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

Consider using constructor injection for JsonSchemaMigration and JsonSchemaVersions instead of field injection to ensure immutability and easier testing.


It's a good practice to mark autowired fields as final if they are not expected to change after construction. This ensures immutability where possible.

return stringifiedFile
.map(data -> gson.fromJson(data, ApplicationJson.class))
.map(JsonSchemaMigration::migrateArtifactToLatestSchema)
.map(jsonSchemaMigration::migrateArtifactToLatestSchema)
Copy link
Contributor

Choose a reason for hiding this comment

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

Usage of method chaining directly on the map operation can lead to reduced readability especially when transformations are non-trivial. Consider breaking down the operations or encapsulating them into a well-named method.


The transformation inside the map operation is quite dense. Consider extracting this to a method with a descriptive name to improve readability.


Tip

Codebase Verification

The current implementation of the createAppJson method does not include any error handling for exceptions that might be thrown by the migrateArtifactToLatestSchema method. It would be prudent to add proper error handling, such as using onErrorMap, doOnError, or similar reactive methods, to ensure exceptions are managed gracefully.

  • Location: app/server/appsmith-server/src/test/java/com/appsmith/server/git/CommonGitServiceCETest.java
  • Line: 299
Analysis chain

The method createAppJson uses the migrateArtifactToLatestSchema method which could throw exceptions that are not handled here. Ensure that there is proper error handling, perhaps by using onErrorMap or similar reactive methods to handle potential exceptions gracefully.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that exceptions in migrateArtifactToLatestSchema are handled
grep -C 3 "migrateArtifactToLatestSchema" app/server/appsmith-server/src/test/java/com/appsmith/server/git/CommonGitServiceCETest.java

Length of output: 405



Script:

#!/bin/bash
# Search for reactive error handling methods around the migrateArtifactToLatestSchema call
grep -C 10 -E "migrateArtifactToLatestSchema|onErrorMap|doOnError|onErrorResume|onErrorReturn" app/server/appsmith-server/src/test/java/com/appsmith/server/git/CommonGitServiceCETest.java

Length of output: 1041

@Autowired
GitFileSystemTestHelper gitFileSystemTestHelper;

JsonSchemaVersions jsonSchemaVersions = new JsonSchemaVersions();
Copy link
Contributor

Choose a reason for hiding this comment

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

Initialization of JsonSchemaVersions should be part of the setup method to ensure it's freshly instantiated before each test.

- JsonSchemaVersions jsonSchemaVersions = new JsonSchemaVersions();
+ @BeforeEach
+ void setup() {
+     jsonSchemaVersions = new JsonSchemaVersions();
+ }
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
JsonSchemaVersions jsonSchemaVersions = new JsonSchemaVersions();
@BeforeEach
void setup() {
jsonSchemaVersions = new JsonSchemaVersions();
}

Comment on lines +128 to +129
JsonSchemaVersions jsonSchemaVersions = new JsonSchemaVersions();

Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

The instantiation of JsonSchemaVersions in AutoCommitServiceTest.java is not utilized in any test methods. This suggests that the instantiation might be redundant.

  • Location: app/server/appsmith-server/src/test/java/com/appsmith/server/git/autocommit/AutoCommitServiceTest.java, lines 128-129.
Analysis chain

Ensure JsonSchemaVersions is utilized effectively in tests, considering it's instantiated but not used directly in any test method here.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify if JsonSchemaVersions is used in any test method.
# Test: Search for its usage within test methods. Expect: At least one usage instance.
rg --type java --multiline 'JsonSchemaVersions.*\n.*getServerVersion' app/server/appsmith-server/src/test/java/com/appsmith/server/git/autocommit/AutoCommitServiceTest.java

Length of output: 174



Script:

#!/bin/bash
# Description: Verify if JsonSchemaVersions is used in any capacity within the test file.
# Test: Search for any usage of JsonSchemaVersions within the test file.
rg 'JsonSchemaVersions' app/server/appsmith-server/src/test/java/com/appsmith/server/git/autocommit/AutoCommitServiceTest.java

Length of output: 254


// this leads to server migration requirement as true
Mockito.doReturn(Mono.just(JsonSchemaVersions.serverVersion - 1))
Mockito.doReturn(Mono.just(jsonSchemaVersions.getServerVersion() - 1))
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

The getServerVersion() methods in both JsonSchemaVersions and JsonSchemaVersionsFallback do not include explicit null value handling or exception handling.

  • JsonSchemaVersions.getServerVersion() returns super.getServerVersion() + 1.
  • JsonSchemaVersionsFallback.getServerVersion() returns serverVersion.

The absence of null handling and exception handling in these methods means that any issues related to null values or exceptions must be managed by the calling code.

Locations needing attention:

  • JsonSchemaVersions.java
  • JsonSchemaVersionsFallback.java
Analysis chain

Ensure that the getServerVersion() method handles possible null values or exceptions that might arise from incorrect data handling.

Also applies to: 165-165, 196-196, 233-233, 257-257, 282-282

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that `getServerVersion()` method handles nulls and exceptions correctly.

# Test: Search for the method implementation. Expect: Proper null checks and exception handling.
ast-grep --lang java --pattern $'public int getServerVersion() {
  $$$
}'

Length of output: 74



Script:

#!/bin/bash
# Description: Search for the `getServerVersion()` method in the codebase and inspect its implementation.

# Search for the method definition
rg 'int getServerVersion\('

# If found, print the method implementation
rg -A 10 -B 2 'int getServerVersion\('

Length of output: 70



Script:

#!/bin/bash
# Description: Search for the `getServerVersion()` method in the codebase and inspect its implementation.

# Search for the method definition without specifying the return type
rg 'getServerVersion\('

# If found, print the method implementation
rg -A 10 -B 2 'getServerVersion\('

Length of output: 93287



Script:

#!/bin/bash
# Description: Extract the full implementation of `getServerVersion()` in `JsonSchemaVersions` and `JsonSchemaVersionsFallback`.

# Extract the method implementation in JsonSchemaVersions
rg -A 10 -B 2 'public Integer getServerVersion\(' app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaVersions.java

# Extract the method implementation in JsonSchemaVersionsFallback
rg -A 10 -B 2 'public Integer getServerVersion\(' app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaVersionsFallback.java

Length of output: 875

.map(metadataMap -> {
return metadataMap.getOrDefault(
CommonConstants.SERVER_SCHEMA_VERSION, JsonSchemaVersions.serverVersion);
CommonConstants.SERVER_SCHEMA_VERSION, jsonSchemaVersions.getServerVersion());
Copy link
Contributor

Choose a reason for hiding this comment

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

The methods getServerSchemaVersion and getClientSchemaVersion should robustly handle cases where metadataJsonObject might be null or does not contain the expected keys.

- return jsonSchemaVersions.getServerVersion();
+ if (metadataJsonObject == null || !metadataJsonObject.has(SERVER_SCHEMA_VERSION)) {
+     return jsonSchemaVersions.getServerVersion();
+ }
+ return metadataJsonObject.get(SERVER_SCHEMA_VERSION).getAsInt();

Also applies to: 427-427

import com.appsmith.server.helpers.PluginExecutorHelper;
import com.appsmith.server.helpers.ResponseUtils;
import com.appsmith.server.layouts.UpdateLayoutService;
import com.appsmith.server.migrations.JsonSchemaMigration;
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

The scripts confirmed the presence of the JsonSchemaMigration instance in the CreateDBTablePageSolutionImpl class constructor but did not find any usages of this instance within the class methods. This indicates that while the dependency is injected, it might not be utilized within the class.

  • JsonSchemaMigration is declared but not used in any methods in CreateDBTablePageSolutionImpl.

Please review the implementation to ensure that the JsonSchemaMigration dependency is appropriately utilized where necessary.

Analysis chain

The addition of JsonSchemaMigration in the CreateDBTablePageSolutionImpl constructor is implemented correctly. This change is essential for ensuring that database table creation logic can handle different JSON schema versions appropriately. Confirm that all relevant methods in this class are now using this new dependency for schema migrations.

Also applies to: 24-24, 42-43, 61-62

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that methods related to schema migrations in CreateDBTablePageSolutionImpl are using JsonSchemaMigration instance.
# Test: Search for JsonSchemaMigration method usages in CreateDBTablePageSolutionImpl.
rg --type java --files-with-matches $'JsonSchemaMigration' ./app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/CreateDBTablePageSolutionImpl.java | xargs cat | rg $'migrateArtifactToLatestSchema'

Length of output: 212



Script:

#!/bin/bash
# Description: Verify the presence of JsonSchemaMigration instance and its usage in CreateDBTablePageSolutionImpl class.

# Step 1: Confirm the presence of JsonSchemaMigration instance in the class.
echo "Searching for JsonSchemaMigration instance declaration in CreateDBTablePageSolutionImpl..."
rg --type java 'JsonSchemaMigration' ./app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/CreateDBTablePageSolutionImpl.java

# Step 2: List all methods in CreateDBTablePageSolutionImpl class.
echo "Listing all methods in CreateDBTablePageSolutionImpl class..."
ast-grep --lang java --pattern $'class CreateDBTablePageSolutionImpl { $$$ public $_($_) { $$$ } $$$ }' ./app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/CreateDBTablePageSolutionImpl.java

# Step 3: Search for any usage of JsonSchemaMigration within the class.
echo "Searching for any usage of JsonSchemaMigration within the class..."
rg --type java 'JsonSchemaMigration' ./app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/CreateDBTablePageSolutionImpl.java

Length of output: 1197

Comment on lines +67 to +68
private final JsonSchemaVersions jsonSchemaVersions;

Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

The search results show multiple references to JsonSchemaVersions, but none indicate its initialization within the CommonGitFileUtilsCE class. This suggests that JsonSchemaVersions may not be properly initialized, which could lead to null pointer exceptions.

  • app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/CommonGitFileUtilsCE.java: The file contains a declaration of JsonSchemaVersions but no evidence of its initialization.

Please review the constructor of CommonGitFileUtilsCE and ensure that JsonSchemaVersions is properly instantiated or injected.

Analysis chain

Proper initialization of JsonSchemaVersions is crucial. Ensure it is being injected or instantiated correctly to avoid null pointer exceptions.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify proper initialization of `JsonSchemaVersions`.

# Test: Search for the constructor usage. Expect: `JsonSchemaVersions` to be properly initialized.
ast-grep --lang java --pattern $'public CommonGitFileUtilsCE($_, $_, $_, $_, $_, $_, $_, JsonSchemaVersions jsonSchemaVersions) {
  $$$
}'

Length of output: 666



Script:

#!/bin/bash
# Description: Verify proper initialization of `JsonSchemaVersions`.

# Test: Search for the constructor usage. Expect: `JsonSchemaVersions` to be properly initialized.
ast-grep --lang java --pattern $'constructor CommonGitFileUtilsCE($$$) {
  $$$
}'

Length of output: 82



Script:

#!/bin/bash
# Description: Verify proper initialization of `JsonSchemaVersions`.

# Test: Search for the constructor usage. Expect: `JsonSchemaVersions` to be properly initialized.
rg 'public CommonGitFileUtilsCE\(' -A 10 --glob '**/*.java'

Length of output: 61



Script:

#!/bin/bash
# Description: Verify proper initialization of `JsonSchemaVersions`.

# Test: Search for field declaration and initialization of `JsonSchemaVersions`.
ast-grep --lang java --pattern 'JsonSchemaVersions jsonSchemaVersions;' --json | jq '.[] | {file: .file, line: .location.start.line}'

Length of output: 135



Script:

#!/bin/bash
# Description: Verify proper initialization of `JsonSchemaVersions`.

# Test: Search for any mention of `JsonSchemaVersions` to understand its usage and verify its initialization.
rg 'JsonSchemaVersions' --glob '**/*.java'

Length of output: 8911

@github-actions
Copy link

Failed server tests

  • com.appsmith.server.services.ce.ThemeImportableServiceCETest#importThemesToApplication_WhenBothImportedThemesAreCustom_NewThemesCreated

@github-actions
Copy link

Failed server tests

  • com.appsmith.server.git.CommonGitServiceCETest#createBranch_BranchDeleteLogo_SrcLogoRemainsUnchanged

@brayn003 brayn003 added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Jun 14, 2024
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