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

feat: 🚧 add postgres trigger captures #5165

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

dieriba
Copy link
Collaborator

@dieriba dieriba commented Jan 28, 2025

Important

Add PostgreSQL trigger support with backend logic and frontend UI components for configuration, management, and testing.

  • Backend:
    • Add PostgreSQL trigger support in capture.rs, handler.rs, and mod.rs.
    • Implement set_postgres_trigger_config() in capture.rs for configuring PostgreSQL triggers.
    • Add PostgresTriggerConfig and related logic in handler.rs.
    • Implement test_postgres_connection() in handler.rs for testing connections.
    • Add logical replication handling in trigger.rs.
  • Frontend:
    • Add PostgreSQL trigger UI components in CaptureButton.svelte, CaptureWrapper.svelte, and PostgresEditorConfigSection.svelte.
    • Implement PostgresTriggerEditor and PostgresTriggerEditorInner for editing triggers.
    • Add TestTriggerConnection.svelte for testing PostgreSQL connections.
    • Update TriggersEditor.svelte and TriggersEditorSection.svelte to include PostgreSQL triggers.
    • Add RelationPicker.svelte and PublicationPicker.svelte for managing database relations and publications.

This description was created by Ellipsis for eebc043. It will automatically update as commits are pushed.

Copy link

cloudflare-workers-and-pages bot commented Jan 28, 2025

Deploying windmill with  Cloudflare Pages  Cloudflare Pages

Latest commit: eebc043
Status: ✅  Deploy successful!
Preview URL: https://9c4c00d0.windmill.pages.dev
Branch Preview URL: https://feat-postgres-trigger-captur.windmill.pages.dev

View logs

@dieriba dieriba marked this pull request as ready for review January 29, 2025 18:54
@dieriba dieriba requested a review from rubenfiszel as a code owner January 29, 2025 18:54
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Reviewed everything up to 0ee9f7d in 1 minute and 17 seconds

More details
  • Looked at 2605 lines of code in 36 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 drafted comments based on config settings.

Workflow ID: wflow_pPv4ikDsvJdSRfyG


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@dieriba dieriba changed the title feat: 🚧 add postgres trigger config in back feat: 🚧 add postgres trigger captures Jan 30, 2025
@rubenfiszel rubenfiszel force-pushed the main branch 2 times, most recently from 3069a7d to 0b0e564 Compare January 31, 2025 18:28
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on bd99865 in 41 seconds

More details
  • Looked at 1305 lines of code in 12 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 drafted comments based on config settings.
1. backend/windmill-api/src/postgres_triggers/mod.rs:120
  • Draft comment:
    The generate_random_string function is unnecessarily complex. You can simplify it by removing the closure and directly implementing the logic in the function body.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The code in generate_random_string is unnecessarily complex. The closure generate_random_string is defined and immediately invoked, which is redundant. This can be simplified by directly implementing the logic in the function body.
2. backend/windmill-api/src/postgres_triggers/handler.rs:37
  • Draft comment:
    The generate_random_string function is unnecessarily complex. You can simplify it by removing the closure and directly implementing the logic in the function body.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The generate_random_string function in handler.rs is unnecessarily complex. The closure generate_random_string is defined and immediately invoked, which is redundant. This can be simplified by directly implementing the logic in the function body.
3. backend/windmill-api/src/capture.rs:44
  • Draft comment:
    The generate_random_string function is unnecessarily complex. You can simplify it by removing the closure and directly implementing the logic in the function body.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The generate_random_string function in capture.rs is unnecessarily complex. The closure generate_random_string is defined and immediately invoked, which is redundant. This can be simplified by directly implementing the logic in the function body.

Workflow ID: wflow_1YB62cBFNYHzvLqG


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 93063d4 in 17 seconds

More details
  • Looked at 18 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. backend/windmill-api/src/capture.rs:42
  • Draft comment:
    Remove the duplicate import of PublicationData.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The import statement for PublicationData is duplicated, which is unnecessary and can lead to confusion.

Workflow ID: wflow_dG8ehzc3yj39suff


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 85db473 in 59 seconds

More details
  • Looked at 511 lines of code in 4 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. backend/windmill-api/src/capture.rs:266
  • Draft comment:
    Using quote_literal for constructing SQL queries can lead to SQL injection vulnerabilities. Consider using parameterized queries instead.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable:
    While using parameterized queries is generally good practice, in this case:
  1. The value being quoted is either user-configured or randomly generated internally
  2. The pg_escape::quote_literal function is a safe escaping function from a dedicated Postgres escaping library
  3. This is just a SELECT query checking existence, not a data modification query
  4. The code is already using parameterized queries elsewhere when needed
    The comment raises a valid general security concern. SQL injection is a serious vulnerability that should be carefully considered.
    While SQL injection is serious, this specific usage is safe due to the trusted input source and proper escaping library. The comment could cause unnecessary work without improving security.
    Delete the comment since it raises a false alarm - the current code is using appropriate safety measures for this specific case.

Workflow ID: wflow_XiKKtMOEKCDz5ghR


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on eebc043 in 18 seconds

More details
  • Looked at 61 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. backend/windmill-api/src/capture.rs:285
  • Draft comment:
    Consider using #[cfg(feature = "postgres_trigger")] consistently for the nc parameter in the set_config function to avoid confusion and potential issues.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The use of #[cfg(feature = "postgres_trigger")] is inconsistent in the set_config function. It is used for the db parameter but not for the nc parameter, which is later conditionally redefined. This inconsistency can lead to confusion and potential issues if the feature flag is not enabled.

Workflow ID: wflow_42w3BlO1wN3Ax6p3


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant