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 46 commits into
base: main
Choose a base branch
from

Conversation

dieriba
Copy link
Collaborator

@dieriba dieriba commented Jan 28, 2025

Important

Add support for Postgres triggers, including UI components, backend services, and database configurations.

  • Behavior:
    • Add support for Postgres triggers in CaptureWrapper.svelte, TriggersEditor.svelte, and TriggersWrapper.svelte.
    • Implement Postgres trigger connection testing in TestTriggerConnection.svelte.
    • Add Postgres trigger configuration and validation in PostgresEditorConfigSection.svelte and CheckPostgresRequirement.svelte.
  • UI Components:
    • Update DetailPageTriggerPanel.svelte and SidebarContent.svelte to include Postgres as a trigger option.
    • Add Postgres trigger management UI in PostgresTriggersPanel.svelte and PostgresTriggerEditor.svelte.
    • Implement RelationPicker.svelte for selecting tables and schemas for Postgres triggers.
  • Backend:
    • Extend backend services to handle Postgres triggers in postgres_triggers/handler.rs and postgres_triggers/mod.rs.
    • Add SQL queries for Postgres trigger management in .sqlx files.
  • Misc:
    • Update script_helpers.ts to include Postgres in trigger-related types and functions.
    • Add initial code templates for Postgres in script_helpers.ts.

This description was created by Ellipsis for e040751. 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: e040751
Status: ✅  Deploy successful!
Preview URL: https://c06d6107.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.

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 026dabc in 1 minute and 4 seconds

More details
  • Looked at 283 lines of code in 4 files
  • Skipped 0 files when reviewing.
  • Skipped posting 9 drafted comments based on config settings.
1. frontend/src/lib/components/triggers/CaptureWrapper.svelte:31
  • Draft comment:
    Good improvement: adding an explicit check for args.publication.table_to_track improves validation. Ensure that the toast message clearly directs the user.
  • Reason this comment was not posted:
    Comment did not seem useful: The comment starts with a positive note about the improvement, which is fine. However, it then includes 'Ensure that the toast message clearly directs the user,' which is asking the author to ensure something, violating the rule against such comments.
2. frontend/src/lib/components/triggers/postgres/CheckPostgresRequirement.svelte:32
  • Draft comment:
    Consider checking postgres_resource_path using a consistent empty-string check rather than only undefined (e.g., use emptyString() helper) to cover more falsy cases.
  • Reason this comment was not posted:
    Comment looked like it was already resolved.
3. frontend/src/lib/components/triggers/postgres/PostgresEditorConfigSection.svelte:79
  • Draft comment:
    Rendering TestTriggerConnection and CheckPostgresRequirement only when postgres_resource_path is set keeps the UI clean. Ensure that these conditional blocks cover all edge cases.
  • Reason this comment was not posted:
    Comment did not seem useful: The comment suggests ensuring that conditional blocks cover all edge cases, which falls under the rule of not asking the PR author to ensure behavior is intended or tested. This makes the comment not approved.
4. frontend/src/lib/components/triggers/postgres/PostgresTriggerEditorInner.svelte:373
  • Draft comment:
    Refactoring by removing redundant configuration-check code in favor of CheckPostgresRequirement improves maintainability. Verify that all state updates remain consistent.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
5. frontend/src/lib/components/triggers/CaptureWrapper.svelte:31
  • Draft comment:
    Consider providing a user-friendly error message when the invalidRelations check fails (line 38), similar to the missing table_to_track case.
  • Reason this comment was not posted:
    Marked as duplicate.
6. frontend/src/lib/components/triggers/postgres/CheckPostgresRequirement.svelte:32
  • Draft comment:
    Consider checking for an empty string (e.g. using !postgres_resource_path) instead of comparing strictly to undefined, since postgres_resource_path is typed as a string.
  • Reason this comment was not posted:
    Marked as duplicate.
7. frontend/src/lib/components/triggers/postgres/PostgresEditorConfigSection.svelte:79
  • Draft comment:
    Wrapping the Transactions and Table Tracking sections with an {#if postgres_resource_path} ensures these options only display when a database resource is selected. Confirm that this behavior aligns with the intended user experience.
  • Reason this comment was not posted:
    Confidence changes required: 33%
    None
8. frontend/src/lib/components/triggers/postgres/PostgresTriggerEditorInner.svelte:373
  • Draft comment:
    Good refactoring—removing the local checkDatabaseConfiguration and using the CheckPostgresRequirement component reduces redundancy. Ensure that the bindings for postgres_resource_path and can_write correctly propagate any error messages to the user.
  • Reason this comment was not posted:
    Confidence changes required: 33%
    None
9. frontend/src/lib/components/triggers/postgres/PostgresTriggerEditorInner.svelte:188
  • Draft comment:
    In updateTrigger, consider notifying the user why the configuration update was aborted if invalidRelations returns an error, so users understand the misconfiguration.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.

Workflow ID: wflow_1mEDNBzMvSNQAhzR


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

@Guilhem-lm
Copy link
Contributor

@HugoCasa I agree it is a lot of fields. Maybe for now we can keep it with a resource. And later would be nice to have the possibility to save resource as a draft ?

@Guilhem-lm
Copy link
Contributor

@dieriba nit : maybe instead of toasting the user when trying to add a schema while previous schema has no name you could just disable the +Add Schema button and add a popover that says "Fill previous schema name before adding a new one"

An other solution is to do the same UI as when adding an input to the flow schema, so that you cannot add a schema without a name

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.

❌ Changes requested. Incremental review on 09e11ab in 1 minute and 31 seconds

More details
  • Looked at 655 lines of code in 9 files
  • Skipped 0 files when reviewing.
  • Skipped posting 8 drafted comments based on config settings.
1. frontend/src/lib/components/triggers/CaptureWrapper.svelte:38
  • Draft comment:
    Using invalidRelations(args.publication.table_to_track, true) === true forces the function to return a boolean. Ensure that the "invalidRelations" function’s return type has been updated everywhere to consistently return a plain boolean (instead of an object) to avoid unintended side effects.
  • Reason this comment was not posted:
    Marked as duplicate.
2. frontend/src/lib/components/triggers/postgres/PostgresTriggerEditorInner.svelte:187
  • Draft comment:
    When checking invalid relations before updating the trigger, ensure that the condition correctly reflects the business logic. The comparison invalidRelations(relations, true) === true is dependent on side effects (showing a toast) and may need explicit unit tests to validate its behavior.
  • Reason this comment was not posted:
    Marked as duplicate.
3. frontend/src/lib/components/triggers/postgres/PublicationPicker.svelte:92
  • Draft comment:
    The reactive statement $: publication_name && getAllRelations() might trigger getAllRelations on every change to publication_name, possibly leading to frequent API calls. Consider throttling or debouncing this reactive call.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
4. frontend/src/lib/components/triggers/postgres/RelationPicker.svelte:177
  • Draft comment:
    The logic for adding a new schema/action is a bit complex. In the handler on line 177, after checking for undefined or empty relations and then checking if invalidRelations(...) is false, ensure that concatenating a new empty schema is the intended behavior. It might be clearer to separate the concerns of validating and initializing new entries.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
5. frontend/src/lib/components/triggers/postgres/utils.ts:60
  • Draft comment:
    The invalidRelations function performs side effects (sending a toast) inside a validation function. This could mix validation with UI feedback. Consider separating validation logic from UI notification to make it more testable and reusable.
  • Reason this comment was not posted:
    Comment was on unchanged code.
6. frontend/src/lib/components/triggers/CaptureWrapper.svelte:119
  • Draft comment:
    The reactive statement $: args && (captureActive = false) may unintentionally force captureActive to false whenever args is truthy. Verify that this behavior is intended.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
7. frontend/src/lib/components/triggers/postgres/PostgresTriggerEditorInner.svelte:104
  • Draft comment:
    There are redundant assignments like selectedPublicationAction = selectedPublicationAction and similar for slot action. Remove these no-op assignments to improve clarity.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
8. frontend/src/lib/components/triggers/postgres/utils.ts:60
  • Draft comment:
    The invalidRelations function returns a boolean and shows a toast when an error is detected. Ensure that this behavior is consistent with the rest of the app’s error messaging (i.e. that a side-effect inside a validation helper is acceptable).
  • Reason this comment was not posted:
    Marked as duplicate.

Workflow ID: wflow_wrgsg4d2gaTmV24h


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

publication.transaction_to_track.length > 0 &&
(selectedTable === 'all' || (notEmpty ?? false))

$: if (emptyString(postgres_resource_path)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The reactive block resetting ‘publication’ when postgres_resource_path is empty may override user changes unexpectedly. Consider whether resetting the entire publication object on empty resource path is the desired UX.

backend/windmill-api/src/postgres_triggers/mod.rs Outdated Show resolved Hide resolved
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 cf0c2dc in 1 minute and 38 seconds

More details
  • Looked at 44 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 5 drafted comments based on config settings.
1. backend/windmill-api/src/postgres_triggers/handler.rs:129
  • Draft comment:
    Using a timeout here is a good safeguard. However, the chained map_err(...)? can be a bit hard to follow. Consider splitting the timeout handling into intermediate variables for better clarity and maintainability.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
2. backend/windmill-api/src/postgres_triggers/handler.rs:133
  • Draft comment:
    Returning Ok(()) after the timeout assumes that a successful connection does not need to return the connection. Verify that this behavior is intended.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50%
    The comment is asking the PR author to verify if the behavior is intended, which violates the rule against asking for confirmation of intention. It does not provide a specific suggestion or point out a clear issue with the code.
3. backend/windmill-api/src/postgres_triggers/handler.rs:277
  • Draft comment:
    Enhancing the error mapping with location info is a positive step. Confirm that the hard-coded 'pg_trigger' string gives sufficient context for debugging.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 0% vs. threshold = 50%
    This comment violates several rules: 1) It asks the author to "confirm" something, which is explicitly forbidden 2) It's speculative - it doesn't point out a clear issue 3) It's not clearly actionable - there's no specific change being requested. The location string seems reasonable as is since it identifies the module.
    The location string could potentially be made more specific to help with debugging, so maybe there is a valid concern here.
    While the location could theoretically be more specific, the current string is sufficient to identify the module, and there's no clear evidence that more specificity is needed. We should err on the side of removing speculative comments.
    The comment should be deleted as it asks for confirmation without pointing out a clear issue that needs to be fixed.
4. backend/windmill-api/src/postgres_triggers/handler.rs:130
  • Draft comment:
    Using a 30s hardcoded timeout is a good idea to prevent hanging but consider making it configurable. Also, returning Ok(()) discards the connection result—ensure this is intentional for a test endpoint.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50%
    None
5. backend/windmill-api/src/postgres_triggers/handler.rs:278
  • Draft comment:
    Including an error location in the SqlErr variant is helpful; ensure similar error mapping is consistently applied elsewhere.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50%
    None

Workflow ID: wflow_Nju45YUzJOF3kTpf


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 61b3a73 in 2 minutes and 0 seconds

More details
  • Looked at 233 lines of code in 11 files
  • Skipped 0 files when reviewing.
  • Skipped posting 22 drafted comments based on config settings.
1. backend/.sqlx/query-07da723ce5c9ee2d7c236e8eabe254c783fc34b617c8a9a95a0eb0cda535dab5.json:21
  • Draft comment:
    Enum order changed: switched 'postgres' and 'nats'. Confirm this ordering change is intentional.
  • Reason this comment was not posted:
    Marked as duplicate.
2. backend/.sqlx/query-5c1de8473e0e96c1063a9a735a064c5a91e3ed8d9260c72b783fc12542b88fbd.json:26
  • Draft comment:
    Enum order updated for 'trigger_kind'. Verify consistency with other parts of the code.
  • Reason this comment was not posted:
    Marked as duplicate.
3. backend/.sqlx/query-62475252dcf54f32433b97ae011daf5d4205d160d2aedf463c7dfe944e93257a.json:21
  • Draft comment:
    Updated enum order for 'trigger_kind'. Confirm that downstream behavior isn’t affected by the new order.
  • Reason this comment was not posted:
    Marked as duplicate.
4. backend/.sqlx/query-71d51bbc35da7b9930e3ea3a634451217ccb9f1bc35b1ad6e10d16bc19c41447.json:29
  • Draft comment:
    Verify the updated enum ordering does not impact trigger filtering logic.
  • Reason this comment was not posted:
    Marked as duplicate.
5. backend/.sqlx/query-c223f8b7fa4ef1aa06e1ba2a56d677774aa237508d5610714efd2e9b8b93c7b8.json:23
  • Draft comment:
    Enum order for 'trigger_kind' updated; ensure consistency with similar queries.
  • Reason this comment was not posted:
    Marked as duplicate.
6. backend/.sqlx/query-c5270ee815689e42b65df507b850da43239c9a5aaea41c9aed7ed33a6219a534.json:18
  • Draft comment:
    Enum order modification detected; verify this change aligns with expectations for updates.
  • Reason this comment was not posted:
    Marked as duplicate.
7. backend/.sqlx/query-e17ec84003e2ec414622d100f5dfdda86bee33f31835317df512a20c805b35d7.json:24
  • Draft comment:
    Ensure that the enum 'trigger_kind' ordering change is coordinated with parsing logic downstream.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
8. backend/.sqlx/query-e23e110e1f0438d21534fc4323e0e7bc1f0dbeca2e4f44ced05bae0ca5ca1039.json:27
  • Draft comment:
    Enum ordering for 'trigger_kind' now swapped; verify that this does not alter behavior of condition checks.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
9. backend/.sqlx/query-6f56acb985aa7141ea1891d7ad58a32c35d1b02fe7070c92a2e62c1a5339c396.json:2
  • Draft comment:
    New query for checking replication slots; verify compatibility with target PostgreSQL version.
  • Reason this comment was not posted:
    Confidence changes required: 20% <= threshold 50%
    None
10. backend/.sqlx/query-baa1dddc616419bf4b923715f0a863bc0ff69c98db0f0c8f55e4ac89fdde7a60.json:2
  • Draft comment:
    New publication query; ensure that pg_publication is supported and privileges are appropriate.
  • Reason this comment was not posted:
    Confidence changes required: 20% <= threshold 50%
    None
11. backend/.sqlx/query-fd5754fe3c6346ae28818a9d60d144a40f8884f47e5bbdd2824e939dafd8f154.json:3
  • Draft comment:
    New publication tables query: confirm logic with CASE handling of column arrays meets business needs.
  • Reason this comment was not posted:
    Confidence changes required: 50% <= threshold 50%
    None
12. backend/.sqlx/query-07da723ce5c9ee2d7c236e8eabe254c783fc34b617c8a9a95a0eb0cda535dab5.json:20
  • Draft comment:
    Enum ordering changed: now ['nats', 'postgres'] instead of ['postgres', 'nats']. Confirm that this switch doesn’t affect any order‐dependent logic.
  • Reason this comment was not posted:
    Marked as duplicate.
13. backend/.sqlx/query-5c1de8473e0e96c1063a9a735a064c5a91e3ed8d9260c72b783fc12542b88fbd.json:29
  • Draft comment:
    Enum ordering updated to ['nats', 'postgres']. Please verify this change is safe and won’t affect serialization if order matters.
  • Reason this comment was not posted:
    Marked as duplicate.
14. backend/.sqlx/query-62475252dcf54f32433b97ae011daf5d4205d160d2aedf463c7dfe944e93257a.json:20
  • Draft comment:
    Enum ordering switched to ['nats', 'postgres'] here. Ensure that such reordering does not introduce any unexpected behavior.
  • Reason this comment was not posted:
    Marked as duplicate.
15. backend/.sqlx/query-6f56acb985aa7141ea1891d7ad58a32c35d1b02fe7070c92a2e62c1a5339c396.json:2
  • Draft comment:
    New query for checking replication slots has been added. Verify that the execution context has the necessary permissions for querying pg_replication_slots.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50%
    The comment is asking the PR author to verify permissions, which falls under the rule of not asking the author to ensure behavior or permissions. It doesn't provide a specific suggestion or point out a specific issue with the code.
16. backend/.sqlx/query-71d51bbc35da7b9930e3ea3a634451217ccb9f1bc35b1ad6e10d16bc19c41447.json:29
  • Draft comment:
    Enum ordering update for trigger_kind (['nats', 'postgres']) is applied here as well. Confirm consistency across the project.
  • Reason this comment was not posted:
    Marked as duplicate.
17. backend/.sqlx/query-baa1dddc616419bf4b923715f0a863bc0ff69c98db0f0c8f55e4ac89fdde7a60.json:1
  • Draft comment:
    New query to check publication existence has been added. The query looks valid.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50%
    This comment is purely informative, stating that a new query has been added and that it looks valid. It doesn't provide any actionable feedback or suggestions for improvement.
18. backend/.sqlx/query-c223f8b7fa4ef1aa06e1ba2a56d677774aa237508d5610714efd2e9b8b93c7b8.json:23
  • Draft comment:
    Trigger_kind enum ordering updated here to ['nats', 'postgres']. Ensure this change is intentional and consistent.
  • Reason this comment was not posted:
    Marked as duplicate.
19. backend/.sqlx/query-c5270ee815689e42b65df507b850da43239c9a5aaea41c9aed7ed33a6219a534.json:18
  • Draft comment:
    Enum ordering for trigger_kind updated to ['nats', 'postgres']. Double-check that this reordering is safe.
  • Reason this comment was not posted:
    Marked as duplicate.
20. backend/.sqlx/query-e17ec84003e2ec414622d100f5dfdda86bee33f31835317df512a20c805b35d7.json:26
  • Draft comment:
    The trigger_kind enum is now ordered as ['nats', 'postgres']. Confirm that this ordering does not cause any side effects.
  • Reason this comment was not posted:
    Marked as duplicate.
21. backend/.sqlx/query-e23e110e1f0438d21534fc4323e0e7bc1f0dbeca2e4f44ced05bae0ca5ca1039.json:34
  • Draft comment:
    Updated trigger_kind enum ordering to ['nats', 'postgres'] in this query. Verify that this change is consistent with usage elsewhere.
  • Reason this comment was not posted:
    Marked as duplicate.
22. backend/.sqlx/query-fd5754fe3c6346ae28818a9d60d144a40f8884f47e5bbdd2824e939dafd8f154.json:2
  • Draft comment:
    New query for fetching publication tables details is added. Confirm that the CASE logic (returning NULL when attnames matches column count) meets requirements.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50%
    The comment is asking for confirmation about intended behavior, which violates the rule "Do NOT ask the PR author to confirm their intention or to double-check things". The comment starts with "Confirm that..." which is explicitly called out as likely not useful. Additionally, without access to requirements or broader context, we can't effectively judge if the logic is correct.
    Perhaps the CASE logic could have serious implications for the application's behavior that we're missing without more context. Maybe this is a critical validation point.
    Even if this is important logic, asking for confirmation isn't helpful - if there's a specific issue, it should be pointed out directly. The rules explicitly state not to ask for confirmations.
    This comment should be removed as it violates the rule against asking for confirmations and doesn't point out any specific issues with the code.

Workflow ID: wflow_0suFWGJC8ZSZdI95


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.

❌ Changes requested. Incremental review on d0759d8 in 1 minute and 28 seconds

More details
  • Looked at 352 lines of code in 4 files
  • Skipped 0 files when reviewing.
  • Skipped posting 10 drafted comments based on config settings.
1. frontend/src/lib/components/triggers/CaptureWrapper.svelte:38
  • Draft comment:
    Extra parameter true passed to invalidRelations; ensure this flag's purpose is clearly documented in the function signature and usage.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50%
    Without seeing the implementation of invalidRelations(), I cannot verify if this comment is correct or useful. The function could have been updated elsewhere to accept this third parameter. The comment suggests documenting the parameter, but we don't know if it's already documented in the function definition. We should err on the side of assuming the author knows what they're doing.
    The comment could be valid if the third parameter was accidentally added and serves no purpose. The function signature documentation could be missing.
    However, without seeing the invalidRelations implementation, we cannot verify if this is actually an issue. The change could be intentional and already properly documented in the function definition.
    Delete this comment since we don't have enough context to verify if it's a real issue. The change could be intentional and properly documented in the function implementation.
2. frontend/src/lib/components/triggers/postgres/PostgresTriggerEditorInner.svelte:186
  • Draft comment:
    Updated invalidRelations call now includes an extra boolean flag. Verify that the additional flag (trackSchemaTableError) is correctly handled by the function.
  • Reason this comment was not posted:
    Marked as duplicate.
3. frontend/src/lib/components/triggers/postgres/RelationPicker.svelte:223
  • Draft comment:
    Ensure that calling invalidRelations with (appendedRelations, false, true) returns consistent behavior when no error is present. The conditional check against false should be verified.
  • Reason this comment was not posted:
    Marked as duplicate.
4. frontend/src/lib/components/triggers/postgres/utils.ts:80
  • Draft comment:
    Double-check the logic for detecting duplicate schema names (error.duplicateSchemaName) to ensure it behaves as expected when undefined versus false.
  • Reason this comment was not posted:
    Marked as duplicate.
5. frontend/src/lib/components/triggers/CaptureWrapper.svelte:38
  • Draft comment:
    Updated invalidRelations call now includes a third parameter. Please ensure the new flag (likely 'showError') is clearly documented and that its usage is consistent with the function’s intent.
  • Reason this comment was not posted:
    Marked as duplicate.
6. frontend/src/lib/components/triggers/postgres/PostgresTriggerEditorInner.svelte:187
  • Draft comment:
    The invalidRelations call now uses three parameters. Consider simplifying the condition (e.g. avoiding explicit '=== true') and ensure the documentation explains what each boolean flag controls.
  • Reason this comment was not posted:
    Marked as duplicate.
7. frontend/src/lib/components/triggers/postgres/RelationPicker.svelte:226
  • Draft comment:
    In the AddPropertyFormV2 on:add handler, the call to invalidRelations(appendedRelations, false, true) uses 'false' for trackSchemaTableError. Verify that this behavior is intended when adding a new schema (e.g. to bypass checks for mixed table tracking) while still catching issues like duplicate schema names.
  • Reason this comment was not posted:
    Marked as duplicate.
8. frontend/src/lib/components/triggers/postgres/utils.ts:31
  • Draft comment:
    This console.log statement appears to be debugging code. Remove or disable it before production.
  • Reason this comment was not posted:
    Marked as duplicate.
9. frontend/src/lib/components/triggers/postgres/utils.ts:15
  • Draft comment:
    Consider refactoring invalidRelations to accept an options object instead of multiple boolean flags. This can improve readability and reduce potential errors if additional options are needed in the future.
  • Reason this comment was not posted:
    Marked as duplicate.
10. frontend/src/lib/components/triggers/postgres/utils.ts:39
  • Draft comment:
    The duplicate schema name check sets error.duplicateSchemaName. It may help to add a comment clarifying that duplicate schema names trigger an error and ensure that this behavior is consistently handled in the UI.
  • Reason this comment was not posted:
    Marked as duplicate.

Workflow ID: wflow_uz4X2PfawX3WIOhj


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

}

const duplicateName: Set<string> = new Set()
console.log(relations.length)
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove or gate the console.log statement for production usage.

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 1d9a691 in 1 minute and 16 seconds

More details
  • Looked at 102 lines of code in 4 files
  • Skipped 0 files when reviewing.
  • Skipped posting 8 drafted comments based on config settings.
1. frontend/src/lib/components/triggers/CaptureWrapper.svelte:39
  • Draft comment:
    Good refactor: using the options object for invalidRelations improves clarity. Consider simplifying the boolean comparison (e.g. if (invalidRelations(...) )) but this is minor.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50%
    None
2. frontend/src/lib/components/triggers/postgres/PostgresTriggerEditorInner.svelte:188
  • Draft comment:
    Consistent refactor: the updated invalidRelations call using an options object is clear. Minor suggestion: remove strict === true comparison for readability.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50%
    None
3. frontend/src/lib/components/triggers/postgres/RelationPicker.svelte:231
  • Draft comment:
    The refactor in the invalidRelations call here looks good. Ensure that returning false correctly reflects the invalid configuration.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50%
    None
4. frontend/src/lib/components/triggers/postgres/utils.ts:69
  • Draft comment:
    Refactoring the invalidRelations function to accept an options object improves type safety and readability. Consider always initializing 'duplicateSchemaName' as a boolean for consistency.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50%
    None
5. frontend/src/lib/components/triggers/CaptureWrapper.svelte:38
  • Draft comment:
    Consider removing the explicit '=== true' comparison; using if(invalidRelations(...)) is clearer.
  • Reason this comment was not posted:
    Comment was on unchanged code.
6. frontend/src/lib/components/triggers/postgres/PostgresTriggerEditorInner.svelte:188
  • Draft comment:
    Remove the explicit '=== true' check on invalidRelations; a direct truth value check is more idiomatic.
  • Reason this comment was not posted:
    Marked as duplicate.
7. frontend/src/lib/components/triggers/postgres/RelationPicker.svelte:230
  • Draft comment:
    Instead of comparing the result of invalidRelations to false (using '=== false'), consider using a negated condition (!invalidRelations(...)) for clarity.
  • Reason this comment was not posted:
    Comment was on unchanged code.
8. frontend/src/lib/components/triggers/postgres/utils.ts:16
  • Draft comment:
    Consider using default parameter values in the options object (e.g., { trackSchemaTableError = false, showError = false } = {}) to simplify nullish coalescing checks later.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 30% vs. threshold = 50%
    The suggestion would simplify the nullish coalescing checks and make the default values more explicit at the parameter level. However, this is a relatively minor code style suggestion that doesn't affect functionality. The current code is perfectly valid and clear. The suggestion is more of a preference than a clear improvement.
    The current code style with nullish coalescing is a common pattern in TypeScript and some developers prefer it for explicit null checking. The suggestion might make the code slightly more verbose at the parameter declaration.
    While the current code is fine, having defaults in the parameter would make the intended default values more immediately obvious to readers and reduce redundant checks in the code body.
    While this is a valid suggestion for code improvement that relates to changed code, it's more of a style preference than a clear issue that needs to be fixed.

Workflow ID: wflow_PW91HUi81ZyKJEqd


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 a7b432a in 41 seconds

More details
  • Looked at 25 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 4 drafted comments based on config settings.
1. frontend/src/lib/components/ShareModal.svelte:31
  • Draft comment:
    Add 'postgres_trigger' to Kind type. Verify that all usages in the app correctly match this new kind.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50%
    None
2. frontend/src/routes/(root)/(logged)/postgres_triggers/+page.svelte:392
  • Draft comment:
    Update shareModal.openDrawer trigger type from 'websocket_trigger' to 'postgres_trigger' to match new type.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50%
    None
3. frontend/src/lib/components/ShareModal.svelte:31
  • Draft comment:
    New 'postgres_trigger' type added to the Kind union. Confirm that all downstream logic appropriately handles this new trigger type.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50%
    None
4. frontend/src/routes/(root)/(logged)/postgres_triggers/+page.svelte:392
  • Draft comment:
    Changed shareModal.openDrawer to use 'postgres_trigger' instead of 'websocket_trigger', which is correct for this feature.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50%
    None

Workflow ID: wflow_M5fcc24BfBx7a1I3


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 e040751 in 34 seconds

More details
  • Looked at 25 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 4 drafted comments based on config settings.
1. frontend/src/lib/components/details/DetailPageTriggerPanel.svelte:10
  • Draft comment:
    Good use of a trailing comma and addition of the Database icon import. This makes the import list more maintainable.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50%
    None
2. frontend/src/lib/components/details/DetailPageTriggerPanel.svelte:75
  • Draft comment:
    Replacing Unplug with Database for the postgres tab icon correctly aligns the icon with its purpose.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50%
    This comment is purely informative, explaining the reason behind a change without suggesting any action or asking for clarification. It doesn't align with the rules for useful comments.
3. frontend/src/lib/components/details/DetailPageTriggerPanel.svelte:10
  • Draft comment:
    The import has been updated to include Database with a trailing comma for PlugZap. Ensure this is consistent with your project’s style guidelines.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50%
    None
4. frontend/src/lib/components/details/DetailPageTriggerPanel.svelte:69
  • Draft comment:
    Replaced Unplug with Database for the Postgres tab. This change improves clarity; just ensure it aligns with design intent.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50%
    None

Workflow ID: wflow_747WHfTCIugcZcxS


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.

3 participants