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: conditionally set FqN name for partial import #37694

Merged
merged 17 commits into from
Dec 12, 2024

Conversation

AnaghHegde
Copy link
Member

@AnaghHegde AnaghHegde commented Nov 26, 2024

Description

The fullyQulifiedName aka path for used for js objects was set to actions as well during the partial import. This was causing the diff in actual name and fullyQualifiedName when the name is edited in UI. Hence few of the actions were failing in view mode.

Fixes #33651

Automation

/ok-to-test tags="@tag.ImportExport, @tag.Git"

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12290147226
Commit: e60ca39
Cypress dashboard.
Tags: @tag.ImportExport, @tag.Git
Spec:


Thu, 12 Dec 2024 05:52:15 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Improved action refactoring functionality, ensuring consistent naming conventions across different plugin types.
    • Enhanced handling of action references during refactoring, ensuring robust updates and checks for action configurations.
  • Bug Fixes

    • Fixed issues related to the retrieval and updating of actions based on context, improving overall efficiency.

Copy link
Contributor

coderabbitai bot commented Nov 26, 2024

Walkthrough

The changes in the NewActionRefactoringServiceCEImpl class primarily enhance the action refactoring functionality. Modifications include updates to the updateRefactoredEntity and refactorReferencesInExistingEntities methods, introducing conditional logic for plugin types and improving action reference handling. The control flow has been optimized for more efficient processing of actions, while logging statements remain to aid in debugging.

Changes

File Path Change Summary
app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/refactors/NewActionRefactoringServiceCEImpl.java Updated updateRefactoredEntity method with conditional logic for non-JS plugin types. Updated refactorReferencesInExistingEntities method to enhance action configuration handling and binding paths.

Assessment against linked issues

Objective Addressed Explanation
Ensure APIs work correctly in deployed mode (#33651) The changes do not directly address API execution issues in view mode.

Possibly related PRs

Suggested labels

High, Core Query Execution, Import-Export-App

Suggested reviewers

  • sondermanish
  • NilanshBansal

In the realm of code where actions play,
Refactoring shines, brightening the way.
With checks for plugins, both old and new,
The paths are updated, the bindings too!
A dance of logic, so neat and refined,
In the world of Appsmith, progress aligned! 🌟


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 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 Ballpark: S ~2xDev in 1xSprint Bug Something isn't working Medium Issues that frustrate users due to poor UX Needs Triaging Needs attention from maintainers to triage Partial-import-export Label for granular reusability. Production Templates Product Issues related to Templates Widgets & Accelerators Pod Issues related to widgets & Accelerators labels Nov 26, 2024
@AnaghHegde AnaghHegde added the ok-to-test Required label for CI label Nov 26, 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: 0

🧹 Outside diff range and nitpick comments (1)
app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/importable/NewActionImportableServiceCEImpl.java (1)

Line range hint 473-491: Add test coverage for partial import FQN handling

Please add test cases to verify:

  1. FQN setting behavior for partial imports
  2. FQN setting behavior for regular imports
  3. Edge cases with published/unpublished actions
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between b778d2c and 817ad74.

📒 Files selected for processing (1)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/importable/NewActionImportableServiceCEImpl.java (3 hunks)
🔇 Additional comments (3)
app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/importable/NewActionImportableServiceCEImpl.java (3)

305-306: LGTM: Method call updated correctly

The isPartialImport parameter is properly passed from the importing metadata.


473-475: LGTM: Method signature updated appropriately

The method signature change aligns with the PR objectives to handle partial imports differently.


489-491: Verify the conditional FQN setting behavior

The conditional logic for setting FQN looks correct, but we should verify that this change doesn't affect existing functionality for non-partial imports.

✅ Verification successful

FQN setting behavior is consistent with codebase patterns

The conditional FQN setting in partial imports aligns with the codebase's established patterns. The search results show that:

  1. FQN is consistently set alongside name changes in various contexts (LayoutCollectionService, ActionCollectionService)
  2. For non-partial imports, FQN matches the action name pattern as seen in test cases
  3. The conditional logic prevents FQN conflicts during partial imports while maintaining expected behavior for full imports
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other occurrences of setFullyQualifiedName to ensure consistent behavior
ast-grep --pattern 'setFullyQualifiedName($_)'

# Search for tests related to partial imports
rg -l "partial.*import.*test" -g "*.java"

Length of output: 130905


Script:

#!/bin/bash
# Search for setFullyQualifiedName usage in Java files
rg -t java "setFullyQualifiedName" -A 2 -B 2

# Search for tests related to partial imports
rg -t java "partial.*import.*test" -A 2 -B 2

Length of output: 18413

@AnaghHegde AnaghHegde added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Nov 26, 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: 0

🧹 Outside diff range and nitpick comments (1)
app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/refactors/NewActionRefactoringServiceCEImpl.java (1)

136-141: Consider adding test coverage for the new FQN logic.

While the implementation looks correct, it would be beneficial to add test cases covering:

  1. Non-JS plugins with new FQN provided
  2. Non-JS plugins falling back to action name
  3. JS plugins maintaining original behavior

Would you like me to help generate test cases for these scenarios?

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 817ad74 and e948632.

📒 Files selected for processing (1)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/refactors/NewActionRefactoringServiceCEImpl.java (1 hunks)
🔇 Additional comments (1)
app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/refactors/NewActionRefactoringServiceCEImpl.java (1)

136-141: LGTM! The conditional FQN setting for non-JS plugins addresses the issue.

The implementation correctly handles the FQN setting for non-JS plugins while preserving the existing behavior for JS plugins. This fixes the discrepancy between actual names and FQNs during partial imports.

Let's verify the impact on JS plugins:

✅ Verification successful

The conditional FQN handling for non-JS plugins is correctly implemented

The code search confirms that JS plugins have special handling throughout the codebase, and this change maintains that by explicitly skipping FQN updates for JS plugins while properly handling FQN for all other plugin types. The implementation aligns with the existing JS plugin patterns in the codebase, particularly around collection handling and dynamic bindings.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that JS plugins are not affected by this change
# and maintain their original FQN handling behavior

# Search for JS plugin actions and their FQN handling
ast-grep --pattern 'class $_ implements EntityRefactoringServiceCE {
  $$$
  updateRefactoredEntity($_) {
    $$$
    if (PluginType.JS.equals($_)) {
      $$$
    }
    $$$
  }
  $$$
}'

Length of output: 188


Script:

#!/bin/bash
# Let's try a different approach to find JS plugin handling in the refactoring service

# Search for the specific file and show context around plugin type checks
rg -U "PluginType\.JS" app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/refactors/NewActionRefactoringServiceCEImpl.java -B 5 -A 5

# Also search for any other references to JS plugin handling in the codebase
rg -U "PluginType\.JS.*action" --type java -B 3 -A 3

Length of output: 7441

@sondermanish
Copy link
Contributor

Looks good, let's wait for CI to pass?

sondermanish
sondermanish previously approved these changes Nov 27, 2024
@AnaghHegde AnaghHegde added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Nov 28, 2024
@AnaghHegde AnaghHegde added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Dec 2, 2024
@sondermanish
Copy link
Contributor

Looks good, waiting for tests to pass for approval

sondermanish
sondermanish previously approved these changes Dec 5, 2024
@AnaghHegde AnaghHegde added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Dec 5, 2024
Copy link

github-actions bot commented Dec 5, 2024

Failed server tests

  • com.appsmith.server.helpers.GitFileUtilsTest#getSerializableResource_allEntitiesArePresentForApplication_keysIncludesSeparator

1 similar comment
Copy link

github-actions bot commented Dec 5, 2024

Failed server tests

  • com.appsmith.server.helpers.GitFileUtilsTest#getSerializableResource_allEntitiesArePresentForApplication_keysIncludesSeparator

Copy link

github-actions bot commented Dec 5, 2024

Failed server tests

  • com.appsmith.server.helpers.GitFileUtilsTest#getSerializableResource_allEntitiesArePresentForApplication_keysIncludesSeparator

sondermanish
sondermanish previously approved these changes Dec 9, 2024
Copy link

github-actions bot commented Dec 9, 2024

Failed server tests

  • com.appsmith.server.services.LayoutActionServiceTest#updateActionUpdatesLayout

1 similar comment
Copy link

github-actions bot commented Dec 9, 2024

Failed server tests

  • com.appsmith.server.services.LayoutActionServiceTest#updateActionUpdatesLayout

@nidhi-nair nidhi-nair removed their request for review December 10, 2024 05:16
Copy link

Failed server tests

  • com.appsmith.server.services.LayoutActionServiceTest#OnLoadActionsWhenActionDependentOnWidgetButNotPageLoadCandidate

@AnaghHegde AnaghHegde merged commit 8e30a38 into release Dec 12, 2024
42 checks passed
@AnaghHegde AnaghHegde deleted the fix/partial-ie-action branch December 12, 2024 13:02
github-actions bot pushed a commit to Zeral-Zhang/appsmith that referenced this pull request Feb 7, 2025
## Description
The fullyQulifiedName aka path for used for js objects was set to
actions as well during the partial import. This was causing the diff in
actual name and fullyQualifiedName when the name is edited in UI. Hence
few of the actions were failing in view mode.


Fixes appsmithorg#33651

## Automation

/ok-to-test tags="@tag.ImportExport, @tag.Git"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/12290147226>
> Commit: e60ca39
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=12290147226&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.ImportExport, @tag.Git`
> Spec:
> <hr>Thu, 12 Dec 2024 05:52:15 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Improved action refactoring functionality, ensuring consistent naming
conventions across different plugin types.
- Enhanced handling of action references during refactoring, ensuring
robust updates and checks for action configurations.

- **Bug Fixes**
- Fixed issues related to the retrieval and updating of actions based on
context, improving overall efficiency.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: sondermanish <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ballpark: S ~2xDev in 1xSprint Bug Something isn't working Medium Issues that frustrate users due to poor UX Needs Triaging Needs attention from maintainers to triage ok-to-test Required label for CI Partial-import-export Label for granular reusability. Production Templates Product Issues related to Templates Widgets & Accelerators Pod Issues related to widgets & Accelerators
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Execute API not working in view mode
2 participants