Skip to content

fix: reverted git executor layer#39949

Merged
sondermanish merged 1 commit intoreleasefrom
fix/revert-git-executor
Mar 27, 2025
Merged

fix: reverted git executor layer#39949
sondermanish merged 1 commit intoreleasefrom
fix/revert-git-executor

Conversation

@sondermanish
Copy link
Contributor

@sondermanish sondermanish commented Mar 27, 2025

Description

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 #39934
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/14103475195
Commit: 288e4cf
Cypress dashboard.
Tags: @tag.Git
Spec:


Thu, 27 Mar 2025 10:37:32 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced error recovery in update operations, ensuring that any pending changes are safely reverted when issues occur.
    • Improved conflict resolution during updates to maintain a stable and reliable system state for end-users.

@sondermanish sondermanish self-assigned this Mar 27, 2025
@sondermanish sondermanish requested a review from a team as a code owner March 27, 2025 09:42
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 27, 2025

Walkthrough

The changes update the GitExecutorCEImpl class to improve error handling and branch state management during Git operations. The methods pullApplication, getStatus, mergeBranch, and isMergeBranch now invoke a branch reset via resetToLastCommit when an error or uncommitted changes are detected. Additionally, the signature of resetToLastCommit has been updated to declare thrown exceptions for better error propagation.

Changes

File(s) Change Summary
app/.../GitExecutorCEImpl.java - Updated error handling in pullApplication, mergeBranch, and isMergeBranch to include resetting to the last commit on failures or unclean states.
- Modified getStatus to reset the branch if there are uncommitted changes.
- Changed resetToLastCommit signature to throw GitAPIException and IOException, and enhanced its logic to ensure a proper reset post-checkout.

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant GitExecutor
    participant GitService

    Caller->>GitExecutor: Request Git operation (e.g., pullApplication/getStatus)
    GitExecutor->>GitService: Execute Git command
    alt Operation successful
        GitService-->>GitExecutor: Return success
        GitExecutor-->>Caller: Return result
    else Operation encounters error
        GitExecutor->>GitService: Call resetToLastCommit to revert uncommitted changes
        GitService-->>GitExecutor: Confirm reset (or log failure)
        GitExecutor-->>Caller: Propagate error after reset attempt
    end
Loading

Possibly related PRs

Suggested labels

Bug, ok-to-test, Git Product

Suggested reviewers

  • sharat87
  • subrata71

Poem

In the code where errors hide,
A reset call now stands with pride.
Branches safe, with commits secure,
Git reigns in order, strong and sure 🎯.
Happy merging, let bugs subside!

✨ Finishing Touches
  • 📝 Generate Docstrings

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.
    • 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.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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 Bug Something isn't working label Mar 27, 2025
@sondermanish sondermanish added the ok-to-test Required label for CI label Mar 27, 2025
@github-actions github-actions bot added Git Product Issues related to version control product High This issue blocks a user from building or impacts a lot of users Needs Triaging Needs attention from maintainers to triage Packages & Git Pod All issues belonging to Packages and Git Production Release Blocker This issue must be resolved before the release labels Mar 27, 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: 1

🧹 Nitpick comments (2)
app/server/appsmith-git/src/main/java/com/appsmith/git/service/ce/GitExecutorCEImpl.java (2)

502-502: Consider logging reset failures separately.
Currently, if resetToLastCommit(git) fails here, the original error context may be overshadowed. Capturing both errors separately can streamline debugging.


856-862: Log or rethrow the original error.
Only the error message is returned, risking loss of the original stack trace. Consider logging or wrapping the original error to preserve debug details.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between f7664d1 and 288e4cf.

📒 Files selected for processing (1)
  • app/server/appsmith-git/src/main/java/com/appsmith/git/service/ce/GitExecutorCEImpl.java (6 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: build
  • GitHub Check: perform-test / client-build / client-build
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: perform-test / server-build / server-unit-tests
  • GitHub Check: server-unit-tests / server-unit-tests
  • GitHub Check: server-spotless / spotless-check
🔇 Additional comments (4)
app/server/appsmith-git/src/main/java/com/appsmith/git/service/ce/GitExecutorCEImpl.java (4)

1031-1043: Verify need to discard uncommitted changes.
Before returning the merge status, this block discards uncommitted changes via resetToLastCommit(...). Please confirm this is intentional.


1124-1124: Ensure callers handle newly thrown exceptions.
The signature now declares throws GitAPIException, IOException. Verify that all call sites accommodate these checked exceptions properly.


1129-1129: Avoid consecutive resets without intervening changes.
You reset once before checkout and again immediately after. Confirm if double-reset logic is intended or if it can be streamlined.


1159-1159: Rebase flow LGTM!
The rebase approach is straightforward.

Comment on lines +630 to +637
// will be possible
if (!status.isClean()) {
return resetToLastCommit(git).map(ref -> {
processStopwatch.stopAndLogTimeInMillis();
jgitStatusSpan.end();
return response;
});
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Potential data loss in a read-only operation.
Calling resetToLastCommit(git) in getStatus forcibly discards uncommitted changes. Confirm if this destructive behavior is truly desired in a status-check method.

@sondermanish sondermanish merged commit 30f9983 into release Mar 27, 2025
50 checks passed
@sondermanish sondermanish deleted the fix/revert-git-executor branch March 27, 2025 11:20
sondermanish added a commit that referenced this pull request Mar 27, 2025
## Description
>
> _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 #39934 
_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
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/14103475195>
> Commit: 288e4cf
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=14103475195&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Git`
> Spec:
> <hr>Thu, 27 Mar 2025 10:37:32 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

- **Bug Fixes**
- Enhanced error recovery in update operations, ensuring that any
pending changes are safely reverted when issues occur.
- Improved conflict resolution during updates to maintain a stable and
reliable system state for end-users.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
nidhi-nair added a commit that referenced this pull request Mar 28, 2025
## Description
- Git executor CE Impl revert PR
#39949


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
<!-- This is an auto-generated comment: Cypress test results  -->
> [!CAUTION]
> 🔴 🔴 🔴 Some tests have failed.
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/14106311517>
> Commit: cef9ab7
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=14106311517&attempt=2&selectiontype=test&testsstatus=failed&specsstatus=fail"
target="_blank">Cypress dashboard</a>.
> Tags: @tag.Git
> Spec: 
> The following are new failures, please fix them before merging the PR:
<ol>
> <li>cypress/e2e/Regression/Apps/ImportExportForkApplication_spec.js
> <li>cypress/e2e/Regression/ClientSide/BugTests/CatchBlock_Spec.ts
> <li>cypress/e2e/Regression/ClientSide/BugTests/DS_Bug28985_spec.ts
>
<li>cypress/e2e/Regression/ClientSide/BugTests/GraphQL_Binding_Bug16702_Spec.ts
> <li>cypress/e2e/Regression/ClientSide/Git/GitAutocommit_spec.ts
>
<li>cypress/e2e/Regression/ClientSide/Git/GitDiscardChange/DiscardChanges_spec.js
> <li>cypress/e2e/Regression/ClientSide/Git/GitImport/GitImport_spec.js
>
<li>cypress/e2e/Regression/ClientSide/Git/GitSync/GitSyncGitBugs_spec.js
>
<li>cypress/e2e/Regression/ClientSide/Templates/ForkTemplateToGitConnectedApp.js
> <li>cypress/e2e/Regression/ClientSide/Widgets/Migration_Spec.js
> <li>cypress/e2e/Regression/ServerSide/ApiTests/API_MultiPart_Spec.ts
>
<li>cypress/e2e/Regression/ServerSide/ApiTests/API_TestExecuteWithDynamicBindingInUrl_spec.ts
> <li>cypress/e2e/Regression/ServerSide/OnLoadTests/JSOnLoad2_Spec.ts
>
<li>cypress/e2e/Regression/ServerSide/Params/PassingParams_Spec.ts</ol>
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/identified-flaky-tests-65890b3c81d7400d08fa9ee3?branch=master"
target="_blank">List of identified flaky tests</a>.
> <hr>Thu, 27 Mar 2025 15:43:27 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

- **Bug Fixes**
- Improved recovery for repository operations by automatically reverting
to a stable state when errors occur, reducing conflict risks and
ensuring a consistent environment.
  
- **Refactor**
- Optimized the overall error handling and state management logic to
better maintain system stability during update and merge operations.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
github-actions bot pushed a commit to Zeral-Zhang/appsmith that referenced this pull request Apr 12, 2025
## Description
>
> _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 appsmithorg#39934 
_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
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/14103475195>
> Commit: 288e4cf
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=14103475195&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Git`
> Spec:
> <hr>Thu, 27 Mar 2025 10:37:32 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

- **Bug Fixes**
- Enhanced error recovery in update operations, ensuring that any
pending changes are safely reverted when issues occur.
- Improved conflict resolution during updates to maintain a stable and
reliable system state for end-users.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working Git Product Issues related to version control product 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 Packages & Git Pod All issues belonging to Packages and Git Production Release Blocker This issue must be resolved before the release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: On deleting a page on a specific branch in a git connected app, the page gets deleted from all branches on import

3 participants