Skip to content

chore: in memory git status#40891

Merged
dvj1988 merged 10 commits intoreleasefrom
chore/in-mem-git-status
Jun 13, 2025
Merged

chore: in memory git status#40891
dvj1988 merged 10 commits intoreleasefrom
chore/in-mem-git-status

Conversation

@dvj1988
Copy link

@dvj1988 dvj1988 commented Jun 9, 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/15607977360
Commit: b50460f
Cypress dashboard.
Tags: @tag.Git
Spec:


Thu, 12 Jun 2025 11:13:06 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Introduced detailed Git status computation showing added, modified, and removed files.
    • Added branch tracking status retrieval for repositories.
  • Improvements

    • Enhanced integration of Git status and branch tracking features across interfaces and services.
    • Improved status reporting by enriching Git status with branch tracking details.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 9, 2025

Walkthrough

This change introduces new methods across several interfaces and implementations to compute Git status by comparing file system and database resource maps. It also exposes and standardizes a method for populating modified entities in Git status. Additional methods are added to retrieve branch tracking status, and relevant method signatures are updated for broader accessibility. Observability instrumentation was added to Git resource map construction.

Changes

Files/Paths Change Summary
.../appsmith-git/files/FileUtilsCEImpl.java Added computeGitStatus method comparing DB and filesystem GitResourceMaps; updated constructor to accept ObservationRegistry; added observability instrumentation.
.../appsmith-git/files/FileUtilsImpl.java Updated constructor to accept ObservationRegistry and pass it to superclass.
.../appsmith-git/handler/ce/FSGitHandlerCEImpl.java Changed populateModifiedEntities method visibility from protected to public.
.../appsmith-interfaces/external/git/FileInterface.java Added computeGitStatus method to interface.
.../appsmith-interfaces/external/git/handler/FSGitHandler.java Added populateModifiedEntities method to interface.
.../appsmith-server/git/central/GitHandlingServiceCE.java Added computeGitStatus method to interface.
.../appsmith-server/git/fs/GitFSServiceCEImpl.java Added computeGitStatus method delegating to common utilities.
.../appsmith-server/helpers/ce/CommonGitFileUtilsCE.java Added computeGitStatus method wrapping and delegating Git status computation with reactive scheduling and error handling.
.../appsmith-server/git/central/CentralGitServiceCEImpl.java Modified getStatus method to replace previous prepareChanges logic with computeGitStatus; enriched status with branch tracking info.
.../appsmith-git/src/test/java/com/appsmith/git/helpers/FileUtilsImplTest.java Updated test setup to pass ObservationRegistry.NOOP in constructor of FileUtilsImpl.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant GitFSServiceCEImpl
    participant CommonGitFileUtilsCE
    participant FileUtilsCEImpl
    participant FSGitHandlerCEImpl

    Client->>GitFSServiceCEImpl: computeGitStatus(dto, artifactJson)
    GitFSServiceCEImpl->>CommonGitFileUtilsCE: computeGitStatus(path, artifactJson, branch)
    CommonGitFileUtilsCE->>FileUtilsCEImpl: computeGitStatus(path, resourceMap, branch, flag)
    FileUtilsCEImpl->>FSGitHandlerCEImpl: populateModifiedEntities(statusDTO)
    FileUtilsCEImpl-->>CommonGitFileUtilsCE: Mono<GitStatusDTO>
    CommonGitFileUtilsCE-->>GitFSServiceCEImpl: Mono<GitStatusDTO>
    GitFSServiceCEImpl-->>Client: Mono<GitStatusDTO>
Loading

Possibly related PRs

Suggested labels

Git Product

Suggested reviewers

  • sondermanish
  • brayn003
  • ashit-rath

Poem

In the world of Git, new methods arise,
Comparing maps, seeking truth with wise eyes.
Branches are tracked, statuses revealed,
Modified entities—no longer concealed.
Interfaces grow, implementations bloom,
Code in harmony, dispelling the gloom.
🚀


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0c759bf and 5144e2a.

📒 Files selected for processing (1)
  • app/server/appsmith-git/src/test/java/com/appsmith/git/helpers/FileUtilsImplTest.java (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • app/server/appsmith-git/src/test/java/com/appsmith/git/helpers/FileUtilsImplTest.java
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: perform-test / client-build / client-build
  • GitHub Check: perform-test / server-build / server-unit-tests
  • GitHub Check: server-unit-tests / server-unit-tests
  • GitHub Check: server-spotless / spotless-check
✨ 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.
    • 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 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 Jun 9, 2025
@dvj1988
Copy link
Author

dvj1988 commented Jun 9, 2025

/build-deploy-preview skip-tests=true

@dvj1988 dvj1988 marked this pull request as ready for review June 9, 2025 07:28
@dvj1988 dvj1988 requested a review from a team as a code owner June 9, 2025 07:28
@github-actions github-actions bot added the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label Jun 9, 2025
@github-actions
Copy link

github-actions bot commented Jun 9, 2025

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

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-git/src/main/java/com/appsmith/git/files/FileUtilsCEImpl.java (1)

294-350: Well-implemented Git status computation with one error handling improvement needed.

The method correctly implements the Git status logic by comparing database and file system resource maps. The reactive flow and parallel stream usage are appropriate for performance. However, consider improving error handling in the modified files detection.

Consider improving error handling in lines 333-339:

 .filter(filePath -> {
     Object fileInDB = filePathToObjectsFromDB.get(filePath);
     Object fileInFS = filePathObjectsMapFromFS.get(filePath);
     try {
         return fileOperations.hasFileChanged(fileInDB, fileInFS);
     } catch (IOException e) {
-        log.error("Error while checking if file has changed", e);
-        return false;
+        log.error("Error while checking if file has changed for path: {}", filePath, e);
+        // Consider whether to include or exclude files with comparison errors
+        // Current approach may miss actual changes due to I/O issues
+        return true; // or throw a runtime exception to fail fast
     }
 })

The current approach of returning false on IOException might silently ignore actual file changes when there are I/O issues.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 99db0a1 and 68818b4.

📒 Files selected for processing (7)
  • app/server/appsmith-git/src/main/java/com/appsmith/git/files/FileUtilsCEImpl.java (2 hunks)
  • app/server/appsmith-git/src/main/java/com/appsmith/git/handler/ce/FSGitHandlerCEImpl.java (2 hunks)
  • app/server/appsmith-interfaces/src/main/java/com/appsmith/external/git/FileInterface.java (2 hunks)
  • app/server/appsmith-interfaces/src/main/java/com/appsmith/external/git/handler/FSGitHandler.java (1 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/git/central/GitHandlingServiceCE.java (2 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/git/fs/GitFSServiceCEImpl.java (2 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/CommonGitFileUtilsCE.java (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • 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-spotless / spotless-check
  • GitHub Check: server-unit-tests / server-unit-tests
🔇 Additional comments (13)
app/server/appsmith-interfaces/src/main/java/com/appsmith/external/git/handler/FSGitHandler.java (1)

163-163: LGTM: Clean interface addition.

The new method signature follows established patterns and integrates well with the existing Git status functionality.

app/server/appsmith-interfaces/src/main/java/com/appsmith/external/git/FileInterface.java (2)

3-3: LGTM: Necessary import addition.

The GitStatusDTO import is required for the new computeGitStatus method.


46-48: LGTM: Well-designed method signature.

The computeGitStatus method has appropriate parameters for in-memory Git status computation and follows the reactive programming patterns used throughout the codebase.

app/server/appsmith-git/src/main/java/com/appsmith/git/handler/ce/FSGitHandlerCEImpl.java (2)

938-938: LGTM: Visibility change required for interface compliance.

The method visibility change from protected to public is necessary to implement the FSGitHandler interface contract properly.


1568-1568:

Details

✅ Verification successful

Verify that callers pass suffixes, not full paths.

The change from repoPath.toFile() to createRepoPath(repoPath).toFile() suggests the method now expects a path suffix rather than a full repository path. This could break existing callers if they were passing absolute paths.


🏁 Script executed:

#!/bin/bash
# Description: Find all callers of getBranchTrackingStatus to verify they pass suffixes
# Expected: Callers should be passing path suffixes, not absolute paths

# Search for method calls to getBranchTrackingStatus
ast-grep --pattern 'getBranchTrackingStatus($_, $_)'

# Also search for any usage patterns
rg -A 3 -B 1 "getBranchTrackingStatus"

Length of output: 6073


No breaking change: callers already pass suffixes
Verified that the only caller of FSGitHandlerCEImpl.getBranchTrackingStatus in GitFSServiceCEImpl uses gitArtifactHelper.getRepoSuffixPath(...) (a suffix), and no other call sites supply absolute paths. No changes needed.

app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/CommonGitFileUtilsCE.java (2)

4-4: Import addition looks good.

The new import for GitStatusDTO is necessary for the computeGitStatus method return type.


198-212: Well-structured implementation following established patterns.

The method correctly:

  • Creates GitResourceMap from artifact exchange JSON
  • Checks feature flag for reset optimization
  • Delegates to fileUtils.computeGitStatus with proper reactive scheduling
  • Handles exceptions appropriately by returning Mono.error

The implementation is consistent with other methods in the class and follows the reactive programming paradigm correctly.

app/server/appsmith-server/src/main/java/com/appsmith/server/git/central/GitHandlingServiceCE.java (2)

16-16: Import addition is appropriate.

The BranchTrackingStatus import is required for the new getBranchTrackingStatus method.


89-92: Interface method declarations are well-defined.

Both new methods follow consistent naming conventions and have appropriate parameter types:

  • computeGitStatus takes transformation DTO and artifact exchange JSON
  • getBranchTrackingStatus takes transformation DTO

Return types are properly typed with reactive Mono wrappers.

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

45-45: Import addition is correct.

The BranchTrackingStatus import supports the new getBranchTrackingStatus method implementation.


753-764: Clean implementation following established patterns.

The method properly:

  • Extracts necessary parameters from the transformation DTO
  • Resolves the appropriate GitArtifactHelper
  • Computes the repository suffix path
  • Delegates to commonGitFileUtils.computeGitStatus

The implementation is consistent with other methods in the class and maintains the reactive flow.


766-776: Consistent implementation with clear delegation.

The method follows the same pattern as other methods in the class:

  • Parameter extraction from DTO
  • Artifact helper resolution
  • Path computation
  • Delegation to fsGitHandler.getBranchTrackingStatus

The implementation maintains consistency with the class's architectural patterns.

app/server/appsmith-git/src/main/java/com/appsmith/git/files/FileUtilsCEImpl.java (1)

3-3: LGTM: Import addition is appropriate.

The new import for GitStatusDTO is correctly added to support the new method.

@github-actions
Copy link

github-actions bot commented Jun 9, 2025

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

@dvj1988
Copy link
Author

dvj1988 commented Jun 9, 2025

/build-deploy-preview skip-tests=true

@github-actions
Copy link

github-actions bot commented Jun 9, 2025

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

@github-actions
Copy link

github-actions bot commented Jun 9, 2025

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

@dvj1988 dvj1988 requested a review from sondermanish June 9, 2025 08:48
@dvj1988
Copy link
Author

dvj1988 commented Jun 9, 2025

/build-deploy-preview skip-tests=true

@github-actions
Copy link

github-actions bot commented Jun 9, 2025

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

@github-actions
Copy link

github-actions bot commented Jun 9, 2025

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

@github-actions
Copy link

Failed server tests

  • com.appsmith.server.git.ops.GitCommitTests#commitArtifact_whenNoChangesInLocal_returnsWithEmptyCommitMessage

@dvj1988
Copy link
Author

dvj1988 commented Jun 12, 2025

/build-deploy-preview skip-tests=true

@github-actions
Copy link

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

@github-actions
Copy link

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

sondermanish
sondermanish previously approved these changes Jun 12, 2025
Copy link
Contributor

@sondermanish sondermanish left a comment

Choose a reason for hiding this comment

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

looks good

@dvj1988 dvj1988 merged commit dea1c03 into release Jun 13, 2025
42 checks passed
@dvj1988 dvj1988 deleted the chore/in-mem-git-status branch June 13, 2025 06:46
dvj1988 pushed a commit that referenced this pull request Jun 18, 2025
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