-
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: refactor datasource import flow to add support for transaction in pg #34514
Conversation
WalkthroughRecent updates to the Changes
Poem
Tip AI model upgrade
|
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: 3
Outside diff range and nitpick comments (3)
app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/ce/MappedImportableResourcesCE_DTO.java (1)
50-52
: Addition of Dry Run Query Maps:The new fields
datasourceDryRunQueries
anddatasourceStorageDryRunQueries
are added to handle dry run operations. It's crucial to ensure that these maps are used in a thread-safe manner throughout the codebase, especially if accessed concurrently.Please review all usages of these new maps to ensure thread safety and correct synchronization if needed.
app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/importable/DatasourceImportableServiceCEImpl.java (1)
Line range hint
283-337
: Optimize datasource creation logic.The creation logic is somewhat complex and could benefit from further breakdown into smaller, more manageable methods. This would improve readability and maintainability.
- return datasourceService.createDatasourceFromDatasourceStorage(datasourceStorage) - .flatMap(datasource -> datasourceService.createWithoutPermissions(datasource, mappedImportableResourcesDTO.getDatasourceStorageDryRunQueries())); + return createAndRegisterDatasource(datasourceStorage, mappedImportableResourcesDTO);Create a new method
createAndRegisterDatasource
that encapsulates the creation and registration logic.app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/base/DatasourceServiceCEImpl.java (1)
Line range hint
153-236
: Approved: Extensive method refactoring to support dry run operations.The method
createEx
has been significantly refactored to handle dry run conditions effectively. Consider adding comprehensive unit tests to cover the new logic paths introduced byisDryOps
anddatasourceStorageDryRunQueries
.Would you like assistance in setting up the unit tests for this method?
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (8)
- app/server/appsmith-server/src/main/java/com/appsmith/server/constants/ce/FieldNameCE.java (1 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/base/DatasourceServiceCE.java (3 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/base/DatasourceServiceCEImpl.java (6 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/importable/DatasourceImportableServiceCEImpl.java (5 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/datasourcestorages/base/DatasourceStorageServiceCE.java (2 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/datasourcestorages/base/DatasourceStorageServiceCEImpl.java (4 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/ce/MappedImportableResourcesCE_DTO.java (2 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/DatasourceContextServiceCEImpl.java (1 hunks)
Additional context used
Gitleaks
app/server/appsmith-server/src/main/java/com/appsmith/server/constants/ce/FieldNameCE.java
5-5: Identified a HashiCorp Terraform password field, risking unauthorized infrastructure configuration and security breaches. (hashicorp-tf-password)
Additional comments not posted (11)
app/server/appsmith-server/src/main/java/com/appsmith/server/datasourcestorages/base/DatasourceStorageServiceCE.java (2)
18-19
: Addition ofisDryOps
Parameter increate
Method:The new
isDryOps
parameter in thecreate
method should be documented to explain its purpose and effect when set to true or false.Consider adding a Javadoc comment for the
isDryOps
parameter to improve code readability and maintainability.
38-38
: Handling ofisDryOps
inupdateDatasourceStorage
:Ensure that the
isDryOps
parameter is appropriately used within the method to perform operations based on its value, especially concerning transactional integrity and rollback scenarios.Verification successful
Handling of
isDryOps
inupdateDatasourceStorage
:The
isDryOps
parameter is appropriately used within theupdateDatasourceStorage
method to control whether changes are persisted to the repository or not, ensuring proper handling of dry-run operations.
- The parameter is passed to the
validateAndSaveDatasourceStorageToRepository
method, which uses it to decide whether to perform a bulk write operation without saving to the repository.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the `isDryOps` parameter is used correctly in the `updateDatasourceStorage` method. # Test: Search for the method usage. Expect: Correct handling of the parameter in all usages. rg --type java $'updateDatasourceStorage'Length of output: 2549
Script:
#!/bin/bash # Extract the implementation of the `updateDatasourceStorage` method in DatasourceStorageServiceCE.java and DatasourceStorageServiceCEImpl.java # Search for the method implementation in DatasourceStorageServiceCE.java ast-grep --lang java --pattern $'Mono<DatasourceStorage> updateDatasourceStorage($_, $_, $_, $_) { $$$ }' app/server/appsmith-server/src/main/java/com/appsmith/server/datasourcestorages/base/DatasourceStorageServiceCE.java # Search for the method implementation in DatasourceStorageServiceCEImpl.java ast-grep --lang java --pattern $'public Mono<DatasourceStorage> updateDatasourceStorage($_, $_, $_, $_) { $$$ }' app/server/appsmith-server/src/main/java/com/appsmith/server/datasourcestorages/base/DatasourceStorageServiceCEImpl.javaLength of output: 1461
Script:
#!/bin/bash # Locate the method definition of `updateDatasourceStorage` in DatasourceStorageServiceCE.java and DatasourceStorageServiceCEImpl.java # Search for the method definition in DatasourceStorageServiceCE.java rg --type java --pcre2 --context 10 'Mono<DatasourceStorage> updateDatasourceStorage\(' app/server/appsmith-server/src/main/java/com/appsmith/server/datasourcestorages/base/DatasourceStorageServiceCE.java # Search for the method definition in DatasourceStorageServiceCEImpl.java rg --type java --pcre2 --context 10 'public Mono<DatasourceStorage> updateDatasourceStorage\(' app/server/appsmith-server/src/main/java/com/appsmith/server/datasourcestorages/base/DatasourceStorageServiceCEImpl.javaLength of output: 2275
Script:
#!/bin/bash # Extract the complete implementation of the `updateDatasourceStorage` method in DatasourceStorageServiceCEImpl.java # Search for the complete method implementation in DatasourceStorageServiceCEImpl.java rg --type java --pcre2 --context 50 'public Mono<DatasourceStorage> updateDatasourceStorage\(' app/server/appsmith-server/src/main/java/com/appsmith/server/datasourcestorages/base/DatasourceStorageServiceCEImpl.javaLength of output: 5200
Script:
#!/bin/bash # Extract the implementation of the `validateAndSaveDatasourceStorageToRepository` method in DatasourceStorageServiceCEImpl.java # Search for the method implementation in DatasourceStorageServiceCEImpl.java rg --type java --pcre2 --context 50 'validateAndSaveDatasourceStorageToRepository\(' app/server/appsmith-server/src/main/java/com/appsmith/server/datasourcestorages/base/DatasourceStorageServiceCEImpl.javaLength of output: 12735
app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/base/DatasourceServiceCE.java (1)
43-44
: Addition of Dry Run Parameters insave
andcreateWithoutPermissions
Methods:The
isDryOps
anddatasourceStorageDryRunQueries
parameters are added to support dry run operations. Ensure that these parameters are handled correctly to maintain data integrity and prevent any side effects in non-dry run scenarios.Also applies to: 69-70
app/server/appsmith-server/src/main/java/com/appsmith/server/constants/ce/FieldNameCE.java (1)
206-206
: Addition ofCREATE
Constant:The new constant
CREATE
is set to "save". Ensure that this constant is used consistently across the codebase to avoid any discrepancies or conflicts with other constants.app/server/appsmith-server/src/main/java/com/appsmith/server/datasourcestorages/base/DatasourceStorageServiceCEImpl.java (1)
68-70
: Implementation ofisDryOps
in Various Methods:The
isDryOps
parameter is implemented in several methods to support dry run operations. It's crucial to ensure that this parameter is used correctly to avoid any unintended side effects or data corruption.Also applies to: 138-141, 227-240
Verification successful
Implementation of
isDryOps
in Various Methods:The
isDryOps
parameter is implemented in several methods to support dry run operations. It's crucial to ensure that this parameter is used correctly to avoid any unintended side effects or data corruption.
- File:
app/server/appsmith-server/src/main/java/com/appsmith/server/datasourcestorages/base/DatasourceStorageServiceCEImpl.java
- Lines 68-70:
create
method correctly includes theisDryOps
parameter.- Lines 138-141:
updateDatasourceStorage
method correctly includes theisDryOps
parameter.- Lines 227-240:
validateAndSaveDatasourceStorageToRepository
method correctly handles theisDryOps
parameter.These methods appear to handle the
isDryOps
parameter appropriately, ensuring that dry run operations are correctly implemented.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the `isDryOps` parameter is used correctly in the implementation of various methods. # Test: Search for the method usage. Expect: Correct handling of the parameter in all usages. rg --type java $'create\|updateDatasourceStorage\|validateAndSaveDatasourceStorageToRepository'Length of output: 96
Script:
#!/bin/bash # Description: Locate the definitions and usages of methods to verify the correct handling of the `isDryOps` parameter. # Search for the method definitions and their parameters in the codebase. ast-grep --lang java --pattern 'public Mono<DatasourceStorage> create(DatasourceStorage $_, boolean isDryOps) { $$$ }' ast-grep --lang java --pattern 'public Mono<DatasourceStorage> updateDatasourceStorage($_, boolean isDryOps) { $$$ }' ast-grep --lang java --pattern 'private Mono<DatasourceStorage> validateAndSaveDatasourceStorageToRepository($_, boolean isDryOps) { $$$ }'Length of output: 3079
Script:
#!/bin/bash # Description: Locate the definitions and usages of the `create` and `updateDatasourceStorage` methods to verify the correct handling of the `isDryOps` parameter. # Search for the `create` method definition with `isDryOps` parameter. ast-grep --lang java --pattern 'public Mono<DatasourceStorage> create(DatasourceStorage $_, boolean isDryOps) { $$$ }' # Search for the `updateDatasourceStorage` method definition with `isDryOps` parameter. ast-grep --lang java --pattern 'public Mono<DatasourceStorage> updateDatasourceStorage($_, boolean isDryOps) { $$$ }'Length of output: 240
Script:
#!/bin/bash # Description: Locate the definitions and usages of the `create` and `updateDatasourceStorage` methods to verify the correct handling of the `isDryOps` parameter. # Search for the `create` method definition with `isDryOps` parameter. rg --type java 'public Mono<DatasourceStorage> create' # Search for the `updateDatasourceStorage` method definition with `isDryOps` parameter. rg --type java 'public Mono<DatasourceStorage> updateDatasourceStorage' # Search for the `isDryOps` parameter usage in the codebase to trace its flow. rg --type java 'isDryOps'Length of output: 3528
app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/importable/DatasourceImportableServiceCEImpl.java (1)
245-254
: Ensure proper handling of permissions and dry run operations.The method
createUniqueDatasourceIfNotPresent
is correctly checking permissions and handling dry run operations. However, consider adding more detailed logging at each critical step to aid in debugging and operational monitoring.+ log.debug("Checking permissions for creating datasource."); + log.debug("Handling dry run operation for datasource.");app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/base/DatasourceServiceCEImpl.java (5)
143-143
: Approved: Updated method implementation aligns with PR objectives.The method now correctly delegates to
createEx
with appropriate default values for new parameters, maintaining backward compatibility and extending functionality.
148-150
: Approved: Method updated to support dry run operations.The method now correctly handles
datasourceStorageDryRunQueries
for dry run operations, aligning with the new requirements.
402-414
: Approved: Updated validation logic to support dry operations.The method
validateAndSaveDatasourceToRepository
now includes conditional logic to handle dry run operations effectively, which aligns with the PR's objectives.
392-400
: Approved: New method overload to handle dry operations.The new overload of the
save
method supports dry operations, which is in line with the new functionality. Consider adding documentation to clarify the behavior and expected outcomes whenisDryOps
is true.
374-374
: Approved: Updated method to support dry operations.The method
updateDatasourceStorage
now correctly handles theisDryOps
parameter, aligning with the PR's objectives. Ensure consistency in handling this parameter across all relevant methods.
.../main/java/com/appsmith/server/datasources/importable/DatasourceImportableServiceCEImpl.java
Outdated
Show resolved
Hide resolved
.../main/java/com/appsmith/server/datasources/importable/DatasourceImportableServiceCEImpl.java
Outdated
Show resolved
Hide resolved
...ith-server/src/main/java/com/appsmith/server/services/ce/DatasourceContextServiceCEImpl.java
Show resolved
Hide resolved
Failed server tests
|
Failed server tests
|
…o pg-transaction-datsoure-import-flow
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: 5
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (9)
- app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/base/DatasourceServiceCEImpl.java (7 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/importable/DatasourceImportableServiceCEImpl.java (5 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/imports/internal/ImportServiceCEImpl.java (3 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/imports/internal/ImportServiceImpl.java (3 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/imports/internal/partial/PartialImportServiceCEImpl.java (3 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/imports/internal/partial/PartialImportServiceImpl.java (3 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/importable/NewActionImportableServiceCEImpl.java (2 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/DryOperationRepository.java (1 hunks)
- app/server/appsmith-server/src/test/java/com/appsmith/server/services/DatasourceServiceTest.java (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/importable/DatasourceImportableServiceCEImpl.java
Additional comments not posted (18)
app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/DryOperationRepository.java (4)
25-31
: LGTM!
33-35
: LGTM!
37-39
: LGTM!
41-43
: LGTM!app/server/appsmith-server/src/main/java/com/appsmith/server/imports/internal/ImportServiceImpl.java (1)
12-12
: LGTM!Also applies to: 34-35, 47-48
app/server/appsmith-server/src/main/java/com/appsmith/server/imports/internal/partial/PartialImportServiceImpl.java (1)
19-19
: LGTM!Also applies to: 70-71, 100-101
app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/importable/NewActionImportableServiceCEImpl.java (1)
321-339
: LGTM!app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/base/DatasourceServiceCEImpl.java (10)
Line range hint
153-201
: LGTM!
225-241
: LGTM!
407-419
: LGTM!
327-327
: LGTM!
379-379
: LGTM!
407-419
: LGTM!
412-419
: LGTM!
894-900
: LGTM!
148-150
: LGTM!However, ensure that all function calls to
createWithoutPermissions
match the new signature.Verification successful
LGTM!
All function calls to
createWithoutPermissions
match the new signature.
DatasourceImportableServiceCEImpl.java
: The function call matches the new signature.DatasourceServiceCE.java
: The interface definition matches the new signature.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `createWithoutPermissions` match the new signature. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg --type java $'createWithoutPermissions('Length of output: 145
Script:
#!/bin/bash # Description: Verify all function calls to `createWithoutPermissions` match the new signature. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg --type java 'createWithoutPermissions\('Length of output: 574
Script:
#!/bin/bash # Extract the relevant lines from the files to verify the function signature. # Extract the call in DatasourceImportableServiceCEImpl.java rg --type java -A 2 'createWithoutPermissions\(' app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/importable/DatasourceImportableServiceCEImpl.java # Extract the interface definition in DatasourceServiceCE.java rg --type java -A 2 'createWithoutPermissions\(' app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/base/DatasourceServiceCE.javaLength of output: 711
143-143
: LGTM!However, ensure that all function calls to
create
match the new signature.Verification successful
LGTM!
The changes have been verified, and the
createEx
method is correctly used within theDatasourceServiceCEImpl
class with the expected signature. The remainingcreate
method calls in other files do not impact theDatasourceServiceCEImpl
class.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `create` match the new signature. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg --type java $'create('Length of output: 91
Script:
#!/bin/bash # Description: Verify all function calls to `create` match the new signature. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg --type java 'create\('Length of output: 298267
Script:
#!/bin/bash # Description: Verify all function calls to `create` in `DatasourceServiceCEImpl` match the new signature. # Test: Search for the function usage within `DatasourceServiceCEImpl`. Expect: Only occurrences of the new signature. rg --type java 'DatasourceServiceCEImpl' -A 10 | rg 'create\('Length of output: 62
Script:
#!/bin/bash # Description: Verify all function calls to `create` and `createEx` in the entire repository. # Test: Search for the function usage within the entire repository. Expect: Only occurrences of the new signature. rg --type java 'create\(' rg --type java 'createEx\('Length of output: 298841
app/server/appsmith-server/src/test/java/com/appsmith/server/services/DatasourceServiceTest.java (1)
1997-1997
: Ensure correct handling of the additional boolean parameter.The
create
method call now includes an additional boolean parameter. Verify that this parameter is correctly handled and passed to the underlying method.
...r/src/main/java/com/appsmith/server/imports/internal/partial/PartialImportServiceCEImpl.java
Outdated
Show resolved
Hide resolved
...r/src/main/java/com/appsmith/server/imports/internal/partial/PartialImportServiceCEImpl.java
Outdated
Show resolved
Hide resolved
.../appsmith-server/src/main/java/com/appsmith/server/imports/internal/ImportServiceCEImpl.java
Outdated
Show resolved
Hide resolved
.../appsmith-server/src/main/java/com/appsmith/server/imports/internal/ImportServiceCEImpl.java
Outdated
Show resolved
Hide resolved
...smith-server/src/main/java/com/appsmith/server/datasources/base/DatasourceServiceCEImpl.java
Outdated
Show resolved
Hide resolved
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.
Left few comments to be looked into.
datasourceStorageList.addAll( | ||
datasourceStorageDryRunQueries.get(FieldName.CREATE)); | ||
datasourceStorageList.add(datasourceStorage1); | ||
datasourceStorageDryRunQueries.put(FieldName.CREATE, datasourceStorageList); |
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.
Can't we just append the element in the existing list i.e. value of datasourceStorageDryRunQueries
, instead of creating a new one everytime and then updating it?
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.
I tried that but for list with map its not supported. Ran into exceptions and then ended up using this.
...smith-server/src/main/java/com/appsmith/server/datasources/base/DatasourceServiceCEImpl.java
Show resolved
Hide resolved
...smith-server/src/main/java/com/appsmith/server/datasources/base/DatasourceServiceCEImpl.java
Show resolved
Hide resolved
...smith-server/src/main/java/com/appsmith/server/datasources/base/DatasourceServiceCEImpl.java
Show resolved
Hide resolved
...smith-server/src/main/java/com/appsmith/server/datasources/base/DatasourceServiceCEImpl.java
Show resolved
Hide resolved
...er/src/main/java/com/appsmith/server/datasourcestorages/base/DatasourceStorageServiceCE.java
Show resolved
Hide resolved
...psmith-server/src/main/java/com/appsmith/server/dtos/ce/MappedImportableResourcesCE_DTO.java
Show resolved
Hide resolved
...rc/main/java/com/appsmith/server/newactions/importable/NewActionImportableServiceCEImpl.java
Show resolved
Hide resolved
...rc/main/java/com/appsmith/server/newactions/importable/NewActionImportableServiceCEImpl.java
Outdated
Show resolved
Hide resolved
...r/appsmith-server/src/main/java/com/appsmith/server/repositories/DryOperationRepository.java
Show resolved
Hide resolved
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: 2
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (10)
- app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/base/DatasourceServiceCE.java (3 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/base/DatasourceServiceCEImpl.java (8 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/importable/DatasourceImportableServiceCEImpl.java (6 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/datasourcestorages/base/DatasourceStorageServiceCE.java (2 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/datasourcestorages/base/DatasourceStorageServiceCEImpl.java (4 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/DBOpsType.java (1 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/base/NewActionServiceCEImpl.java (1 hunks)
- app/server/appsmith-server/src/test/java/com/appsmith/server/exports/internal/ExportServiceTests.java (1 hunks)
- app/server/appsmith-server/src/test/java/com/appsmith/server/imports/internal/ImportServiceTests.java (1 hunks)
- app/server/appsmith-server/src/test/java/com/appsmith/server/services/DatasourceServiceTest.java (2 hunks)
Files skipped from review due to trivial changes (1)
- app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/DBOpsType.java
Files skipped from review as they are similar to previous changes (5)
- app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/base/DatasourceServiceCE.java
- app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/importable/DatasourceImportableServiceCEImpl.java
- app/server/appsmith-server/src/main/java/com/appsmith/server/datasourcestorages/base/DatasourceStorageServiceCE.java
- app/server/appsmith-server/src/main/java/com/appsmith/server/datasourcestorages/base/DatasourceStorageServiceCEImpl.java
- app/server/appsmith-server/src/test/java/com/appsmith/server/services/DatasourceServiceTest.java
Additional comments not posted (9)
app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/base/DatasourceServiceCEImpl.java (6)
395-403
: LGTM!The code changes are approved.
407-419
: LGTM!The code changes are approved.
893-900
: LGTM!The code changes are approved.
385-385
: Verify the function usage in the codebase.Ensure that all calls to the
updateDatasourceStorage
method are updated to use the new parameters.
144-144
: Verify the function usage in the codebase.Ensure that all calls to the
create
method are updated to use the new parameters.Verification successful
The
create
method calls inDatasourceServiceCEImpl
have been updated to usecreateEx
.The changes are consistent with the new method signature.
- Verified occurrences of
createEx
withinDatasourceServiceCEImpl
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `create` match the new signature. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg --type java $'create('Length of output: 91
Script:
#!/bin/bash # Description: Verify all function calls to `create` match the new signature and ensure consistency. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg --type java 'create\(' # Test: Search for the new function usage. Expect: Occurrences of the new signature. rg --type java 'createEx\('Length of output: 299004
148-152
: Verify the function usage in the codebase.Ensure that all calls to the
createWithoutPermissions
method are updated to use the new parameters.Verification successful
The function
createWithoutPermissions
has been correctly updated with the new parameterdatasourceStorageDryRunQueries
and is used appropriately in the codebase.
DatasourceImportableServiceCEImpl.java
uses the new method signature.DatasourceServiceCE.java
andDatasourceServiceCEImpl.java
include the new method signature alongside the old one.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `createWithoutPermissions` match the new signature. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg --type java $'createWithoutPermissions('Length of output: 145
Script:
#!/bin/bash # Description: Verify all function calls to `createWithoutPermissions` match the new signature. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg --type java 'createWithoutPermissions\('Length of output: 932
Script:
#!/bin/bash # Description: Verify the specific usage of `createWithoutPermissions` in `DatasourceImportableServiceCEImpl.java` to check if it matches the new signature. # Test: Display the relevant lines around the usage. rg --type java -C 3 'createWithoutPermissions\(' app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/importable/DatasourceImportableServiceCEImpl.javaLength of output: 724
Script:
#!/bin/bash # Description: Verify the method declarations in `DatasourceServiceCE.java` and `DatasourceServiceCEImpl.java` to ensure they are updated to the new signature. # Test: Display the relevant lines around the method declarations. rg --type java -C 3 'createWithoutPermissions\(' app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/base/DatasourceServiceCE.java rg --type java -C 3 'createWithoutPermissions\(' app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/base/DatasourceServiceCEImpl.javaLength of output: 1078
app/server/appsmith-server/src/test/java/com/appsmith/server/exports/internal/ExportServiceTests.java (1)
2076-2076
: Verify the correctness of thesave
method call.The
save
method now requires aboolean isDryOps
parameter. Ensure that passingfalse
here is the intended behavior and that the method's behavior aligns with this change.app/server/appsmith-server/src/test/java/com/appsmith/server/imports/internal/ImportServiceTests.java (2)
5183-5183
: Improve Test Name for ClarityThe test name
exportApplicationByWhen_WhenGitConnectedAndDatasourceRenamed_QueriesAreInUpdatedResources
is a bit confusing. Consider renaming it to something more descriptive, such asexportApplication_WhenDatasourceRenamed_QueriesReflectUpdatedDatasource
.
5183-5183
: Improve Test Name for ClarityThe test name
importApplication_WhenUpdateLayoutFailures_Success
is a bit confusing. Consider renaming it to something more descriptive, such asimportApplication_WithFaultyLayout_Success
.
...smith-server/src/main/java/com/appsmith/server/datasources/base/DatasourceServiceCEImpl.java
Show resolved
Hide resolved
...ppsmith-server/src/main/java/com/appsmith/server/newactions/base/NewActionServiceCEImpl.java
Show resolved
Hide resolved
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: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (4)
- app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/base/DatasourceServiceCEImpl.java (8 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/importable/DatasourceImportableServiceCEImpl.java (6 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/imports/internal/ImportServiceCEImpl.java (3 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/DryOperationRepository.java (1 hunks)
Files skipped from review as they are similar to previous changes (3)
- app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/importable/DatasourceImportableServiceCEImpl.java
- app/server/appsmith-server/src/main/java/com/appsmith/server/imports/internal/ImportServiceCEImpl.java
- app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/DryOperationRepository.java
Additional comments not posted (10)
app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/base/DatasourceServiceCEImpl.java (10)
144-144
: LGTM!The code changes are approved.
149-152
: LGTM!The code changes are approved.
156-156
: LGTM!The code changes are approved.
159-163
: LGTM!The code changes are approved.
207-207
: LGTM!The code changes are approved.
326-326
: LGTM!The code changes are approved.
378-378
: LGTM!The code changes are approved.
388-396
: LGTM!The code changes are approved.
400-412
: LGTM!The code changes are approved.
886-893
: LGTM!The code changes are approved.
...smith-server/src/main/java/com/appsmith/server/datasources/base/DatasourceServiceCEImpl.java
Show resolved
Hide resolved
Failed server tests
|
.get(key); | ||
return saveDatasourceStorageToDb(datasourceStorageList).collectList(); | ||
}); | ||
return Flux.merge(datasourceFLux, datasourceStorageFLux).then(); |
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.
Let's update this logic to perform the ops in generic way as discussed over the call. Feel free to implement this while working on pages, apps refactor.
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.
I will work on this once i get more clarity on the page and actions refactor. These flows might require some changes hence i am going to stick to this approach for now.
@AnaghHegde changes LGTM for now but have we tested the flow with duplicate name entities?
Are we seeing failures because of duplicate key exception? |
/build-deploy-preview -skip-tests=true |
Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/9758652221. |
Deploy-Preview-URL: https://ce-34514.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/imports/internal/partial/PartialImportServiceCEImpl.java (3 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/importable/NewActionImportableServiceCEImpl.java (3 hunks)
Files skipped from review as they are similar to previous changes (2)
- app/server/appsmith-server/src/main/java/com/appsmith/server/imports/internal/partial/PartialImportServiceCEImpl.java
- app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/importable/NewActionImportableServiceCEImpl.java
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.
Approving to unblock for now, but hoping to see the refactor for reducing the duplicate code from generic datsbase operation class.
… in pg (appsmithorg#34514) ## Description ## 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/9772380637> > Commit: 1f5ab41 > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=9772380637&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.Git` <!-- 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 support for dry run queries in datasource operations. Users can now perform dry runs when creating, saving, or importing datasources. - **Improvements** - Enhanced datasource import functionality by adding logic to handle and save dry run queries. - Improved validation and correction processes for datasources during action imports. - **Internal Enhancements** - Added a new `DryOperationRepository` for managing dry run operations for datasources and datasource storage. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Description
Please refer this document - https://www.notion.so/appsmith/Transaction-Handling-in-PG-468cf8d4255749c3915699e59e91dc2f
This pr is addressing the refactor for datasource import flow only.
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/9772380637
Commit: 1f5ab41
Cypress dashboard.
Tags:
@tag.Git
Communication
Should the DevRel and Marketing teams inform users about this change?
Summary by CodeRabbit
New Features
Improvements
Internal Enhancements
DryOperationRepository
for managing dry run operations for datasources and datasource storage.