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

fix: update client version in JsonSchemaVersionsFallback (#38390) #38391

Conversation

rahulbarwal
Copy link
Contributor

@rahulbarwal rahulbarwal commented Dec 27, 2024

Description

Updated the client version from 1 to 2 in the JsonSchemaVersionsFallback class to align with the latest schema changes.
With introduction fo HTML column type in appsmith table, we don't want, apps exported from a newer version to be importable in the older version.

Fixes #38311
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.All"

🔍 Cypress test results

Tip

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


Fri, 03 Jan 2025 06:03:39 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Updated client version to reflect changes in the application.
    • Incremented client schema version to align with application updates.
  • Bug Fixes

    • Corrected the static client version to ensure accurate version reporting.
  • Tests

    • Enhanced test setup to initialize the application with the current client schema version.
    • Updated expected values in tests to reflect the new client schema version.

Updated the client version from 1 to 2 in the JsonSchemaVersionsFallback class to align with the latest schema changes.
With introduction fo HTML column type in appsmith table, we don't want, apps exported from a newer version to be importable in the older version.
@github-actions github-actions bot added Bug Something isn't working High This issue blocks a user from building or impacts a lot of users Needs Triaging Needs attention from maintainers to triage Release Table Widget V2 Issues related to Table Widget V2 Widgets & Accelerators Pod Issues related to widgets & Accelerators Widgets Product This label groups issues related to widgets labels Dec 27, 2024
Copy link
Contributor

coderabbitai bot commented Dec 27, 2024

Walkthrough

The pull request involves a minor version update in the JsonSchemaVersionsFallback class, specifically changing the clientVersion static variable from 1 to 2. This modification affects the return value of the getStaticClientVersion() method, indicating a version increment in the server-side migration configuration, which may relate to schema versioning or compatibility adjustments.

Changes

File Change Summary
app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaVersionsFallback.java Updated clientVersion from 1 to 2
app/server/appsmith-server/src/test/resources/com/appsmith/server/migrations/application.json Updated clientSchemaVersion from 1.0 to 2.0
app/server/appsmith-server/src/test/java/com/appsmith/server/imports/internal/ImportServiceTests.java Added line to set clientSchemaVersion in setup method; updated expected value in applySchemaMigration test from 1 to 2
app/server/appsmith-server/src/test/resources/test_assets/ImportExportServiceTest/file-with-v1.json Updated clientSchemaVersion from 1 to 2

Assessment against linked issues

Objective Addressed Explanation
Resolve HTML Column Type dropdown issue [#38311] Unable to definitively confirm direct correlation with version change

Possibly Related PRs

Suggested Labels

Task

Suggested Reviewers

  • ApekshaBhosale
  • NandanAnantharamu
  • sharat87

Poem

Version bumps like gentle waves,
Migrations dance their silent staves,
One becomes two, a number's leap,
Softly coding while systems sleep 🌊🔢


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 019a8da and 51523c9.

📒 Files selected for processing (2)
  • app/server/appsmith-server/src/test/java/com/appsmith/server/imports/internal/ImportServiceTests.java (2 hunks)
  • app/server/appsmith-server/src/test/resources/test_assets/ImportExportServiceTest/file-with-v1.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/server/appsmith-server/src/test/java/com/appsmith/server/imports/internal/ImportServiceTests.java
🔇 Additional comments (1)
app/server/appsmith-server/src/test/resources/test_assets/ImportExportServiceTest/file-with-v1.json (1)

3-3: LGTM! Version update aligns with PR objectives.

The increment of clientSchemaVersion to 2 correctly implements the version compatibility check for HTML column type support.

Let's verify if we have test coverage for other version combinations:

✅ Verification successful

Version update is appropriate and test coverage is comprehensive

The test suite has excellent coverage for version compatibility testing with various combinations:

  • Client v1 with Server v1 (baseline)
  • Client v1 with Server v3, v7 (forward compatibility)
  • Client v2 with Server v1 (backward compatibility)
  • Incompatible version test (v10000)
  • Different formats (partial exports, building blocks)

The update to clientSchemaVersion: 2 in file-with-v1.json complements this test suite by adding coverage for HTML column type support.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for other version test files in the test assets directory
# Expected: Find test files with different version combinations

fd -t f . "app/server/appsmith-server/src/test/resources/test_assets/ImportExportServiceTest" \
  --exec grep -l "SchemaVersion"

Length of output: 1045


Script:

#!/bin/bash
# Let's check the schema versions in these files to ensure we have proper test coverage
for file in $(fd -t f . "app/server/appsmith-server/src/test/resources/test_assets/ImportExportServiceTest" --exec grep -l "SchemaVersion"); do
  echo "=== $file ==="
  grep -A 1 "SchemaVersion" "$file"
done

Length of output: 5018


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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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 generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

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.

@rahulbarwal rahulbarwal added the ok-to-test Required label for CI label Dec 27, 2024
Copy link

Failed server tests

  • com.appsmith.server.migrations.JsonSchemaMigrationTest#migrateArtifactToLatestSchema_whenFeatureFlagIsOn_returnsIncrementedValue

1 similar comment
Copy link

Failed server tests

  • com.appsmith.server.migrations.JsonSchemaMigrationTest#migrateArtifactToLatestSchema_whenFeatureFlagIsOn_returnsIncrementedValue

…o rahulbarwal/increase-clientSchemaVersion-to-prevent-HTML-column-based-apps-import-to-old-versions
Copy link

Failed server tests

  • com.appsmith.server.migrations.JsonSchemaMigrationTest#migrateArtifactToLatestSchema_whenFeatureFlagIsOn_returnsIncrementedValue

Updated the clientSchemaVersion in application.json from 1.0 to 2.0 to ensure that applications exported from newer versions cannot be imported into older versions, addressing potential compatibility issues with the introduction of HTML column types.
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: 1

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b3aaaea and d24930d.

📒 Files selected for processing (1)
  • app/server/appsmith-server/src/test/resources/com/appsmith/server/migrations/application.json (1 hunks)

@@ -1,6 +1,6 @@
{
"artifactJsonType": "APPLICATION",
"clientSchemaVersion": 1.0,
"clientSchemaVersion": 2.0,
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Test resources need to be updated to match new client schema version

The clientSchemaVersion update to 2.0 in migrations/application.json is correct and matches JsonSchemaVersionsFallback.clientVersion = 2, but other test resources are still using version 1.0/1 which needs to be updated:

  • test_assets/ImportExportServiceTest/*.json files need clientSchemaVersion: 2
  • git/*.json files need clientSchemaVersion: 2
  • imports/internal/faulty-dsl.json needs clientSchemaVersion: 2

These test files are used in import/export and migration tests that verify version compatibility. Having inconsistent versions across test resources could lead to false test failures.

🔗 Analysis chain

LGTM! Version update aligns with PR objectives.

The clientSchemaVersion update from 1.0 to 2.0 correctly implements the intended breaking change for HTML column type support.

Let's verify consistency across other test resources:


Inconsistent schema versions found in test resources - update needed

All test resources except migrations/application.json are using clientSchemaVersion 1.0/1, which conflicts with the schema version upgrade to 2.0. These test files need to be updated to maintain consistency:

  • test_assets/ImportExportServiceTest/*.json files (7 files)
  • git/*.json files (4 files)
  • imports/internal/faulty-dsl.json

Let's verify if these files are used in migration/import tests that specifically need the older version:


Let's check the test files to understand if they specifically test version compatibility:


Let's try a different approach to find version-related test cases:


Let's check the JsonSchemaVersions class to understand the version management:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Find and check clientSchemaVersion in other test resources
rg -l "clientSchemaVersion" app/server/appsmith-server/src/test/resources/ | while read -r file; do
  echo "=== $file ==="
  # Show the line containing clientSchemaVersion and its context
  rg -C 2 "clientSchemaVersion" "$file"
done

Length of output: 6498


Script:

#!/bin/bash
# Search for test files that use these json resources
rg -l "ImportExportServiceTest|faulty-dsl.json|ce-automation-test.json|autocommit.json" app/server/appsmith-server/src/test/java/

Length of output: 1148


Script:

#!/bin/bash
# Check test files for version-related tests
echo "=== Checking ServerSchemaMigrationEnforcerTest ==="
rg -C 5 "clientSchemaVersion|schemaVersion" app/server/appsmith-server/src/test/java/com/appsmith/server/git/ServerSchemaMigrationEnforcerTest.java

echo -e "\n=== Checking ImportServiceTests ==="
rg -C 5 "clientSchemaVersion|schemaVersion" app/server/appsmith-server/src/test/java/com/appsmith/server/imports/internal/ImportServiceTests.java

echo -e "\n=== Checking ImportApplicationTransactionServiceTest ==="
rg -C 5 "clientSchemaVersion|schemaVersion" app/server/appsmith-server/src/test/java/com/appsmith/server/transactions/ImportApplicationTransactionServiceTest.java

Length of output: 789


Script:

#!/bin/bash
# Search for JsonSchemaVersions or version-related imports/constants
echo "=== Checking for JsonSchemaVersions usage ==="
rg -C 5 "JsonSchemaVersions" app/server/appsmith-server/src/test/java/

echo -e "\n=== Checking for version-related test methods ==="
rg -C 5 "test.*[Vv]ersion|[Vv]ersion.*test" app/server/appsmith-server/src/test/java/

echo -e "\n=== Checking for version assertions ==="
rg -C 5 "assert.*[Vv]ersion|[Vv]ersion.*assert" app/server/appsmith-server/src/test/java/

Length of output: 69826


Script:

#!/bin/bash
# Check JsonSchemaVersions implementation
echo "=== Checking JsonSchemaVersions class ==="
rg -C 5 "class JsonSchemaVersions" app/server/appsmith-server/src/main/java/

echo -e "\n=== Checking JsonSchemaVersionsFallback class ==="
rg -C 5 "class JsonSchemaVersionsFallback" app/server/appsmith-server/src/main/java/

Length of output: 4895

Copy link

Failed server tests

  • com.appsmith.server.imports.internal.ImportServiceTests#applySchemaMigration_jsonFileWithFirstVersion_migratedToLatestVersionSuccess

@rahulbarwal rahulbarwal requested a review from a team as a code owner January 2, 2025 10:16
Copy link

github-actions bot commented Jan 2, 2025

Failed server tests

  • com.appsmith.server.git.ServerSchemaMigrationEnforcerTest#saveGitRepo_ImportAndThenExport_diffOccurs

@rahulbarwal rahulbarwal added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Jan 3, 2025
@rahulbarwal rahulbarwal merged commit 1405aa6 into release Jan 3, 2025
125 of 126 checks passed
@rahulbarwal rahulbarwal deleted the rahulbarwal/increase-clientSchemaVersion-to-prevent-HTML-column-based-apps-import-to-old-versions branch January 3, 2025 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working High This issue blocks a user from building or impacts a lot of users Needs Triaging Needs attention from maintainers to triage ok-to-test Required label for CI Release Table Widget V2 Issues related to Table Widget V2 Widgets & Accelerators Pod Issues related to widgets & Accelerators Widgets Product This label groups issues related to widgets
Projects
None yet
2 participants