chore: set workspaceId to triggerRequestDto#38244
Conversation
WalkthroughThe pull request modifies the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (1)
🔇 Additional comments (1)app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/DatasourceTriggerSolutionCEImpl.java (1)
The addition of datasourceMonoCached to Mono.zip and its subsequent usage in the flatMap chain is well-structured and maintains reactive programming patterns. Also applies to: 122-122 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 using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/DatasourceTriggerSolutionCEImpl.java(3 hunks)
🔇 Additional comments (1)
app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/DatasourceTriggerSolutionCEImpl.java (1)
104-109: LGTM! Verify reactive chain completion.
The addition of datasource to the zip operation and its usage in the chain is correct. The reactive flow is properly maintained.
Let's verify that all reactive chains are properly completed:
Also applies to: 122-122
✅ Verification successful
LGTM! Reactive chain is properly structured and complete.
The reactive chain in the trigger method is well-constructed with proper error handling and chain completion:
- Zip operation correctly combines all required Mono streams
- FlatMap operations maintain the reactive flow
- Cache operators are used appropriately for shared streams
- Error cases are handled with Mono.error()
- Chain terminates with proper transformations via map/flatMap
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for any incomplete reactive chains (missing subscribe/block)
ast-grep --pattern 'Mono.$_().flatMap($_)'
Length of output: 44
Script:
#!/bin/bash
# Let's search for the trigger method implementation to verify reactive chain completion
ast-grep --pattern 'public Mono<DatasourceTestResult> trigger($$$)'
# Also search for any subscribe/block calls in the class
rg -A 2 "\.(subscribe|block)\("
Length of output: 114704
Script:
#!/bin/bash
# Let's search for the trigger method implementation to verify the reactive chain completion
rg -A 10 "public\s+Mono<DatasourceTestResult>\s+trigger"
# Also search for any return statements in the trigger method
rg -A 2 "return\s+Mono\." app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/DatasourceTriggerSolutionCEImpl.java
Length of output: 424
Script:
#!/bin/bash
# Let's search for the trigger method implementation with more context
rg -B 5 -A 20 "public\s+Mono<DatasourceTestResult>\s+trigger" app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/DatasourceTriggerSolutionCEImpl.java
# Also search for any zip operations in the trigger method
rg -A 5 "Mono\.zip\(" app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/DatasourceTriggerSolutionCEImpl.java
Length of output: 728
Script:
#!/bin/bash
# Let's get the full trigger method implementation to verify the reactive chain
ast-grep --pattern 'public Mono<DatasourceTestResult> trigger($$$) {
$$$
}' app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/DatasourceTriggerSolutionCEImpl.java
# Also search for any map/flatMap operations after the zip
rg -A 10 "\.flatMap\(" app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/DatasourceTriggerSolutionCEImpl.java
Length of output: 4191
| private Mono<TriggerRequestDTO> populateTriggerRequestDto(TriggerRequestDTO triggerRequestDTO, Datasource datasource) { | ||
| return tenantService | ||
| .getDefaultTenantId() | ||
| .zipWith(configService.getInstanceId()) | ||
| .map(tuple -> { | ||
| triggerRequestDTO.setTenantId(tuple.getT1()); | ||
| triggerRequestDTO.setInstanceId(tuple.getT2()); | ||
| triggerRequestDTO.setWorkspaceId(datasource.getWorkspaceId()); | ||
| return triggerRequestDTO; | ||
| }); |
There was a problem hiding this comment.
🛠️ Refactor suggestion
Add null check for datasource parameter.
While the method implementation is correct, consider adding a null check for the datasource parameter to prevent NullPointerException.
private Mono<TriggerRequestDTO> populateTriggerRequestDto(TriggerRequestDTO triggerRequestDTO, Datasource datasource) {
+ if (datasource == null) {
+ return Mono.error(new AppsmithException(AppsmithError.INVALID_PARAMETER, "datasource"));
+ }
return tenantServiceCommittable suggestion skipped: line range outside the PR's diff.
Failed server tests
|
## Description > Set workspace ID to the TriggerRequestDTO. Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.Sanity" ### 🔍 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/12426442788> > Commit: 8a4bd2e > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=12426442788&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.Sanity` > Spec: > <hr>Fri, 20 Dec 2024 06:38:48 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary by CodeRabbit - **New Features** - Enhanced trigger functionality to directly access and utilize the `Datasource` object. - Updated method to incorporate workspace ID in trigger requests. - **Bug Fixes** - Improved error handling for null `requestType` or `parameters` in trigger requests. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Nilesh Sarupriya <20905988+nsarupr@users.noreply.github.com>
## Description > Set workspace ID to the TriggerRequestDTO. Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.Sanity" ### 🔍 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/12426442788> > Commit: 8a4bd2e > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=12426442788&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.Sanity` > Spec: > <hr>Fri, 20 Dec 2024 06:38:48 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary by CodeRabbit - **New Features** - Enhanced trigger functionality to directly access and utilize the `Datasource` object. - Updated method to incorporate workspace ID in trigger requests. - **Bug Fixes** - Improved error handling for null `requestType` or `parameters` in trigger requests. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Nilesh Sarupriya <20905988+nsarupr@users.noreply.github.com>
Description
Fixes #
Issue Numberor
Fixes
Issue URLWarning
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.Sanity"
🔍 Cypress test results
Tip
🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12426442788
Commit: 8a4bd2e
Cypress dashboard.
Tags:
@tag.SanitySpec:
Fri, 20 Dec 2024 06:38:48 UTC
Communication
Should the DevRel and Marketing teams inform users about this change?
Summary by CodeRabbit
Summary by CodeRabbit
New Features
Datasourceobject.Bug Fixes
requestTypeorparametersin trigger requests.