Skip to content

chore: remove extra git resets#39758

Merged
dvj1988 merged 2 commits intoreleasefrom
chore/git-remove-extra-resets
Mar 18, 2025
Merged

chore: remove extra git resets#39758
dvj1988 merged 2 commits intoreleasefrom
chore/git-remove-extra-resets

Conversation

@dvj1988
Copy link

@dvj1988 dvj1988 commented Mar 18, 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/13918032181
Commit: 3a6a223
Cypress dashboard.
Tags: @tag.Git
Spec:


Tue, 18 Mar 2025 08:42:23 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • Refactor
    • Simplified error handling for repository operations by removing unnecessary state reversion actions during failures.
    • Error responses are now more direct, offering clearer and more predictable feedback when issues arise.
    • Updated public operations now respond faster and communicate errors more efficiently.
    • These improvements contribute to a more stable and reliable experience during Git synchronization tasks.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 18, 2025

Walkthrough

The changes simplify error handling and control flow in the Git integration classes. In both the FSGitHandlerCEImpl and GitExecutorCEImpl classes, calls to reset the repository on error have been removed. Instead, errors are now directly propagated using Mono.error(error). Additionally, logic that checked and reset uncommitted changes prior to a status response has been eliminated, and the reset chaining in the reset methods has been streamlined.

Changes

File Path Change Summary
app/server/appsmith-git/.../handler/ce/FSGitHandlerCEImpl.java Simplified error handling in pullArtifactWithoutCheckout, pullApplication, and mergeBranch by removing resetToLastCommit calls; removed status clean-check logic in getStatus; streamlined reset chaining in resetToLastCommit.
app/server/appsmith-git/.../service/ce/GitExecutorCEImpl.java Removed repository reset attempts in error handlers for pullApplication, getStatus, mergeBranch, and isMergeBranch; modified reset chaining in resetToLastCommit to directly return success post-checkout.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant GitService
    Client->>GitService: Invoke repository operation (e.g., pullApplication)
    GitService->>GitService: Attempt operation
    alt Operation Fails
        GitService->>Client: Return error using Mono.error(error)
    else Operation Succeeds
        GitService->>Client: Return success response
    end
Loading

Possibly related PRs

  • chore: stability pr for changes #35911: The changes in this PR modify error handling and control flow in the pullApplication, getStatus, and mergeBranch methods, specifically removing attempts to reset to the last commit on error.
  • chore: refactored git status #34270: This PR involves modifications to the getStatus method, specifically simplifying error handling and control flow, indicating a direct relationship at the code level.
  • chore: git changes for new contract #39376: Changes in this PR modify the error handling logic in the pullApplication, mergeBranch, and getStatus methods, specifically removing the reset to the last commit operation in error scenarios.

Suggested labels

Bug

Suggested reviewers

  • nidhi-nair
  • sharat87

Poem

In lines of code where errors once soared,
The resets are gone, and issues ignored.
Now errors fly direct and true,
A streamlined flow, a clearer view.
Cheers to fixes, crisp and neat,
A code rhythm that beats so sweet!
🚀✨


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 775c519 and 3a6a223.

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

502-502: Simplified error handling approach.

The change to directly propagate errors without attempting repository resets improves readability and makes the control flow more straightforward.


847-847: Error handling improvement.

Similar to the pullApplication method, directly returning Mono.error(error) instead of attempting recovery through resets is a cleaner approach that makes the error flow more predictable.


1096-1096: Removed unnecessary throws declaration.

Removing the checked exceptions from the method signature aligns with reactive programming patterns where exceptions are handled through the reactive chain.


1101-1101: Simplified method chain.

Removing the unnecessary flatMap that called resetToLastCommit(git) reduces complexity and makes the code more maintainable.


1131-1131: Consistent use of the updated resetToLastCommit method.

The modification maintains the existing approach while leveraging the simplified resetToLastCommit method.


🪧 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.

@dvj1988 dvj1988 added the ok-to-test Required label for CI label Mar 18, 2025
@dvj1988
Copy link
Author

dvj1988 commented Mar 18, 2025

/build-deploy-preview skip-tests=true

@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 18, 2025
@dvj1988 dvj1988 requested a review from rajatagrawal March 18, 2025 04:52
@github-actions
Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/13915678730.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 39758.
recreate: .

@dvj1988 dvj1988 marked this pull request as ready for review March 18, 2025 04:53
@dvj1988 dvj1988 requested a review from a team as a code owner March 18, 2025 04:53
@github-actions
Copy link

Deploy-Preview-URL: https://ce-39758.dp.appsmith.com

@github-actions
Copy link

Failed server tests

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

@dvj1988 dvj1988 added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Mar 18, 2025
@dvj1988
Copy link
Author

dvj1988 commented Mar 18, 2025

/build-deploy-preview skip-tests=true

@github-actions
Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/13918276385.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 39758.
recreate: .

@github-actions
Copy link

Deploy-Preview-URL: https://ce-39758.dp.appsmith.com

@dvj1988 dvj1988 merged commit 2b703c9 into release Mar 18, 2025
54 of 59 checks passed
@dvj1988 dvj1988 deleted the chore/git-remove-extra-resets branch March 18, 2025 09:56
@coderabbitai coderabbitai bot mentioned this pull request Mar 27, 2025
2 tasks
sondermanish pushed a commit that referenced this pull request Apr 1, 2025
## Description
Toggle the [remove extra git resets
changes](#39758) in the new
git apis behind a feature flag `release_git_reset_optimization_enabled`.


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  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/14188261678>
> Commit: 5f3ce61
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=14188261678&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Git`
> Spec:
> <hr>Tue, 01 Apr 2025 06:48:38 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**
- Introduced a feature flag for enhanced Git reset optimization,
enabling optional preservation of local changes during Git operations.

- **Refactor**
- Updated Git workflows to offer more flexible handling of uncommitted
changes and improved error management.

- **Tests**
- Adjusted test scenarios to validate the refined Git behavior and
ensure consistent operation under the new settings.
<!-- 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
> [!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
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/13918032181>
> Commit: 3a6a223
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=13918032181&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Git`
> Spec:
> <hr>Tue, 18 Mar 2025 08:42:23 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

- **Refactor**
- Simplified error handling for repository operations by removing
unnecessary state reversion actions during failures.
- Error responses are now more direct, offering clearer and more
predictable feedback when issues arise.
- Updated public operations now respond faster and communicate errors
more efficiently.
- These improvements contribute to a more stable and reliable experience
during Git synchronization tasks.
<!-- 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
Toggle the [remove extra git resets
changes](appsmithorg#39758) in the new
git apis behind a feature flag `release_git_reset_optimization_enabled`.


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  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/14188261678>
> Commit: 5f3ce61
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=14188261678&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Git`
> Spec:
> <hr>Tue, 01 Apr 2025 06:48:38 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**
- Introduced a feature flag for enhanced Git reset optimization,
enabling optional preservation of local changes during Git operations.

- **Refactor**
- Updated Git workflows to offer more flexible handling of uncommitted
changes and improved error management.

- **Tests**
- Adjusted test scenarios to validate the refined Git behavior and
ensure consistent operation under the new settings.
<!-- 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

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