Skip to content

chore: cherry pick git executor revert#39954

Merged
nidhi-nair merged 1 commit intomasterfrom
cp/2703
Mar 28, 2025
Merged

chore: cherry pick git executor revert#39954
nidhi-nair merged 1 commit intomasterfrom
cp/2703

Conversation

@sondermanish
Copy link
Contributor

@sondermanish sondermanish commented Mar 27, 2025

Description

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

Caution

🔴 🔴 🔴 Some tests have failed.
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/14106311517
Commit: cef9ab7
Cypress dashboard.
Tags: @tag.Git
Spec:
The following are new failures, please fix them before merging the PR:

  1. cypress/e2e/Regression/Apps/ImportExportForkApplication_spec.js
  2. cypress/e2e/Regression/ClientSide/BugTests/CatchBlock_Spec.ts
  3. cypress/e2e/Regression/ClientSide/BugTests/DS_Bug28985_spec.ts
  4. cypress/e2e/Regression/ClientSide/BugTests/GraphQL_Binding_Bug16702_Spec.ts
  5. cypress/e2e/Regression/ClientSide/Git/GitAutocommit_spec.ts
  6. cypress/e2e/Regression/ClientSide/Git/GitDiscardChange/DiscardChanges_spec.js
  7. cypress/e2e/Regression/ClientSide/Git/GitImport/GitImport_spec.js
  8. cypress/e2e/Regression/ClientSide/Git/GitSync/GitSyncGitBugs_spec.js
  9. cypress/e2e/Regression/ClientSide/Templates/ForkTemplateToGitConnectedApp.js
  10. cypress/e2e/Regression/ClientSide/Widgets/Migration_Spec.js
  11. cypress/e2e/Regression/ServerSide/ApiTests/API_MultiPart_Spec.ts
  12. cypress/e2e/Regression/ServerSide/ApiTests/API_TestExecuteWithDynamicBindingInUrl_spec.ts
  13. cypress/e2e/Regression/ServerSide/OnLoadTests/JSOnLoad2_Spec.ts
  14. cypress/e2e/Regression/ServerSide/Params/PassingParams_Spec.ts
List of identified flaky tests.
Thu, 27 Mar 2025 15:43:27 UTC

Communication

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

  • Yes
  • No

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.

## 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 -->
@sondermanish sondermanish self-assigned this Mar 27, 2025
@sondermanish sondermanish requested a review from a team as a code owner March 27, 2025 11:49
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 27, 2025

Walkthrough

The changes enhance error handling in the Git operations within the GitExecutorCEImpl.java file. During operations like pull, merge, and status check, if an error occurs or if uncommitted changes are detected, the repository is reset to the last commit. Additionally, the signature of the resetToLastCommit method has been updated to explicitly declare that it throws GitAPIException and IOException.

Changes

File Change Summary
app/.../GitExecutorCEImpl.java Modified error handling in pullApplication, getStatus, mergeBranch, and isMergeBranch to reset state before error propagation. Updated resetToLastCommit signature to throw GitAPIException and IOException.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant GitExecutor as GitExecutorCEImpl
    participant Git as Git Repository

    Client->>GitExecutor: pullApplication()
    GitExecutor->>Git: Initiate pull operation
    alt Error Occurs
        GitExecutor->>Git: resetToLastCommit()
        GitExecutor->>Client: Return error after reset
    else No Error
        GitExecutor->>Client: Return success
    end
Loading

Possibly related PRs

Suggested labels

Bug, High, Production, Needs Triaging, Git Product, Release Blocker, ok-to-test, Packages & Git Pod

Suggested reviewers

  • subrata71
  • dvj1988

Poem

In the realm of code so fine,
An error reset restores the line.
Git commands now dance with grace,
Leaving no messy trace.
Each branch stands proud and clean,
A poetic fix behind the scene! 🎉

✨ 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 skip-changelog Adding this label to a PR prevents it from being listed in the changelog label 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: 0

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

502-502: Consider logging rollback attempts before rethrowing.
Including a log statement can help debug issues when resets are triggered during error recovery.


856-862: Preserve the full stack trace.
Returning only the error message drops valuable debugging information. Consider wrapping or re-emitting the original exception.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between a016ca5 and cef9ab7.

📒 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 (2)
  • GitHub Check: server-unit-tests / server-unit-tests
  • GitHub Check: server-spotless / spotless-check
🔇 Additional comments (3)
app/server/appsmith-git/src/main/java/com/appsmith/git/service/ce/GitExecutorCEImpl.java (3)

629-637: Confirm user intent before discarding uncommitted changes.
Forcefully resetting to the last commit may cause data loss. Consider prompting or stashing changes if this behavior is unintended.


1031-1043: Recheck behavior of forced reset.
This block discards any uncommitted changes after checking merge conflicts. Ensure this aligns with user expectations to avoid inadvertent data loss.


1124-1129: Ensure exception handling for new method signature.
The updated throws clause means callers must handle GitAPIException and IOException. Double-check error-handling logic throughout the codebase.

@sondermanish sondermanish changed the base branch from release to master March 27, 2025 12:13
@sondermanish sondermanish added the ok-to-test Required label for CI label Mar 27, 2025
@nidhi-nair nidhi-nair merged commit 4a142af into master Mar 28, 2025
41 of 52 checks passed
@nidhi-nair nidhi-nair deleted the cp/2703 branch March 28, 2025 04:30
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.

3 participants