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

Multiplayer deploy collision warning #4533

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

Conversation

pyranota
Copy link
Collaborator

@pyranota pyranota commented Oct 16, 2024

Show warning with diff viewer if 2+ users try to deploy flow/script/app at the same time

In other words, if user A and user B started editing same flow/script/app and user A deployed it, user B will get warning if they try to deploy as well.

2024-10-16_14-28
2024-10-16_14-32


Important

Adds multiplayer deploy collision warning with confirmation modal to handle deployment conflicts in FlowBuilder.svelte, ScriptBuilder.svelte, and AppEditorHeader.svelte.

  • Behavior:
    • Adds multiplayer deploy collision warning in FlowBuilder.svelte, ScriptBuilder.svelte, and AppEditorHeader.svelte.
    • Uses DeployOverrideConfirmationModal.svelte to show a warning if another user has deployed a new version.
    • Allows users to view differences and confirm override if not on the latest version.
  • Components:
    • New DeployOverrideConfirmationModal.svelte component for handling deployment conflicts.
  • Functions:
    • handleSaveFlow(), handleEditScript(), and handleUpdateApp() modified to check for the latest version and open confirmation modal if needed.
  • API:
    • Adds get_latest_version endpoints in openapi.yaml for flows, scripts, and apps.
    • Implements get_latest_version functions in flows.rs, scripts.rs, and apps.rs to fetch the latest version details.
  • Misc:
    • Adds deployedBy, deployedValue, confirmCallback, and open variables to track deployment state and handle modal interactions.

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

Show warning with diff viewer if 2+ users try to deploy flow/script/app at the same time

In other words, if user A and user B started editing same flow/script/app and user A deployed it,
user B will get warning if they try to deploy as well.
Copy link

cloudflare-workers-and-pages bot commented Oct 16, 2024

Deploying windmill with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0a29279
Status: ✅  Deploy successful!
Preview URL: https://3b26c172.windmill.pages.dev
Branch Preview URL: https://deploy-collision-warning.windmill.pages.dev

View logs

@pyranota pyranota marked this pull request as ready for review October 16, 2024 15:11
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 e8fd885 in 41 seconds

More details
  • Looked at 483 lines of code in 4 files
  • Skipped 0 files when reviewing.
  • Skipped posting 6 drafted comments based on config settings.
1. frontend/src/lib/components/FlowBuilder.svelte:115
  • Draft comment:
    Consider adding error handling for the FlowService.getFlowByPath call to handle potential API errors gracefully.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The PR introduces a new feature to handle multiplayer deploy collisions by showing a warning and a diff viewer. The implementation seems consistent across different components, but there are some areas that could be improved for better code quality and maintainability.
2. frontend/src/lib/components/ScriptBuilder.svelte:235
  • Draft comment:
    Consider adding error handling for the ScriptService.getScriptByPath call to handle potential API errors gracefully.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The PR introduces a new feature to handle multiplayer deploy collisions by showing a warning and a diff viewer. The implementation seems consistent across different components, but there are some areas that could be improved for better code quality and maintainability.
3. frontend/src/lib/components/apps/editor/AppEditorHeader.svelte:383
  • Draft comment:
    Consider adding error handling for the AppService.getAppByPath call to handle potential API errors gracefully.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The PR introduces a new feature to handle multiplayer deploy collisions by showing a warning and a diff viewer. The implementation seems consistent across different components, but there are some areas that could be improved for better code quality and maintainability.
4. frontend/src/lib/components/FlowBuilder.svelte:270
  • Draft comment:
    The onLatest function is used to check if the current version is the latest. Consider renaming it to isLatestVersion for better clarity and consistency with its purpose.
  • Reason this comment was not posted:
    Confidence changes required: 30%
    The PR introduces a new feature to handle multiplayer deploy collisions by showing a warning and a diff viewer. The implementation seems consistent across different components, but there are some areas that could be improved for better code quality and maintainability.
5. frontend/src/lib/components/ScriptBuilder.svelte:233
  • Draft comment:
    The handleEditScript function is used to handle script editing. Consider renaming it to handleScriptEdit for better consistency with naming conventions.
  • Reason this comment was not posted:
    Confidence changes required: 30%
    The PR introduces a new feature to handle multiplayer deploy collisions by showing a warning and a diff viewer. The implementation seems consistent across different components, but there are some areas that could be improved for better code quality and maintainability.
6. frontend/src/lib/components/apps/editor/AppEditorHeader.svelte:379
  • Draft comment:
    The handleUpdateApp function is used to handle app updates. Consider renaming it to handleAppUpdate for better consistency with naming conventions.
  • Reason this comment was not posted:
    Confidence changes required: 30%
    The PR introduces a new feature to handle multiplayer deploy collisions by showing a warning and a diff viewer. The implementation seems consistent across different components, but there are some areas that could be improved for better code quality and maintainability.

Workflow ID: wflow_bpmdKWlTdMFcLZSC


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

fatonramadani and others added 2 commits October 16, 2024 17:47
* feat(frontend): added list of triggers in the flow graph

* feat(frontend): added list of triggers in the flow graph

* feat(frontend): clean up

* feat(frontend): improve UX

* feat(frontend): triggers

* feat(frontend): triggers

* feat(frontend): done

* feat(frontend): fix trigger when position when a preprocessor is presetn

* Glm/rework flow settings v2 (#4497)

* fat(frontend): simplify flow settings menu

* improve scroll

* changing mute toggle

* Add advanced settings badge

* Add nord theme colors

* Add bage for advanced options

* fix minor issue

* fix minor issue

* Add triggers menu to flow settings

* Add quick trigger access

* remove triggers in flow settings

* fix minor issue

* Move triggers settings to flow right panel

* polishing

* fix unset store

* remove save up to for triggers

* fix padding

* reset default tag color

* remove custom select component

* revert path change

* revert section modif

* Revert unused feature

---------

Co-authored-by: Guilhem <guilhem@mbp-de-windmill.home>

* Connect top bar cron to schedules settings

* Turn copilot into node

* fix copilot placement

* remove useless import

* fix center copilot

* fix binding

* remove copilot on top of preprocessor

* render copilot node on condition

* quickfix

* remove copilot node

* fix minor issues

* fix route count update

* fix schedule sync

* harmonize colors

* fix alignment and add edges

* recenter node summary

* fix schedules sync

* Add id title

* all

* all

* all

* iteration

* all

* all

* done

* fix

* more fixes

---------

Co-authored-by: Guilhem <guilhemlemouel@gmail.com>
Co-authored-by: Guilhem <guilhem@mbp-de-windmill.home>
Co-authored-by: Ruben Fiszel <ruben@windmill.dev>
Co-authored-by: Ruben Fiszel <ruben@rubenfiszel.com>
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 0fe1f19 in 31 seconds

More details
  • Looked at 44 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. frontend/src/lib/components/FlowBuilder.svelte:108
  • Draft comment:
    The variable last_updated_at is declared twice, once globally and once locally within the onLatest function. The global declaration is unnecessary and should be removed to avoid confusion.
  • Reason this comment was not posted:
    Comment looked like it was already resolved.

Workflow ID: wflow_G4JgTOGwnLowpISG


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 4a21173 in 42 seconds

More details
  • Looked at 126 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/FlowBuilder.svelte:122
  • Draft comment:
    Consider adding a check to ensure flowHistory is not empty before accessing flowHistory[0]?.id to avoid potential runtime errors.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable:
    The use of optional chaining (?.) in flowHistory[0]?.id already handles the case where flowHistory might be empty, as it will return undefined instead of causing a runtime error. Therefore, the comment suggesting an additional check is redundant and not necessary.
    I might be overlooking a scenario where further logic depends on onLatest being set correctly, but the optional chaining should suffice for preventing runtime errors.
    The optional chaining is a standard practice to handle potential undefined values, and the logic for onLatest seems to be correctly handled with the current implementation.
    The comment is unnecessary because the optional chaining already prevents runtime errors. The comment should be deleted.
2. frontend/src/lib/components/FlowBuilder.svelte:127
  • Draft comment:
    Consider adding a check to ensure flowHistory is not empty before accessing flowHistory[0]?.id to avoid potential runtime errors.
  • Reason this comment was not posted:
    Marked as duplicate.
3. frontend/src/routes/(root)/(logged)/flows/edit/[...path]/+page.svelte:71
  • Draft comment:
    Ensure that the result of FlowService.getFlowHistory is not empty before accessing [0]?.id to prevent potential runtime errors.
  • Reason this comment was not posted:
    Marked as duplicate.
4. frontend/src/routes/(root)/(logged)/flows/edit/[...path]/+page.svelte:116
  • Draft comment:
    Ensure that the result of FlowService.getFlowHistory is not empty before accessing [0]?.id to prevent potential runtime errors.
  • Reason this comment was not posted:
    Marked as duplicate.

Workflow ID: wflow_kdFpYGMQCZXbq7g0


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 5c46f49 in 1 minute and 21 seconds

More details
  • Looked at 308 lines of code in 8 files
  • Skipped 0 files when reviewing.
  • Skipped posting 4 drafted comments based on config settings.
1. backend/windmill-api/src/scripts.rs:959
  • Draft comment:
    The SQL query should use LIMIT 1 to ensure only the latest version is fetched. This applies to similar queries in flows.rs and apps.rs.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable:
    The fetch_one method is used, which implies that the query is expected to return a single result. Adding LIMIT 1 could be seen as redundant since fetch_one will already enforce this behavior. The comment also references other files, which is outside the scope of this review.
    I might be overlooking the fact that fetch_one could potentially throw an error if more than one result is returned, and LIMIT 1 would prevent this. However, the current implementation seems to rely on the assumption that the query will only return one result due to the ordering.
    The use of fetch_one suggests that the developer expects only one result, and the ordering by created_at DESC should ensure that the latest version is returned. Adding LIMIT 1 might be unnecessary in this context.
    The comment should be deleted because the use of fetch_one already implies that only one result is expected, and the ordering ensures it is the latest version.
2. frontend/src/lib/components/FlowBuilder.svelte:119
  • Draft comment:
    Consider adding error handling for the API call in compareVersions to prevent unhandled promise rejections. This applies to similar functions in ScriptBuilder.svelte and AppEditorHeader.svelte.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable:
    The comment is relevant to the changes made in the diff, as it suggests adding error handling to the modified compareVersions function. The function indeed lacks error handling for the asynchronous call, which could lead to unhandled promise rejections. The comment is actionable and suggests a clear improvement to the code quality.
    The comment mentions other files, which is not relevant to this diff. However, the suggestion to add error handling is valid for the changes made in this file.
    While the mention of other files is not relevant, the core suggestion to add error handling is valid and should be considered for this file.
    Keep the comment as it suggests a valid code improvement by adding error handling to the modified function.
3. frontend/src/lib/components/ScriptBuilder.svelte:254
  • Draft comment:
    Consider adding error handling for the API call in compareVersions to prevent unhandled promise rejections. This applies to similar functions in FlowBuilder.svelte and AppEditorHeader.svelte.
  • Reason this comment was not posted:
    Marked as duplicate.
4. frontend/src/lib/components/apps/editor/AppEditorHeader.svelte:618
  • Draft comment:
    Consider adding error handling for the API call in compareVersions to prevent unhandled promise rejections. This applies to similar functions in FlowBuilder.svelte and ScriptBuilder.svelte.
  • Reason this comment was not posted:
    Marked as duplicate.

Workflow ID: wflow_sgIDvQkeG8t4fu2a


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 dc2fdb8 in 46 seconds

More details
  • Looked at 160 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. frontend/src/lib/components/FlowBuilder.svelte:296
  • Draft comment:
    The function syncWithDeployed is duplicated across multiple files with the same logic. Consider refactoring it into a shared utility function to reduce redundancy and improve maintainability.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable:
    The comment suggests a code quality improvement by refactoring a potentially duplicated function. However, the diff only shows the function in this file, and there is no evidence of duplication across multiple files. Without evidence of duplication, the comment is speculative and should be removed.
    I might be missing the context of other files where this function is duplicated. However, the diff does not provide this information, and the comment should be based on the changes visible in the diff.
    The diff should provide evidence of the issue being commented on. Without evidence in the diff, the comment is speculative and not actionable based on the current review context.
    Remove the comment as it is speculative and not supported by evidence in the diff.

Workflow ID: wflow_RHc3vHYUywXtwtO7


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