Skip to content
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: shadow PR for external contribution #ce-35167 #36053

Merged
merged 10 commits into from
Sep 9, 2024

Conversation

NilanshBansal
Copy link
Contributor

@NilanshBansal NilanshBansal commented Sep 2, 2024

Description

Fixes #

Warning

If no issue exists, please create an issue first, and check with the maintainers if the issue is valid.

Automation

/test all

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/10769007798
Commit: 3c97f02
Cypress dashboard.
Tags: @tag.All
Spec:


Mon, 09 Sep 2024 10:29:27 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Enhanced error handling for PostgreSQL connection issues with clearer messages for missing ports and invalid hostnames.
    • Improved readability of error messages in the application by formatting them to display on separate lines.
  • Bug Fixes

    • Improved clarity in error reporting for connection pool creation failures.
  • Tests

    • Introduced a test case to validate datasource configuration when the port is not provided, ensuring robust validation checks.

@NilanshBansal NilanshBansal added the ok-to-test Required label for CI label Sep 2, 2024
Copy link
Contributor

coderabbitai bot commented Sep 2, 2024

Walkthrough

The changes enhance error handling and validation logic in the PostgresPlugin class, focusing on datasource validation for missing ports. New error message constants provide clearer feedback on connection issues. Additionally, a test case has been added to ensure the validation process accurately identifies when a port is not provided, thus strengthening the plugin's overall functionality.

Changes

Files Change Summary
app/server/appsmith-plugins/postgresPlugin/src/main/java/com/external/plugins/PostgresPlugin.java Enhanced error handling in createConnectionPool and added validation for missing port in datasource configuration.
app/server/appsmith-plugins/postgresPlugin/src/main/java/com/external/plugins/exceptions/PostgresErrorMessages.java Introduced new error message constants: DS_MISSING_PORT_ERROR_MSG and DS_INVALID_HOSTNAME_AND_PORT_MSG.
app/server/appsmith-plugins/postgresPlugin/src/test/java/com/external/plugins/PostgresPluginTest.java Added test case itShouldValidateDatasourceWithEmptyPort to validate behavior when the port is not provided.
app/client/src/sagas/DatasourcesSagas.ts Modified error message formatting in testDatasourceSaga to improve readability by using newline characters.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant PostgresPlugin
    participant DatasourceValidation
    participant ErrorHandler

    User->>PostgresPlugin: Configure Datasource
    PostgresPlugin->>DatasourceValidation: Validate Configuration
    DatasourceValidation->>PostgresPlugin: Check Port
    alt Port is Empty
        PostgresPlugin->>ErrorHandler: Add Missing Port Error
    else Port is Valid
        PostgresPlugin->>ErrorHandler: Proceed with Connection
    end
Loading

In the realm of code, where logic flows,
A missing port error, now clearly shows.
With tests to ensure, and messages bright,
The Postgres Plugin shines with new light.
Robust and clear, it stands tall and proud,
A beacon of clarity, drawing a crowd! 🌟

Tip

New features

Walkthrough comment now includes:

  • Possibly related PRs: A list of potentially related PRs to help you recall past context.
  • Suggested labels: CodeRabbit can now suggest labels by learning from your past PRs. You can also provide custom labeling instructions in the UI or configuration file.

Notes:

  • Please share any feedback in the discussion post on our Discord.
  • Possibly related PRs, automatic label suggestions based on past PRs, learnings, and possibly related issues require data opt-in (enabled by default).

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?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label Sep 2, 2024
@NilanshBansal NilanshBansal added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Sep 2, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4516129 and 4e80154.

Files selected for processing (3)
  • app/server/appsmith-plugins/postgresPlugin/src/main/java/com/external/plugins/PostgresPlugin.java (3 hunks)
  • app/server/appsmith-plugins/postgresPlugin/src/main/java/com/external/plugins/exceptions/PostgresErrorMessages.java (2 hunks)
  • app/server/appsmith-plugins/postgresPlugin/src/test/java/com/external/plugins/PostgresPluginTest.java (1 hunks)
Additional comments not posted (6)
app/server/appsmith-plugins/postgresPlugin/src/main/java/com/external/plugins/exceptions/PostgresErrorMessages.java (2)

40-40: Great job adding a clear error message for missing port!

The new constant DS_MISSING_PORT_ERROR_MSG is declared correctly and has an appropriate error message. This will provide clear feedback to users when the port is missing in the PostgreSQL connection configuration.


55-55: Nice work adding a helpful error message for invalid host and port!

The new constant DS_INVALID_HOSTNAME_AND_PORT_MSG is declared correctly and has an appropriate error message. This will guide users to check both the host and port values when encountering connection issues, improving the troubleshooting process.

app/server/appsmith-plugins/postgresPlugin/src/main/java/com/external/plugins/PostgresPlugin.java (3)

692-694: Great job adding the port validation check!

The code change looks good. It adds a validation for missing port and provides a clear error message if the port is empty.


49-50: The new imports look good!

The PSQLException and PSQLState imports are valid and seem to be used later in the file for improved error handling.


1328-1348: Excellent work enhancing the error handling!

The code changes improve error handling by inspecting the underlying cause of the PoolInitializationException.

If the cause is a PSQLException with a SQL state indicating a connection failure, it throws a specific error message about invalid hostname/port. This can help in diagnosing connection issues more effectively.

For other causes, it throws a generic pool creation failed error with the underlying cause message, which is still an improvement over the previous handling.

app/server/appsmith-plugins/postgresPlugin/src/test/java/com/external/plugins/PostgresPluginTest.java (1)

601-608: Great work on adding this test case!

This test method effectively validates the scenario when the port is not provided in the datasource configuration. It sets up the test data correctly, invokes the validation method, and asserts the expected error message.

The test follows the AAA pattern and is easy to understand. Nice job!

AnnaHariprasad5123 and others added 2 commits September 3, 2024 07:45
… of github.com:AnnaHariprasad5123/appsmith into chore/external-contri-ce-35167
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4e80154 and 09ed8b9.

Files selected for processing (2)
  • app/server/appsmith-plugins/postgresPlugin/src/main/java/com/external/plugins/PostgresPlugin.java (2 hunks)
  • app/server/appsmith-plugins/postgresPlugin/src/main/java/com/external/plugins/exceptions/PostgresErrorMessages.java (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • app/server/appsmith-plugins/postgresPlugin/src/main/java/com/external/plugins/PostgresPlugin.java
Additional comments not posted (1)
app/server/appsmith-plugins/postgresPlugin/src/main/java/com/external/plugins/exceptions/PostgresErrorMessages.java (1)

53-53: Excellent addition to error messages

The new error message DS_INVALID_HOSTNAME_AND_PORT_MSG is a thoughtful addition, enhancing the clarity of feedback provided to users during PostgreSQL configuration errors. It's succinct and aligns well with the existing messages in this class. Well done on maintaining consistency and clarity in error messaging.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 09ed8b9 and 3c97f02.

Files selected for processing (2)
  • app/client/src/sagas/DatasourcesSagas.ts (1 hunks)
  • app/server/appsmith-plugins/postgresPlugin/src/main/java/com/external/plugins/PostgresPlugin.java (2 hunks)
Additional comments not posted (1)
app/client/src/sagas/DatasourcesSagas.ts (1)

932-932: Approved: Improved error message formatting.

The change from a comma to a newline for separating error messages enhances readability, which is crucial for debugging and user feedback. Ensure that the UI correctly handles and displays these multiline error messages.

@nerbos nerbos merged commit b782bde into release Sep 9, 2024
84 checks passed
@nerbos nerbos deleted the chore/external-contri-ce-35167 branch September 9, 2024 14:06
NilanshBansal added a commit that referenced this pull request Sep 9, 2024
nerbos pushed a commit that referenced this pull request Sep 9, 2024
Reverts #36053

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Bug Fixes**
- Improved formatting of error messages for invalid data sources to
enhance clarity.
- Simplified error handling in the Postgres plugin, which may affect the
specificity of connection error messages.
- Removed an outdated error message related to invalid hostname and port
configurations in the Postgres plugin, impacting how related errors are
reported to users.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Shivam-z pushed a commit to Shivam-z/appsmith that referenced this pull request Sep 26, 2024
## Description
- Shadow PR for appsmithorg#35167

Fixes #  

> [!WARNING]  
> _If no issue exists, please create an issue first, and check with the
maintainers if the issue is valid._

## Automation

/test all

### 🔍 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/10769007798>
> Commit: 3c97f02
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=10769007798&attempt=2"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.All`
> Spec:
> <hr>Mon, 09 Sep 2024 10:29:27 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [x] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit


- **New Features**
- Enhanced error handling for PostgreSQL connection issues with clearer
messages for missing ports and invalid hostnames.
- Improved readability of error messages in the application by
formatting them to display on separate lines.

- **Bug Fixes**
- Improved clarity in error reporting for connection pool creation
failures.

- **Tests**
- Introduced a test case to validate datasource configuration when the
port is not provided, ensuring robust validation checks.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: AnnaHariprasad5123 <[email protected]>
Shivam-z pushed a commit to Shivam-z/appsmith that referenced this pull request Sep 26, 2024
…thorg#36202)

Reverts appsmithorg#36053

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Bug Fixes**
- Improved formatting of error messages for invalid data sources to
enhance clarity.
- Simplified error handling in the Postgres plugin, which may affect the
specificity of connection error messages.
- Removed an outdated error message related to invalid hostname and port
configurations in the Postgres plugin, impacting how related errors are
reported to users.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ok-to-test Required label for CI skip-changelog Adding this label to a PR prevents it from being listed in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants