Skip to content

chore: added compatibility for no artifact json type attribute in metadata.json#41156

Merged
sondermanish merged 1 commit intoreleasefrom
chore/rev-compatible-git-import
Aug 7, 2025
Merged

chore: added compatibility for no artifact json type attribute in metadata.json#41156
sondermanish merged 1 commit intoreleasefrom
chore/rev-compatible-git-import

Conversation

@sondermanish
Copy link
Contributor

@sondermanish sondermanish commented Jul 31, 2025

Description

Tip

Add a TL;DR when the description is longer than 500 words or extremely technical (helps the content, marketing, and DevRel team).

Please also include relevant motivation and context. List any dependencies that are required for this change. Add links to Notion, Figma or any other documents that might be relevant to the PR.

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/16641904067
Commit: 83fbbcb
Cypress dashboard.
Tags: @tag.Git
Spec:


Thu, 31 Jul 2025 07:34:44 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • Bug Fixes
    • Improved error handling during artifact type identification from Git repositories, ensuring more specific error messages and defaulting to the application artifact type in certain file system error cases.
    • Enhanced clarity of error messages when required metadata is missing or incomplete.

@sondermanish sondermanish requested a review from a team as a code owner July 31, 2025 06:42
@sondermanish sondermanish self-assigned this Jul 31, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 31, 2025

Walkthrough

This change introduces improved error handling in the process of identifying artifact types from a Git repository. A new method in the GitFSServiceCEImpl class manages specific file system errors, and the CommonGitFileUtilsCE class now returns more precise error codes and messages for missing metadata or attributes.

Changes

Cohort / File(s) Change Summary
GitFSServiceCEImpl Error Handling
app/server/appsmith-server/src/main/java/.../GitFSServiceCEImpl.java
Added a protected method for error handling during artifact type identification; updated error handling in artifact type retrieval.
CommonGitFileUtilsCE Error Codes
app/server/appsmith-server/src/main/java/.../CommonGitFileUtilsCE.java
Refined error codes and messages for missing metadata and attributes in artifact type retrieval logic.

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant GitFSServiceCEImpl
    participant CommonGitFileUtilsCE

    Caller->>GitFSServiceCEImpl: obtainArtifactTypeFromGitRepository()
    GitFSServiceCEImpl->>CommonGitFileUtilsCE: getArtifactJsonTypeOfRepository()
    CommonGitFileUtilsCE-->>GitFSServiceCEImpl: ArtifactType or error
    alt Error occurs
        GitFSServiceCEImpl->>GitFSServiceCEImpl: handleErrorWhileArtifactTypeIdentification(error)
        alt Error is GIT_FILE_SYSTEM_ERROR
            GitFSServiceCEImpl-->>Caller: Mono.just(ArtifactType.APPLICATION)
        else Other error
            GitFSServiceCEImpl-->>Caller: Propagate original error
        end
    else Success
        GitFSServiceCEImpl-->>Caller: ArtifactType
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

When errors arise in the Git repo’s night,
Now clearer codes shine, making debugging light.
If metadata’s missing, the message is clear—
No more vague errors to cause us fear!
With thoughtful handling in every case,
Our artifact checks now run with grace.
🛠️✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/rev-compatible-git-import

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this 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.

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.

@github-actions github-actions bot added the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label Jul 31, 2025
@sondermanish sondermanish added the ok-to-test Required label for CI label Jul 31, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/CommonGitFileUtilsCE.java (1)

880-881: Consider error type consistency.

The descriptive error message is an improvement, but there's a slight inconsistency: missing metadata uses NO_RESOURCE_FOUND (line 871) while missing artifactJsonType attribute uses GIT_FILE_SYSTEM_ERROR. Both represent missing file system resources.

Consider using consistent error types:

-        return Mono.error(new AppsmithException(
-                AppsmithError.GIT_FILE_SYSTEM_ERROR, "No artifactJsonType attribute found"));
+        return Mono.error(new AppsmithException(
+                AppsmithError.NO_RESOURCE_FOUND, "artifactJsonType attribute"));
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between e366a39 and 83fbbcb.

📒 Files selected for processing (2)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/git/fs/GitFSServiceCEImpl.java (1 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/CommonGitFileUtilsCE.java (2 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: brayn003
PR: appsmithorg/appsmith#40462
File: app/client/src/instrumentation/index.ts:0-0
Timestamp: 2025-04-29T09:12:14.552Z
Learning: Only comment on files that are directly related to the PR's objectives, even if other files appear in the diff. For PR #40462, the focus is on the import override feature for artifacts, not on instrumentation or telemetry files.
Learnt from: CR
PR: appsmithorg/appsmith#0
File: .cursor/rules/index.mdc:0-0
Timestamp: 2025-07-21T07:25:40.986Z
Learning: Pull request titles must follow the Conventional Commits specification (e.g., type(scope): description)
Learnt from: CR
PR: appsmithorg/appsmith#0
File: .cursor/rules/README.md:0-0
Timestamp: 2025-07-21T07:25:06.064Z
Learning: Pull request titles must follow semantic conventions as described in 'semantic-pr.md'
Learnt from: Aishwarya-U-R
PR: appsmithorg/appsmith#29405
File: app/client/cypress/e2e/Regression/ClientSide/Binding/TableV2_Widget_API_Pagination_spec.js:37-41
Timestamp: 2024-10-08T15:32:39.374Z
Learning: The pull request titled "test: Cypress | Replace static with Dynamic waits - Part 1" is part of a phased approach where only certain test specifications are targeted for static wait removal in the initial phase. Future phases will address additional specs.
Learnt from: Aishwarya-U-R
PR: appsmithorg/appsmith#29405
File: app/client/cypress/e2e/Regression/ClientSide/Binding/TableV2_Widget_API_Pagination_spec.js:37-41
Timestamp: 2024-07-26T21:12:57.228Z
Learning: The pull request titled "test: Cypress | Replace static with Dynamic waits - Part 1" is part of a phased approach where only certain test specifications are targeted for static wait removal in the initial phase. Future phases will address additional specs.
Learnt from: sharat87
PR: appsmithorg/appsmith#30252
File: deploy/docker/fs/usr/lib/python3/dist-packages/supervisor/appsmith_supervisor_stdout.py:21-29
Timestamp: 2024-07-26T21:12:57.228Z
Learning: The user has confirmed that the suggested changes to handle potential exceptions and improve the robustness of the `main` function in `appsmith_supervisor_stdout.py` are acceptable.
Learnt from: sharat87
PR: appsmithorg/appsmith#39337
File: app/server/appsmith-server/src/main/java/com/appsmith/server/imports/internal/ImportServiceCEImpl.java:154-160
Timestamp: 2025-02-18T15:18:20.927Z
Learning: Specific JSON parsing error handling using try-catch blocks isn't needed in the ImportServiceCEImpl's extractArtifactExchangeJson method as Mono.fromCallable provides adequate error handling.
Learnt from: brayn003
PR: appsmithorg/appsmith#38060
File: app/client/src/git/sagas/fetchLocalProfileSaga.ts:8-13
Timestamp: 2024-12-10T10:52:38.873Z
Learning: In `app/client/src/git/sagas/fetchLocalProfileSaga.ts` and similar Git sagas, error handling for `baseArtifactId` is managed outside the scope, so validation checks for `baseArtifactId` within the saga functions are unnecessary.
Learnt from: brayn003
PR: appsmithorg/appsmith#38681
File: app/client/src/git/requests/fetchRefsRequest.ts:11-21
Timestamp: 2025-01-15T20:46:28.171Z
Learning: Error handling through try-catch blocks is handled at a different layer and should not be added to API request functions in the Git module.
Learnt from: brayn003
PR: appsmithorg/appsmith#37830
File: app/client/packages/git/src/actions/checkoutBranchActions.ts:11-18
Timestamp: 2024-11-29T05:38:54.262Z
Learning: In the Git Redux actions (`app/client/packages/git/src/actions`), the `createSingleArtifactAction` function already handles loading state and error management, so additional checks in action creators are unnecessary.
Learnt from: brayn003
PR: appsmithorg/appsmith#38060
File: app/client/src/git/sagas/updateLocalProfileSaga.ts:35-40
Timestamp: 2024-12-10T10:52:51.127Z
Learning: In `app/client/src/git/sagas/updateLocalProfileSaga.ts`, it's acceptable to cast `error` to `string` when passing it to `gitArtifactActions.updateLocalProfileError`.
Learnt from: sharat87
PR: appsmithorg/appsmith#37829
File: app/client/packages/rts/src/ctl/backup/links/GitStorageLink.ts:12-20
Timestamp: 2024-11-29T09:32:52.382Z
Learning: In backup link classes like `GitStorageLink`, exceptions in `doBackup` methods are already handled externally, so adding try-catch blocks within these methods is unnecessary.
Learnt from: brayn003
PR: appsmithorg/appsmith#38681
File: app/client/src/git/constants/enums.ts:2-4
Timestamp: 2025-01-16T14:25:46.177Z
Learning: The GitArtifactType enum in TypeScript uses lowercase plural values: "applications", "packages", and "workflows" for Application, Package, and Workflow respectively.
Learnt from: brayn003
PR: appsmithorg/appsmith#37984
File: app/client/src/git/requests/fetchGitMetadataRequest.ts:6-10
Timestamp: 2024-12-05T11:00:39.952Z
Learning: The `fetchGitMetadataRequest` function in `app/client/src/git/requests/fetchGitMetadataRequest.ts` does not require additional error handling or timeout configuration.
app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/CommonGitFileUtilsCE.java (10)

Learnt from: sharat87
PR: #39337
File: app/server/appsmith-server/src/main/java/com/appsmith/server/imports/internal/ImportServiceCEImpl.java:154-160
Timestamp: 2025-02-18T15:18:20.927Z
Learning: Specific JSON parsing error handling using try-catch blocks isn't needed in the ImportServiceCEImpl's extractArtifactExchangeJson method as Mono.fromCallable provides adequate error handling.

Learnt from: brayn003
PR: #38060
File: app/client/src/git/sagas/fetchLocalProfileSaga.ts:8-13
Timestamp: 2024-12-10T10:52:38.873Z
Learning: In app/client/src/git/sagas/fetchLocalProfileSaga.ts and similar Git sagas, error handling for baseArtifactId is managed outside the scope, so validation checks for baseArtifactId within the saga functions are unnecessary.

Learnt from: brayn003
PR: #37830
File: app/client/packages/git/src/actions/checkoutBranchActions.ts:11-18
Timestamp: 2024-11-29T05:38:54.262Z
Learning: In the Git Redux actions (app/client/packages/git/src/actions), the createSingleArtifactAction function already handles loading state and error management, so additional checks in action creators are unnecessary.

Learnt from: brayn003
PR: #38060
File: app/client/src/git/sagas/updateLocalProfileSaga.ts:35-40
Timestamp: 2024-12-10T10:52:51.127Z
Learning: In app/client/src/git/sagas/updateLocalProfileSaga.ts, it's acceptable to cast error to string when passing it to gitArtifactActions.updateLocalProfileError.

Learnt from: brayn003
PR: #37984
File: app/client/src/git/requests/fetchGitMetadataRequest.ts:6-10
Timestamp: 2024-12-05T11:00:39.952Z
Learning: The fetchGitMetadataRequest function in app/client/src/git/requests/fetchGitMetadataRequest.ts does not require additional error handling or timeout configuration.

Learnt from: sharat87
PR: #37672
File: deploy/docker/fs/opt/appsmith/caddy-reconfigure.mjs:251-258
Timestamp: 2024-11-25T10:19:42.548Z
Learning: In the JavaScript file deploy/docker/fs/opt/appsmith/caddy-reconfigure.mjs, explicit error handling for file operations within the finalizeHtmlFiles function is not necessary because failures will show up as exceptions anyway.

Learnt from: sondermanish
PR: #36413
File: app/server/appsmith-server/src/main/java/com/appsmith/server/imports/internal/ImportServiceCEImpl.java:514-518
Timestamp: 2024-10-08T15:32:34.114Z
Learning: In the ImportServiceCEImpl class, when throwing new AppsmithException instances, avoid adding the original Throwable as the cause due to messaging constraints.

Learnt from: sondermanish
PR: #36413
File: app/server/appsmith-server/src/main/java/com/appsmith/server/imports/internal/ImportServiceCEImpl.java:514-518
Timestamp: 2024-09-20T07:55:30.235Z
Learning: In the ImportServiceCEImpl class, when throwing new AppsmithException instances, avoid adding the original Throwable as the cause due to messaging constraints.

Learnt from: nidhi-nair
PR: #29372
File: app/server/appsmith-server/src/main/java/com/appsmith/server/applications/jslibs/ApplicationJsLibServiceCEImpl.java:51-56
Timestamp: 2024-10-08T15:32:34.115Z
Learning: The updateJsLibsInContext method in the ApplicationJsLibServiceCEImpl class was mistakenly referred to as a new method in a previous comment. It is important to accurately assess the context of changes in a pull request to avoid misrepresenting the nature of the code modifications.

Learnt from: nidhi-nair
PR: #29372
File: app/server/appsmith-server/src/main/java/com/appsmith/server/applications/jslibs/ApplicationJsLibServiceCEImpl.java:51-56
Timestamp: 2024-07-26T21:12:57.228Z
Learning: The updateJsLibsInContext method in the ApplicationJsLibServiceCEImpl class was mistakenly referred to as a new method in a previous comment. It is important to accurately assess the context of changes in a pull request to avoid misrepresenting the nature of the code modifications.

app/server/appsmith-server/src/main/java/com/appsmith/server/git/fs/GitFSServiceCEImpl.java (11)

Learnt from: sharat87
PR: #39337
File: app/server/appsmith-server/src/main/java/com/appsmith/server/imports/internal/ImportServiceCEImpl.java:154-160
Timestamp: 2025-02-18T15:18:20.927Z
Learning: Specific JSON parsing error handling using try-catch blocks isn't needed in the ImportServiceCEImpl's extractArtifactExchangeJson method as Mono.fromCallable provides adequate error handling.

Learnt from: sondermanish
PR: #36413
File: app/server/appsmith-server/src/main/java/com/appsmith/server/imports/internal/ImportServiceCEImpl.java:514-518
Timestamp: 2024-10-08T15:32:34.114Z
Learning: In the ImportServiceCEImpl class, when throwing new AppsmithException instances, avoid adding the original Throwable as the cause due to messaging constraints.

Learnt from: sondermanish
PR: #36413
File: app/server/appsmith-server/src/main/java/com/appsmith/server/imports/internal/ImportServiceCEImpl.java:514-518
Timestamp: 2024-09-20T07:55:30.235Z
Learning: In the ImportServiceCEImpl class, when throwing new AppsmithException instances, avoid adding the original Throwable as the cause due to messaging constraints.

Learnt from: brayn003
PR: #38060
File: app/client/src/git/sagas/fetchLocalProfileSaga.ts:8-13
Timestamp: 2024-12-10T10:52:38.873Z
Learning: In app/client/src/git/sagas/fetchLocalProfileSaga.ts and similar Git sagas, error handling for baseArtifactId is managed outside the scope, so validation checks for baseArtifactId within the saga functions are unnecessary.

Learnt from: sharat87
PR: #37829
File: app/client/packages/rts/src/ctl/backup/links/BackupFolderLink.ts:20-25
Timestamp: 2024-11-29T09:32:36.096Z
Learning: In the Appsmith backup process, exceptions are caught outside of the postBackup methods in the backup links, so adding additional error handling within these methods is unnecessary.

Learnt from: brayn003
PR: #37984
File: app/client/src/git/requests/updateGlobalConfigRequest.ts:9-13
Timestamp: 2024-12-05T10:57:15.397Z
Learning: In the TypeScript files within app/client/src/git/requests/, functions should not include internal error handling or request timeouts; they should allow errors to be thrown directly.

Learnt from: brayn003
PR: #38060
File: app/client/src/git/sagas/updateLocalProfileSaga.ts:35-40
Timestamp: 2024-12-10T10:52:51.127Z
Learning: In app/client/src/git/sagas/updateLocalProfileSaga.ts, it's acceptable to cast error to string when passing it to gitArtifactActions.updateLocalProfileError.

Learnt from: brayn003
PR: #37830
File: app/client/packages/git/src/actions/checkoutBranchActions.ts:11-18
Timestamp: 2024-11-29T05:38:54.262Z
Learning: In the Git Redux actions (app/client/packages/git/src/actions), the createSingleArtifactAction function already handles loading state and error management, so additional checks in action creators are unnecessary.

Learnt from: brayn003
PR: #38060
File: app/client/src/git/sagas/deleteBranchSaga.ts:38-45
Timestamp: 2024-12-10T10:52:57.789Z
Learning: In the TypeScript file app/client/src/git/sagas/deleteBranchSaga.ts, within the deleteBranchSaga function, error handling is managed outside the scope of the catch block. Therefore, casting error to string in this context is acceptable.

Learnt from: sharat87
PR: #37829
File: app/client/packages/rts/src/ctl/backup/links/GitStorageLink.ts:12-20
Timestamp: 2024-11-29T09:32:52.382Z
Learning: In backup link classes like GitStorageLink, exceptions in doBackup methods are already handled externally, so adding try-catch blocks within these methods is unnecessary.

Learnt from: brayn003
PR: #38681
File: app/client/src/git/constants/enums.ts:2-4
Timestamp: 2025-01-16T14:25:46.177Z
Learning: The GitArtifactType enum in TypeScript uses lowercase plural values: "applications", "packages", and "workflows" for Application, Package, and Workflow respectively.

🔇 Additional comments (3)
app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/CommonGitFileUtilsCE.java (1)

870-871: LGTM! Improved error specificity for missing metadata.

The change from generic GIT_FILE_SYSTEM_ERROR to NO_RESOURCE_FOUND with the specific resource name provides better error categorization and clearer identification of the missing resource.

app/server/appsmith-server/src/main/java/com/appsmith/server/git/fs/GitFSServiceCEImpl.java (2)

185-192: LGTM! Well-designed error recovery strategy.

The method provides a clean fallback mechanism by defaulting to APPLICATION when artifact type identification fails due to file system errors. The pattern matching on exception type and error code is appropriate, and proper error propagation is maintained for other error types.


200-204: Ignore error-code mismatch—no update needed

I checked CommonGitFileUtilsCE.getArtifactJsonTypeOfRepository in
app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/CommonGitFileUtilsCE.java
and found no references to either NO_RESOURCE_FOUND or GIT_FILE_SYSTEM_ERROR. The method simply propagates errors via Mono.error(error)—it doesn’t map missing-metadata cases to any specific AppsmithError. As a result, there’s no mismatch to address in your handler.

Likely an incorrect or invalid review comment.

@sondermanish sondermanish requested a review from ashit-rath August 5, 2025 09:26
@sondermanish sondermanish merged commit 9acfafd into release Aug 7, 2025
48 checks passed
@sondermanish sondermanish deleted the chore/rev-compatible-git-import branch August 7, 2025 09:07
@btsgh btsgh mentioned this pull request Aug 11, 2025
4 tasks
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