-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
chore: autocommit feature branch #34062
Conversation
WalkthroughThe changes enhance Git synchronization features by introducing new types, action creators, and methods for handling autocommit functionality. This includes tracking autocommit progress, error handling, and improving state management. Additionally, the feature flag for Git autocommit has been updated, and the Beta tag has been removed, signifying the feature's readiness for production. Changes
Sequence Diagram(s) (Beta)sequenceDiagram
participant User
participant UI
participant GitSyncAPI
participant GitSyncActions
participant GitSyncSagas
User->>UI: Enable Autocommit
UI->>GitSyncActions: triggerAutocommitInitAction
GitSyncActions->>GitSyncAPI: triggerAutocommit
GitSyncAPI-->>GitSyncActions: Autocommit Response
GitSyncActions->>GitSyncSagas: triggerAutocommitSuccessAction
GitSyncSagas->>UI: Update UI with Autocommit Progress
Assessment against linked issues
Poem
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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 as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 13
Outside diff range and nitpick comments (5)
app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaVersions.java (1)
15-15
: LGTM! It's good practice to document the specific changes that necessitated the version increment in the schema.app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/helpers/GitAutoCommitHelperFallbackImpl.java (1)
22-23
: LGTM! Consider adding detailed logging in these fallback methods to aid in debugging when they are triggered.Also applies to: 27-27
app/server/appsmith-server/src/test/java/com/appsmith/server/git/autocommit/helpers/AutoCommitEligibilityHelperTest.java (2)
38-38
: Consider usingimport static
for frequently used assertions to clean up the code.
122-126
: This block effectively simulates the page DSL version fetching, which is central to the logic being tested. However, consider adding inline comments explaining whyBoolean.TRUE
is passed here.app/server/appsmith-server/src/test/java/com/appsmith/server/git/autocommit/AutoCommitServiceTest.java (1)
210-251
: Review setup method for test consistency and completeness.Consider adding comments to each block of the setup method to improve readability and maintainability.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (46)
- app/client/src/actions/gitSyncActions.ts (3 hunks)
- app/client/src/api/GitSyncAPI.tsx (2 hunks)
- app/client/src/ce/constants/ReduxActionConstants.tsx (2 hunks)
- app/client/src/entities/Engine/AppEditorEngine.ts (2 hunks)
- app/client/src/pages/Editor/gitSync/QuickGitActions/BranchButton.tsx (5 hunks)
- app/client/src/reducers/uiReducers/gitSyncReducer.ts (3 hunks)
- app/client/src/sagas/GitSyncSagas.ts (6 hunks)
- app/client/src/selectors/gitSyncSelectors.tsx (1 hunks)
- 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/files/operations/FileOperationsCEv2Impl.java (6 hunks)
- app/server/appsmith-interfaces/src/main/java/com/appsmith/external/enums/FeatureFlagEnum.java (1 hunks)
- app/server/appsmith-interfaces/src/main/java/com/appsmith/external/git/FileInterface.java (1 hunks)
- app/server/appsmith-interfaces/src/main/java/com/appsmith/external/git/constants/ce/GitConstantsCE.java (2 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/GitController.java (2 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/GitControllerCE.java (4 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/AutoCommitResponseDTO.java (1 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/AutoCommitEventHandler.java (1 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/AutoCommitEventHandlerCE.java (1 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/AutoCommitEventHandlerCEImpl.java (2 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/AutoCommitEventHandlerImpl.java (1 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/AutoCommitService.java (1 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/AutoCommitServiceCE.java (1 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/AutoCommitServiceCEImpl.java (1 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/AutoCommitServiceImpl.java (1 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/helpers/AutoCommitEligibilityHelper.java (1 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/helpers/AutoCommitEligibilityHelperFallbackImpl.java (1 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/helpers/AutoCommitEligibilityHelperImpl.java (5 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/helpers/GitAutoCommitHelper.java (1 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/helpers/GitAutoCommitHelperFallbackImpl.java (2 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/helpers/GitAutoCommitHelperImpl.java (5 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/git/common/CommonGitServiceCE.java (2 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/git/common/CommonGitServiceCEImpl.java (2 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/CommonGitFileUtils.java (2 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/GitUtils.java (1 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/CommonGitFileUtilsCE.java (8 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaMigration.java (1 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaVersions.java (1 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/newpages/base/NewPageServiceCE.java (1 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/newpages/base/NewPageServiceCEImpl.java (1 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/services/ApplicationPageServiceImpl.java (1 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApplicationPageServiceCEImpl.java (3 hunks)
- app/server/appsmith-server/src/test/java/com/appsmith/server/git/ServerSchemaMigrationEnforcerTest.java (7 hunks)
- app/server/appsmith-server/src/test/java/com/appsmith/server/git/autocommit/AutoCommitEventHandlerImplTest.java (4 hunks)
- app/server/appsmith-server/src/test/java/com/appsmith/server/git/autocommit/AutoCommitServiceTest.java (1 hunks)
- app/server/appsmith-server/src/test/java/com/appsmith/server/git/autocommit/helpers/AutoCommitEligibilityHelperTest.java (14 hunks)
- app/server/appsmith-server/src/test/java/com/appsmith/server/git/autocommit/helpers/GitAutoCommitHelperImplTest.java (8 hunks)
Files skipped from review due to trivial changes (2)
- app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/AutoCommitService.java
- app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApplicationPageServiceCEImpl.java
Additional context used
Biome
app/client/src/sagas/GitSyncSagas.ts
[error] 709-709: Unsafe usage of optional chaining. (lint/correctness/noUnsafeOptionalChaining)
If it short-circuits with 'undefined' the evaluation will throw TypeError here:
[error] 837-837: Unsafe usage of optional chaining. (lint/correctness/noUnsafeOptionalChaining)
If it short-circuits with 'undefined' the evaluation will throw TypeError here:
Additional comments not posted (88)
app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/AutoCommitEventHandler.java (1)
1-1
: Interface extension looks good and follows Java best practices.app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/AutoCommitServiceCE.java (1)
1-9
: Interface and method signature are well-defined and adhere to reactive programming principles.app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/AutoCommitEventHandlerCE.java (1)
1-1
: Interface and methods are well-defined, covering various aspects of auto-commit event handling.Also applies to: 3-3
app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/helpers/GitAutoCommitHelper.java (1)
3-3
: Interface and methods are well-defined, covering various aspects of auto-commit operations.Also applies to: 9-9, 15-15
app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/helpers/AutoCommitEligibilityHelper.java (1)
14-15
: LGTM! The addition ofisClientMigrationRequiredFSOps
method enhances the granularity of migration checks.app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/GitController.java (1)
17-19
: LGTM! The constructor now correctly injectsAutoCommitService
. Ensure thatAutoCommitService
is properly integrated and tested within the application.Verification successful
The integration of
AutoCommitService
inGitController
andGitControllerCE
appears to be correctly implemented. The constructor inGitController
now includesAutoCommitService
, andGitControllerCE
has a private final field forAutoCommitService
. Additionally, there is a methodtoggleAutoCommitEnabled
inGitControllerCE
which likely utilizes this service.
GitController.java
- Constructor:
public GitController(CommonGitService service, AutoCommitService autoCommitService)
GitControllerCE.java
- Field:
private final AutoCommitService autoCommitService
- Method:
public Mono<ResponseDTO<Boolean>> toggleAutoCommitEnabled(@PathVariable String defaultApplicationId)
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the integration of AutoCommitService in the application. # Test: Search for the usage of AutoCommitService. Expect: Proper usage and handling. rg --type java $'AutoCommitService'Length of output: 1781
Script:
#!/bin/bash # Extract method implementations in GitController.java and GitControllerCE.java to verify the usage of AutoCommitService. # Search for methods in GitController.java ast-grep --lang java --pattern $'class GitController { $$$ $_($_) { $$$ } $$$ }' app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/GitController.java # Search for methods in GitControllerCE.java ast-grep --lang java --pattern $'class GitControllerCE { $$$ $_($_) { $$$ } $$$ }' app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/GitControllerCE.javaLength of output: 382
Script:
#!/bin/bash # Adjusted pattern to extract method implementations in GitController.java and GitControllerCE.java to verify the usage of AutoCommitService. # Search for methods in GitController.java ast-grep --lang java --pattern $'class GitController { $$$ $_($$$) { $$$ } $$$ }' app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/GitController.java # Search for methods in GitControllerCE.java ast-grep --lang java --pattern $'class GitControllerCE { $$$ $_($$$) { $$$ } $$$ }' app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/GitControllerCE.javaLength of output: 384
Script:
#!/bin/bash # Use rg to search for method definitions and usages of AutoCommitService in GitController.java and GitControllerCE.java. # Search for method definitions in GitController.java rg --type java 'public .* {' app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/GitController.java # Search for usages of AutoCommitService in GitController.java rg --type java 'AutoCommitService' app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/GitController.java # Search for method definitions in GitControllerCE.java rg --type java 'public .* {' app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/GitControllerCE.java # Search for usages of AutoCommitService in GitControllerCE.java rg --type java 'AutoCommitService' app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/GitControllerCE.javaLength of output: 948
Script:
#!/bin/bash # Corrected regex pattern to search for method definitions and usages of AutoCommitService in GitController.java and GitControllerCE.java. # Search for method definitions in GitController.java rg --type java 'public .*\{' app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/GitController.java # Search for usages of AutoCommitService in GitController.java rg --type java 'AutoCommitService' app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/GitController.java # Search for method definitions in GitControllerCE.java rg --type java 'public .*\{' app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/GitControllerCE.java # Search for usages of AutoCommitService in GitControllerCE.java rg --type java 'AutoCommitService' app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/GitControllerCE.javaLength of output: 2017
app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/CommonGitFileUtils.java (2)
21-27
: Constructor parameters correctly match the superclass constructor.
4-5
: Ensure that the new imports are utilized within the file.Verification successful
The new imports
FileOperations
andApplicationGitReference
are both utilized within theCommonGitFileUtils.java
file.
FileOperations
is used as a constructor parameter.ApplicationGitReference
is used as a generic type parameter inArtifactGitFileUtils
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the newly imported classes are used in the file. # Test: Search for usage of `FileOperations` class. Expect: At least one occurrence. rg --type java 'FileOperations' app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/CommonGitFileUtils.javaLength of output: 227
Script:
#!/bin/bash # Description: Verify that the newly imported classes are used in the file. # Test: Search for usage of `ApplicationGitReference` class. Expect: At least one occurrence. rg --type java 'ApplicationGitReference' app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/CommonGitFileUtils.javaLength of output: 277
app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/helpers/AutoCommitEligibilityHelperFallbackImpl.java (1)
26-30
: The methodisClientMigrationRequiredFSOps
correctly returns a default value. Ensure it aligns with the intended fallback behavior.app/server/appsmith-interfaces/src/main/java/com/appsmith/external/enums/FeatureFlagEnum.java (1)
18-27
: Well-documented addition of therelease_git_autocommit_eligibility_enabled
feature flag.app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/AutoCommitResponseDTO.java (2)
12-43
: Clear and comprehensive definitions forAutoCommitResponse
enum states.
45-59
: Proper use of Lombok annotations and well-structured DTO class.app/server/appsmith-interfaces/src/main/java/com/appsmith/external/git/constants/ce/GitConstantsCE.java (1)
Line range hint
25-53
: Appropriate addition of constants related to autocommit functionality.app/client/src/pages/Editor/gitSync/QuickGitActions/BranchButton.tsx (2)
Line range hint
12-49
: Effective use of selectors to manage UI state based on autocommit operations.
Line range hint
59-82
: Proper handling of UI components state based on autocommit progress.app/server/appsmith-server/src/main/java/com/appsmith/server/newpages/base/NewPageServiceCE.java (1)
105-106
: LGTM! The addition offindByApplicationIdAndApplicationMode
method aligns well with the existing interface design.app/server/appsmith-interfaces/src/main/java/com/appsmith/external/git/FileInterface.java (1)
57-67
: LGTM! The addition ofisResetToLastCommitRequired
parameter inreconstructMetadataFromGitRepo
method is a thoughtful enhancement for handling edge cases in git operations.Verification successful
The integration of the new parameter
isResetToLastCommitRequired
in thereconstructMetadataFromGitRepo
method has been verified in the following files:
CommonGitFileUtilsCE.java
FileUtilsCEImpl.java
Both files correctly include the new parameter in their method calls and implementations.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify integration of the modified method `reconstructMetadataFromGitRepo` with existing usages. # Test: Search for the method usage. Expect: Adaptations of the new parameter in all usages. rg --type java $'reconstructMetadataFromGitRepo'Length of output: 471
Script:
#!/bin/bash # Extract lines around the usage of `reconstructMetadataFromGitRepo` in `CommonGitFileUtilsCE.java` rg --type java -A 5 -B 5 $'reconstructMetadataFromGitRepo' app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/CommonGitFileUtilsCE.java # Extract lines around the usage of `reconstructMetadataFromGitRepo` in `FileUtilsCEImpl.java` rg --type java -A 5 -B 5 $'reconstructMetadataFromGitRepo' app/server/appsmith-git/src/main/java/com/appsmith/git/files/FileUtilsCEImpl.javaLength of output: 1235
app/server/appsmith-server/src/main/java/com/appsmith/server/services/ApplicationPageServiceImpl.java (1)
Line range hint
1-1
: No changes to review inApplicationPageServiceImpl.java
.app/server/appsmith-server/src/main/java/com/appsmith/server/git/common/CommonGitServiceCE.java (1)
108-109
: LGTM! The addition ofgetAutoCommitProgress
method supports the new auto-commit feature effectively.Verification successful
The method
getAutoCommitProgress
is well-integrated into the codebase, with multiple references in both test and main Java files. Here are the key locations where the method is used:
CommonGitServiceCEImpl.java
AutoCommitServiceCEImpl.java
GitAutoCommitHelperFallbackImpl.java
GitAutoCommitHelperImpl.java
GitAutoCommitHelper.java
GitControllerCE.java
These references indicate that the method is properly integrated into the service layer and other relevant components.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify integration of the new method `getAutoCommitProgress` with existing usages. # Test: Search for the method usage. Expect: Proper integration in the service layer. rg --type java $'getAutoCommitProgress'Length of output: 7397
app/client/src/api/GitSyncAPI.tsx (2)
46-65
: Enums and interfaces for autocommit responses are well-defined.The new enums and interfaces (
AutocommitResponseEnum
,GitAutocommitProgressResponse
,GitTriggerAutocommitResponse
) are clearly defined and align with the autocommit feature's requirements.
251-255
: Method to trigger autocommit is correctly implemented.The
triggerAutocommit
method correctly constructs the API endpoint and makes a POST request, aligning with the autocommit feature's functionality.app/server/appsmith-git/src/main/java/com/appsmith/git/files/operations/FileOperationsCEv2Impl.java (1)
Line range hint
73-182
: Feature-flagged methods for file operations are correctly implemented.The methods (
saveMetadataResource
,saveWidgets
,writeToFile
,readFile
,readFiles
,getFileFormatVersion
,getMainContainer
) are correctly feature-flagged underrelease_git_autocommit_feature_enabled
and include appropriate error handling and logging.app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/helpers/AutoCommitEligibilityHelperImpl.java (1)
Line range hint
21-161
: Methods to determine autocommit eligibility are correctly implemented.The methods (
isServerAutoCommitRequired
,isClientMigrationRequired
,isClientMigrationRequiredFSOps
,isAutoCommitRequired
) are correctly feature-flagged underrelease_git_autocommit_eligibility_enabled
and include appropriate caching, error handling, and clear logic for determining autocommit necessity.app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/GitUtils.java (1)
180-190
: LGTM! Consider adding a comment explaining the use oforg.json.JSONObject
overnet.minidev.json.JSONObject
if this is intentional.app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/AutoCommitServiceCEImpl.java (1)
46-146
: The updates toautoCommitApplication
enhance its functionality and maintainability. Good use of reactive programming and detailed logging.app/client/src/selectors/gitSyncSelectors.tsx (1)
260-261
: The addition ofgetIsTriggeringAutocommit
follows existing selector patterns and is implemented correctly.app/client/src/entities/Engine/AppEditorEngine.ts (1)
299-299
: The addition oftriggerAutocommitInitAction
integrates well with the existing Git functionalities in the editor.app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/helpers/GitAutoCommitHelperImpl.java (4)
9-9
: Added import forAutoCommitResponseDTO
.This import is necessary for the new methods that utilize this DTO.
26-29
: Added static imports forAutoCommitResponse
enum values.These imports simplify the usage of enum values in the code, enhancing readability.
130-130
: Added@FeatureFlagged
annotation toautoCommitServerMigration
.This ensures that the method is conditionally available based on the feature flag, which is a good practice for experimental or conditional features.
219-219
: AddedpublishAutoCommitEvent
method.This method abstracts the logic to decide between client and server auto-commit, which simplifies the main auto-commit flow and enhances modularity.
app/client/src/actions/gitSyncActions.ts (3)
9-12
: Added types related to Git auto-commit.These types are necessary for the new auto-commit functionality and are correctly placed in the imports section.
486-486
: AddedtoggleAutocommitEnabledInit
action.This action allows toggling the auto-commit feature from the UI, which is a necessary part of the feature's control mechanism.
496-536
: Introduced a series of actions to manage auto-commit progress and errors.These actions are essential for handling the state changes in the auto-commit process, including starting, stopping, and resetting progress, as well as handling errors.
app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/AutoCommitEventHandlerCEImpl.java (1)
16-16
: Added import forGitRedisUtils
.This import is necessary for handling Redis operations related to Git, which are used extensively in the auto-commit process.
app/server/appsmith-server/src/test/java/com/appsmith/server/git/autocommit/helpers/AutoCommitEligibilityHelperTest.java (11)
106-106
: Good practice to mock feature flags to control test behavior. This ensures tests remain deterministic.
111-111
: Properly mocking Redis operations is crucial for isolating tests from external dependencies. Well done.
131-131
: Mocking the server version check is key to testing the migration logic. This is a critical part of ensuring the auto-commit logic behaves as expected under different conditions.
216-220
: This test setup is crucial for verifying the condition when only the server is eligible for auto-commit. The mocks are appropriately set to simulate this scenario.
249-249
: This test checks the negative path where no server migration is required. It's important to cover both positive and negative scenarios in unit tests.
268-268
: Testing the positive scenario for server migration requirement. It's good to see both edge cases being tested.
281-281
: Mocking the feature flag to returnFALSE
effectively tests the scenario where the feature is disabled. This is a good practice to ensure feature flags are controlling the flow as expected.
297-304
: This test method is well-structured to verify the client migration logic when the latest DSL version is not ahead. It's crucial to test these boundary conditions.
318-325
: Testing the positive path for client migration requirement when the latest DSL version is ahead. This ensures that the migration logic is triggered correctly under the right conditions.
339-339
: Effectively testing the scenario where the feature flag is off, ensuring that the system behaves correctly when the feature is disabled.
353-357
: This comprehensive test checks the behavior when the feature flag is off, ensuring that no auto-commit is required. It's essential to test the feature flag's impact thoroughly.app/server/appsmith-server/src/test/java/com/appsmith/server/git/autocommit/helpers/GitAutoCommitHelperImplTest.java (8)
11-11
: Ensure the new importAutoCommitResponseDTO
is utilized properly in the tests.
35-36
: Usage of static imports forAutoCommitResponseDTO
responses is good for readability.
246-253
: Verify the progress of auto-commit when it is running.
262-270
: Check auto-commit progress after completion ensures correct reset of state.
279-283
: Correct handling of the scenario when no auto-commit is running.
364-364
: Ensure that the feature flag check is correctly implemented in the context of server migrations.
402-402
: This test should verify that the server does not require migration under the current settings, which is a critical check for stability.
339-339
: The methodautoCommitServerMigration
should ensure that the feature flag for auto-commit is enabled before proceeding.Verification successful
The search results show multiple instances of the
autoCommitServerMigration
method in both implementation and test files. However, the context provided does not clearly indicate whether the feature flag is checked before the method is called in the implementation files.To ensure a thorough verification, we need to specifically check the implementation files for the presence of the feature flag check before calling
autoCommitServerMigration
.
The search results indicate that the
autoCommitServerMigration
method inGitAutoCommitHelperImpl.java
is annotated with@FeatureFlagged(featureFlagName = FeatureFlagEnum.release_git_autocommit_feature_enabled)
. This annotation suggests that the feature flag is indeed checked before the method is executed.Therefore, the concern mentioned in the review comment is addressed by the presence of the
@FeatureFlagged
annotation.
app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/helpers/GitAutoCommitHelperImpl.java
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the feature flag for auto-commit is checked before this method is called. # Test: Search for the method usage. Expect: Feature flag check before the method call. rg --type python $'autoCommitServerMigration'Length of output: 75
Script:
#!/bin/bash # Description: Verify that the feature flag for auto-commit is checked before the method `autoCommitServerMigration` is called. # Test: Search for the method usage in Java files. Expect: Feature flag check before the method call. rg --type java 'autoCommitServerMigration'Length of output: 4277
Script:
#!/bin/bash # Description: Verify that the feature flag for auto-commit is checked before the method `autoCommitServerMigration` is called. # Extract and inspect the context around the method calls in the implementation files. rg --type java 'autoCommitServerMigration' -A 5 -B 5Length of output: 34396
Script:
#!/bin/bash # Description: Verify that the feature flag for auto-commit is checked before the method `autoCommitServerMigration` is called in implementation files. # Extract and inspect the context around the method calls in the implementation files. rg --type java 'autoCommitServerMigration' -A 10 -B 10 | grep -E 'featureFlagService\.check|FeatureFlagEnum\.release_git_autocommit_feature_enabled'Length of output: 1679
app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/GitControllerCE.java (4)
16-16
: Ensure the new importAutoCommitResponseDTO
is utilized properly in the controller methods.
25-25
: The addition ofAutoCommitService
is crucial for the new auto-commit feature. Ensure it is injected and used correctly.
57-57
: TheautoCommitService
is correctly injected into the controller, enabling the new auto-commit endpoints.
347-349
: This endpoint fetches the progress of an auto-commit. It should correctly handle cases where no progress is available.app/server/appsmith-server/src/test/java/com/appsmith/server/git/ServerSchemaMigrationEnforcerTest.java (8)
3-6
: The new imports related toISOStringToInstantConverter
andModifiedResources
are crucial for the tests. Ensure they are used correctly.
13-13
: The addition ofCachedFeatures
is important for feature flag checks in tests.
18-18
:FeatureFlagService
is correctly mocked to control feature flag states during tests.
22-22
: The customGson
configuration withISOStringToInstantConverter
ensures correct serialization ofInstant
types.
Line range hint
207-240
: This test ensures that importing and then exporting an application results in the same JSON, which is crucial for version control consistency.
296-338
: This test checks for differences when re-saving files with different serialization logic. It's important for detecting unintended changes.
342-365
: This test verifies that saving a file with the same serialization logic does not introduce diffs, which is crucial for data integrity.
369-423
: This complex test simulates a full cycle of import, export, and git operations to ensure consistency and no unintended diffs.app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/CommonGitFileUtilsCE.java (1)
Line range hint
326-367
: Ensure consistent error handling ingetMetadataServerSchemaMigrationVersion
.The method
getMetadataServerSchemaMigrationVersion
usesMono.error
for input validation but does not handle potential exceptions fromreconstructMetadataFromRepo
. Verify that all potential exceptions are handled consistently across the method.Verification successful
The method
reconstructMetadataFromRepo
does include error handling usingonErrorResume
to handle potential exceptions. This ensures that any errors occurring during the reconstruction of metadata from the Git repository are managed consistently.
reconstructMetadataFromRepo
handles errors usingonErrorResume
to wrap exceptions inAppsmithException
.This confirms that the error handling in
getMetadataServerSchemaMigrationVersion
is consistent, as it relies onreconstructMetadataFromRepo
which already includes error handling.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify consistent error handling in `getMetadataServerSchemaMigrationVersion`. rg --type java 'Mono.error' app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/CommonGitFileUtilsCE.javaLength of output: 1434
Script:
#!/bin/bash # Search for the definition of `reconstructMetadataFromRepo` and check its error handling. ast-grep --lang java --pattern 'reconstructMetadataFromRepo($_, $_, $_, $_, $_, $_)'Length of output: 491
Script:
#!/bin/bash # Search for the definition of `reconstructMetadataFromRepo` in the codebase. ast-grep --lang java --pattern 'Mono<Map<String, Integer>> reconstructMetadataFromRepo($_, $_, $_, $_, $_, $_)'Length of output: 614
Script:
#!/bin/bash # Correct the pattern syntax and search for the definition of `reconstructMetadataFromRepo` in the codebase. ast-grep --lang java --pattern 'Mono<Map<String, Integer>> reconstructMetadataFromRepo($_, $_, $_, $_, $_, $_) { $$$ }'Length of output: 630
Script:
#!/bin/bash # Simplify the pattern syntax and search for the definition of `reconstructMetadataFromRepo` in the codebase. ast-grep --lang java --pattern 'reconstructMetadataFromRepo'Length of output: 411
Script:
#!/bin/bash # Extract the definition of `reconstructMetadataFromRepo` from `CommonGitFileUtilsCE.java`. sed -n '291,311p' app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/CommonGitFileUtilsCE.javaLength of output: 1280
app/client/src/reducers/uiReducers/gitSyncReducer.ts (1)
58-58
: Ensure correct handling of autocommit state transitions.The changes correctly handle the state transitions for triggering autocommit. This includes setting the
triggeringAutocommit
flag appropriately during the initiation, success, and error phases, which is crucial for managing UI state in response to autocommit actions.Also applies to: 623-634
app/server/appsmith-server/src/test/java/com/appsmith/server/git/autocommit/AutoCommitEventHandlerImplTest.java (1)
55-55
: Verify correct feature flag handling in autocommit tests.The tests correctly manipulate the
release_git_autocommit_feature_enabled
feature flag to simulate different scenarios. This is crucial for ensuring that the autocommit functionality behaves as expected under different feature flag settings.Also applies to: 499-504, 537-537
app/server/appsmith-server/src/main/java/com/appsmith/server/newpages/base/NewPageServiceCEImpl.java (1)
691-708
: The implementation offindByApplicationIdAndApplicationMode
method correctly handles the filtering of pages based on their deletion status and application mode. Good use of functional programming paradigms.app/server/appsmith-server/src/test/java/com/appsmith/server/git/autocommit/AutoCommitServiceTest.java (10)
258-319
: Review test methodtestAutoCommit_whenOnlyServerIsEligibleForMigration_commitSuccess
.The test method is well-structured and covers the scenario when only the server is eligible for migration. The assertions are correctly checking the expected outcomes.
321-391
: Review test methodtestAutoCommit_whenOnlyClientIsEligibleForMigration_commitSuccess
.This test method correctly simulates the client-only migration scenario and validates the autocommit functionality through assertions.
394-447
: Review test methodtestAutoCommit_whenAutoCommitNotEligible_returnsFalse
.The test method effectively handles the scenario where autocommit is not eligible, ensuring that the system remains in a consistent state without unnecessary commits.
450-470
: Review test methodtestAutoCommit_whenAutoCommitAlreadyInProgressOnAnotherBranch_returnsLocked
.This test method correctly handles the scenario where an autocommit is already in progress on another branch, ensuring that the response is appropriately locked.
472-490
: Review test methodtestAutoCommit_whenAutoCommitAlreadyInProgressOnSameBranch_returnsInProgress
.The test method is well-implemented to handle cases where an autocommit is already in progress on the same branch, and it correctly returns an 'IN_PROGRESS' status.
493-510
: Review test methodtestAutoCommit_whenNoGitMetadata_returnsNonGitApp
.This test method is crucial for handling cases where no Git metadata is available, and it correctly identifies and handles such scenarios.
513-535
: Review test methodtestAutoCommit_whenAutoCommitEligibleButPrerequisiteNotComplete_returnsRequired
.The test method effectively checks for prerequisites before proceeding with autocommit, ensuring that all conditions are met before making changes.
538-609
: Review test methodtestAutoCommit_whenServerIsRunningMigrationCallsAutocommitAgainOnSameBranch_ReturnsAutoCommitInProgress
.This test method handles a complex scenario involving server migration and subsequent autocommit calls on the same branch, ensuring robustness in handling concurrent operations.
612-684
: Review test methodtestAutoCommit_whenServerIsRunningMigrationCallsAutocommitAgainOnDiffBranch_ReturnsAutoCommitLocked
.This test method is well-structured to handle cases of server migration followed by an autocommit call on a different branch, ensuring that the system correctly locks the operation.
73-74
: Ensure proper usage of@SpyBean
forAutoCommitService
.app/client/src/sagas/GitSyncSagas.ts (6)
23-29
: Ensure the newly imported types and enums are used correctly throughout the file.
48-54
: Verify that the new actions are correctly dispatched and handled in their respective sagas.
1174-1188
: The functionisAutocommitHappening
correctly evaluates the autocommit status from the response.
1261-1266
: The sagatriggerAutocommitSaga
correctly manages the lifecycle of the autocommit polling process.
1289-1290
: The mappings ingitRequestBlockingActions
andgitRequestNonBlockingActions
correctly associate git actions with their respective sagas.
1192-1256
: The sagapollAutocommitProgressSaga
effectively manages the polling of autocommit progress. However, ensure safe usage of optional chaining to prevent potential runtime errors.Verification successful
The script successfully identified multiple instances of optional chaining usage across the codebase. However, to specifically verify the safe usage of optional chaining within the
pollAutocommitProgressSaga
function inapp/client/src/sagas/GitSyncSagas.ts
, we need to focus on that particular file.Let's refine our search to only check for optional chaining within
app/client/src/sagas/GitSyncSagas.ts
.
The script output shows multiple instances of optional chaining usage within
app/client/src/sagas/GitSyncSagas.ts
. Specifically, the optional chaining in thepollAutocommitProgressSaga
function appears to be used safely, as it checks for the existence of properties before accessing them.Here are the relevant lines from the output:
app/client/src/sagas/GitSyncSagas.ts: if (isAutocommitHappening(triggerResponse?.data)) {
app/client/src/sagas/GitSyncSagas.ts: if (!isAutocommitHappening(progressResponse?.data)) {
app/client/src/sagas/GitSyncSagas.ts: error: progressResponse?.responseMeta?.error?.message,
These lines indicate that the optional chaining is used to safely access nested properties, ensuring that the code does not throw errors if any intermediate property is
undefined
ornull
.Based on this analysis, the optional chaining usage in the
pollAutocommitProgressSaga
function is safe and does not pose any risk of runtime errors.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the safe usage of optional chaining in `pollAutocommitProgressSaga`. # Test: Search for optional chaining usage. Expect: No occurrences that could result in undefined behavior. rg --type typescript $'?.'Length of output: 105
Script:
#!/bin/bash # Description: Verify the safe usage of optional chaining in `pollAutocommitProgressSaga`. # Test: Search for optional chaining usage. Expect: No occurrences that could result in undefined behavior. rg --type typescript '\?\.'Length of output: 64
Script:
#!/bin/bash # Description: Verify the safe usage of optional chaining in `pollAutocommitProgressSaga`. # Test: Search for optional chaining usage. Expect: No occurrences that could result in undefined behavior. rg --glob '*.ts' '\?\.'Length of output: 206190
Script:
#!/bin/bash # Description: Verify the safe usage of optional chaining in `pollAutocommitProgressSaga` within `app/client/src/sagas/GitSyncSagas.ts`. # Test: Search for optional chaining usage in the specific file. rg --glob 'app/client/src/sagas/GitSyncSagas.ts' '\?\.'Length of output: 5612
app/client/src/ce/constants/ReduxActionConstants.tsx (2)
134-135
: New action types related to autocommit have been added correctly.
965-965
: The addition ofGIT_AUTOCOMMIT_TRIGGER_ERROR
is appropriate for handling errors related to autocommit triggers.
String workspaceId, | ||
String defaultArtifactId, | ||
String repoName, | ||
String branchName, | ||
Path baseRepoSuffix, | ||
Boolean isResetToLastCommitRequired) { | ||
Mono<Object> metadataMono; | ||
try { | ||
// instead of checking out to last branch we are first cleaning the git repo, | ||
// then checking out to the desired branch | ||
metadataMono = gitExecutor | ||
.resetToLastCommit(baseRepoSuffix, branchName) | ||
.map(isSwitched -> { | ||
Path baseRepoPath = | ||
Paths.get(gitServiceConfig.getGitRootPath()).resolve(baseRepoSuffix); | ||
Object metadata = fileOperations.readFile( | ||
baseRepoPath.resolve(CommonConstants.METADATA + CommonConstants.JSON_EXTENSION)); | ||
return metadata; | ||
}); | ||
Mono<Boolean> gitResetMono = Mono.just(Boolean.TRUE); | ||
if (Boolean.TRUE.equals(isResetToLastCommitRequired)) { | ||
// instead of checking out to last branch we are first cleaning the git repo, | ||
// then checking out to the desired branch | ||
gitResetMono = gitExecutor.resetToLastCommit(baseRepoSuffix, branchName); | ||
} | ||
|
||
metadataMono = gitResetMono.map(isSwitched -> { | ||
Path baseRepoPath = Paths.get(gitServiceConfig.getGitRootPath()).resolve(baseRepoSuffix); | ||
Object metadata = fileOperations.readFile( | ||
baseRepoPath.resolve(CommonConstants.METADATA + CommonConstants.JSON_EXTENSION)); | ||
return metadata; | ||
}); | ||
} catch (GitAPIException | IOException exception) { | ||
metadataMono = Mono.error(exception); | ||
} | ||
|
||
return metadataMono.subscribeOn(scheduler); | ||
} | ||
|
||
@Override | ||
public Mono<Object> reconstructPageFromGitRepo( | ||
String pageName, String branchName, Path baseRepoSuffixPath, Boolean resetToLastCommitRequired) { | ||
Mono<Object> pageObjectMono; | ||
try { | ||
Mono<Boolean> resetToLastCommit = Mono.just(Boolean.TRUE); | ||
|
||
if (Boolean.TRUE.equals(resetToLastCommitRequired)) { | ||
// instead of checking out to last branch we are first cleaning the git repo, | ||
// then checking out to the desired branch | ||
resetToLastCommit = gitExecutor.resetToLastCommit(baseRepoSuffixPath, branchName); | ||
} | ||
|
||
pageObjectMono = resetToLastCommit.map(isSwitched -> { | ||
Path pageSuffix = Paths.get(PAGE_DIRECTORY, pageName); | ||
Path repoPath = Paths.get(gitServiceConfig.getGitRootPath()) | ||
.resolve(baseRepoSuffixPath) | ||
.resolve(pageSuffix); | ||
|
||
Object pageObject = | ||
fileOperations.readFile(repoPath.resolve(pageName + CommonConstants.JSON_EXTENSION)); | ||
|
||
return pageObject; | ||
}); | ||
} catch (GitAPIException | IOException exception) { | ||
pageObjectMono = Mono.error(exception); | ||
} | ||
|
||
return pageObjectMono.subscribeOn(scheduler); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure proper error handling in reconstructMetadataFromGitRepo
and reconstructPageFromGitRepo
.
Both methods reconstructMetadataFromGitRepo
and reconstructPageFromGitRepo
catch GitAPIException
and IOException
but only return the error wrapped in a Mono
. It would be beneficial to add logging before returning the error to aid in debugging and maintaining the application. Additionally, consider implementing a more robust error handling strategy that could include retries or alternative actions in case of failure.
// Suggested addition:
} catch (GitAPIException | IOException exception) {
log.error("Failed to reset to last commit or read file: {}", exception.getMessage(), exception);
metadataMono = Mono.error(exception);
}
&& (modifiedResources.isAllModified() | ||
|| !CollectionUtils.isEmpty( | ||
modifiedResources.getModifiedResourceMap().get(CUSTOM_JS_LIB_LIST)))) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider optimizing the condition check for modified JS libraries.
The current condition checks for any modification in JS libraries using multiple method calls and conditions. This can be simplified and optimized by encapsulating the logic into a method that directly returns a boolean indicating if any JS library has been modified. This would make the code cleaner and potentially more efficient.
// Suggested refactor:
private boolean isJsLibModified(ModifiedResources modifiedResources) {
return modifiedResources != null && (modifiedResources.isAllModified() || !CollectionUtils.isEmpty(modifiedResources.getModifiedResourceMap().get(CUSTOM_JS_LIB_LIST)));
}
// Usage in the method:
if (isJsLibModified(modifiedResources)) {
// existing logic
}
String workspaceId, | ||
String applicationId, | ||
String repoName, | ||
String branchName, | ||
Boolean isResetToLastCommitRequired, | ||
ArtifactType artifactType) { | ||
|
||
ArtifactGitFileUtils<?> artifactGitFileUtils = getArtifactBasedFileHelper(artifactType); | ||
Path baseRepoSuffix = artifactGitFileUtils.getRepoSuffixPath(workspaceId, applicationId, repoName); | ||
|
||
return fileUtils | ||
.reconstructMetadataFromGitRepo(workspaceId, applicationId, repoName, branchName, baseRepoSuffix) | ||
.reconstructMetadataFromGitRepo( | ||
workspaceId, applicationId, repoName, branchName, baseRepoSuffix, isResetToLastCommitRequired) | ||
.onErrorResume(error -> Mono.error( | ||
new AppsmithException(AppsmithError.GIT_ACTION_FAILED, "checkout", error.getMessage()))) | ||
new AppsmithException(AppsmithError.GIT_ACTION_FAILED, CHECKOUT_BRANCH, error.getMessage()))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider handling specific Git exceptions more granularly.
The method reconstructMetadataFromRepo
uses a broad onErrorResume
to handle all exceptions by wrapping them into an AppsmithException
. It might be beneficial to handle specific Git-related exceptions separately to provide more detailed error messages or recovery options.
...erver/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/CommonGitFileUtilsCE.java
Show resolved
Hide resolved
public Mono<AutoCommitResponseDTO> getAutoCommitProgress(String defaultApplicationId, String branchName) { | ||
return redisUtils | ||
.getRunningAutoCommitBranchName(applicationId) | ||
.zipWith(redisUtils.getAutoCommitProgress(applicationId)) | ||
.getRunningAutoCommitBranchName(defaultApplicationId) | ||
.zipWith(redisUtils.getAutoCommitProgress(defaultApplicationId)) | ||
.map(tuple2 -> { | ||
AutoCommitProgressDTO autoCommitProgressDTO = new AutoCommitProgressDTO(Boolean.TRUE); | ||
autoCommitProgressDTO.setBranchName(tuple2.getT1()); | ||
autoCommitProgressDTO.setProgress(tuple2.getT2()); | ||
return autoCommitProgressDTO; | ||
String branchNameFromRedis = tuple2.getT1(); | ||
|
||
AutoCommitResponseDTO autoCommitResponseDTO = new AutoCommitResponseDTO(); | ||
autoCommitResponseDTO.setProgress(tuple2.getT2()); | ||
autoCommitResponseDTO.setBranchName(branchNameFromRedis); | ||
|
||
if (branchNameFromRedis.equals(branchName)) { | ||
autoCommitResponseDTO.setAutoCommitResponse(IN_PROGRESS); | ||
} else { | ||
autoCommitResponseDTO.setAutoCommitResponse(LOCKED); | ||
} | ||
|
||
return autoCommitResponseDTO; | ||
}) | ||
.defaultIfEmpty(new AutoCommitProgressDTO(Boolean.FALSE)); | ||
.defaultIfEmpty(new AutoCommitResponseDTO(IDLE)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored getAutoCommitProgress
to use AutoCommitResponseDTO
.
This method now properly encapsulates the progress fetching logic using the DTO, which is a good practice for maintainability and clarity. Consider adding error handling for Redis operations.
case 7: | ||
applicationJson.setServerSchemaVersion(8); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add migration logic or comments for schema version 7.
The case for schema version 7 only increments the server schema version to 8 without performing any migration steps. Please add the necessary migration logic or comments explaining why this version increment is needed.
.../appsmith-server/src/main/java/com/appsmith/server/git/autocommit/AutoCommitServiceImpl.java
Show resolved
Hide resolved
...ver/appsmith-server/src/main/java/com/appsmith/server/git/common/CommonGitServiceCEImpl.java
Show resolved
Hide resolved
@@ -1,7 +1,8 @@ | |||
package com.appsmith.server.git; | |||
package com.appsmith.server.git.autocommit; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tip
Codebase Verification
The output indicates that the injected services are listed in the constructor parameters and passed to the superclass, but there is no evidence of their usage within the class methods. This suggests that the services might not be utilized within the AutoCommitEventHandlerImpl
class.
To ensure that all injected services are used appropriately, the class methods should be reviewed for their usage. Since the script did not find any occurrences, it is likely that these services are not being used within the class methods.
- : The injected services (
GitRedisUtils
,RedisUtils
,DSLMigrationUtils
,CommonGitFileUtils
,GitExecutor
,ProjectProperties
,AnalyticsService
) are not utilized within theAutoCommitEventHandlerImpl
class methods. Please review and ensure that these services are used appropriately or remove them if they are not needed.
Analysis chain
Constructor parameters are correctly passed to the superclass. Ensure all injected services are utilized appropriately within the class.
Also applies to: 5-5
The script output shows that the injected services are imported and listed in the constructor parameters, but it does not confirm their usage within the class methods. To ensure that all injected services are utilized appropriately within the class, we need to search for their usage in the method bodies.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify that the injected services are used in the class.
# Test: Search for usage of `GitRedisUtils` and other services. Expect: At least one occurrence for each.
rg --type java 'GitRedisUtils|RedisUtils|DSLMigrationUtils|CommonGitFileUtils|GitExecutor|ProjectProperties|AnalyticsService' app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/AutoCommitEventHandlerImpl.java
Length of output: 940
Script:
#!/bin/bash
# Description: Verify that the injected services are used in the class methods.
# Test: Search for usage of `gitRedisUtils`, `redisUtils`, `dslMigrationUtils`, `commonGitFileUtils`, `gitExecutor`, `projectProperties`, and `analyticsService` within the class methods.
rg --type java 'gitRedisUtils|redisUtils|dslMigrationUtils|commonGitFileUtils|gitExecutor|projectProperties|analyticsService' app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/AutoCommitEventHandlerImpl.java
Length of output: 775
public Mono<ResponseDTO<AutoCommitResponseDTO>> autoCommitApplication( | ||
@PathVariable String defaultApplicationId, @RequestHeader(name = FieldName.BRANCH_NAME) String branchName) { | ||
return autoCommitService | ||
.autoCommitApplication(defaultApplicationId, branchName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tip
Codebase Verification
The autoCommitApplication
method in AutoCommitServiceCEImpl.java
does include error handling by returning Mono.error
with appropriate exceptions when parameters are invalid or resources are not found. However, there is no explicit logging of these errors.
- Ensure that errors are logged in the
autoCommitApplication
method inAutoCommitServiceCEImpl.java
.
Analysis chain
This endpoint triggers the auto-commit for an application. Ensure that it handles errors gracefully and logs them.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify error handling in the auto-commit application endpoint.
# Test: Search for error handling logic. Expect: Proper error handling and logging.
rg --type python $'autoCommitApplication'
Length of output: 71
Script:
#!/bin/bash
# Description: Verify error handling in the auto-commit application endpoint in Java code.
# Test: Search for error handling logic within the autoCommitApplication method in GitControllerCE.java.
rg --type java 'autoCommitApplication' -A 20
Length of output: 81048
Script:
#!/bin/bash
# Description: Verify error handling in the auto-commit application service method in Java code.
# Test: Search for error handling logic within the autoCommitApplication method in AutoCommitServiceCEImpl.java.
rg --type java 'autoCommitApplication' -A 20 app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/AutoCommitServiceCEImpl.java
Length of output: 1356
/build-deploy-preview skip-tests=true |
Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/9412345271. |
There was a problem hiding this 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 (2)
app/client/src/sagas/GitSyncSagas.ts (2)
Line range hint
714-714
: Address potential TypeError due to unsafe optional chaining.- const { mergeStatus } = response?.data; + const mergeStatus = response?.data?.mergeStatus;
Line range hint
842-842
: Address potential TypeError due to unsafe optional chaining.- const defaultPage = app.pages.find((eachPage) => !!eachPage.isDefault); + const defaultPage = app.pages?.find((eachPage) => !!eachPage.isDefault);
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- app/client/src/sagas/GitSyncSagas.ts (8 hunks)
Additional context used
Biome
app/client/src/sagas/GitSyncSagas.ts
[error] 714-714: Unsafe usage of optional chaining. (lint/correctness/noUnsafeOptionalChaining)
If it short-circuits with 'undefined' the evaluation will throw TypeError here:
[error] 842-842: Unsafe usage of optional chaining. (lint/correctness/noUnsafeOptionalChaining)
If it short-circuits with 'undefined' the evaluation will throw TypeError here:
Additional comments not posted (5)
app/client/src/sagas/GitSyncSagas.ts (5)
23-29
: Ensure correct import ofAutocommitResponseEnum
and related types.
48-54
: Verify the correct implementation of new actions related to autocommit progress.
128-131
: Ensure that the new typesGitDiscardResponse
andGitMetadata
are correctly used within the sagas.
1179-1279
: Review the implementation oftriggerAutocommitSaga
and related functions for handling autocommit.
1302-1303
: Ensure that the new sagas for triggering autocommit are correctly registered in the action handlers.
Deploy-Preview-URL: https://ce-34062.dp.appsmith.com |
Failed server tests
|
/build-deploy-preview skip-tests=true |
Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/9413377443. |
There was a problem hiding this 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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- app/client/src/sagas/GitSyncSagas.ts (9 hunks)
Additional context used
Biome
app/client/src/sagas/GitSyncSagas.ts
[error] 715-715: Unsafe usage of optional chaining. (lint/correctness/noUnsafeOptionalChaining)
If it short-circuits with 'undefined' the evaluation will throw TypeError here:
[error] 843-843: Unsafe usage of optional chaining. (lint/correctness/noUnsafeOptionalChaining)
If it short-circuits with 'undefined' the evaluation will throw TypeError here:
Additional comments not posted (9)
app/client/src/sagas/GitSyncSagas.ts (9)
23-28
: Added new types for handling Git autocommit responses. Ensure these types are correctly used throughout the codebase.
48-54
: Added new actions related to autocommit progress and error handling. Verify that these actions are dispatched correctly in the corresponding sagas.
118-118
: Added a new selector for Git metadata. Ensure that this selector is used consistently where Git metadata is required.
129-132
: Added new types for Git discard response and Git metadata. Ensure these types are correctly used throughout the codebase.
142-143
: Added a new selector for feature flag checks. This is crucial for feature toggling and should be used to conditionally enable or disable features based on server-side configurations.
1180-1194
: Added a new functionisAutocommitHappening
to check the status of autocommit. This function is critical for managing the state of autocommit operations. Ensure that it is used correctly in the sagas that handle autocommit.
1195-1262
: Significant changes inpollAutocommitProgressSaga
. This saga now handles the polling of autocommit progress and updates the state accordingly. Ensure that the error handling and state updates are robust and cover all edge cases.
1267-1282
: AddedtriggerAutocommitSaga
to handle the triggering of autocommit based on feature flags and autocommit settings. This is a critical piece of functionality that should be thoroughly tested to ensure it behaves as expected under various conditions.
1305-1307
: Updated the mapping of Redux action types to sagas. This change is crucial for ensuring that the correct sagas are triggered for the corresponding actions. Verify that all mappings are correct and that no actions are left unhandled.
Deploy-Preview-URL: https://ce-34062.dp.appsmith.com |
There was a problem hiding this 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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- app/server/appsmith-server/src/main/java/com/appsmith/server/domains/Theme.java (1 hunks)
- app/server/appsmith-server/src/test/java/com/appsmith/server/git/ServerSchemaMigrationEnforcerTest.java (7 hunks)
Additional comments not posted (5)
app/server/appsmith-server/src/main/java/com/appsmith/server/domains/Theme.java (3)
41-41
: The addition of theconfig
field with appropriate JsonView annotations aligns well with existing fields. Good job maintaining consistency.
44-44
: Theproperties
field is correctly annotated and follows the pattern established by other theme attributes. This should enhance the theme's configurability.
47-47
: The addition of thestylesheet
field with JsonView annotations is a great enhancement for theme customization. It aligns with the visibility settings of similar fields.app/server/appsmith-server/src/test/java/com/appsmith/server/git/ServerSchemaMigrationEnforcerTest.java (2)
3-6
: The addition of new imports is justified as they support the new functionalities tested in this file, such as Git operations and feature flag checks.Also applies to: 13-13, 18-18, 20-20, 22-22, 26-28, 30-30, 34-34
114-114
: The addition of new test methods and the necessary setup in the test class are well-implemented. These changes are crucial for ensuring that schema migrations are handled correctly.Also applies to: 117-117, 120-120, 126-126, 207-207, 296-296, 341-341, 368-368
Description
The changes are related to the "auto-commit" migration feature.
Server changes
UI changes
Fixes #30110 #34067 #34068
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.All"
🔍 Cypress test results
Tip
🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/9419768186
Commit: 129eaee
Cypress dashboard url: Click here!
Communication
Should the DevRel and Marketing teams inform users about this change?
Summary by CodeRabbit
New Features
Bug Fixes
Refactor
Chores