-
Notifications
You must be signed in to change notification settings - Fork 53.3k
feat: Autosave Collaboration - Lock editing for spectators #23234
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
base: autosave-feature
Are you sure you want to change the base?
Conversation
BundleMonUnchanged files (2)
No change in files bundle size Groups updated (1)
Unchanged groups (1)
Final result: ✅ View report in BundleMon website ➡️ |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues found across 21 files
|
E2E Tests: n8n tests passed after 9m 44.2s Run Details
Groups
This message was posted automatically by
currents.dev | Integration Settings
|
dbb9926 to
9e88f87
Compare
This comment has been minimized.
This comment has been minimized.
b7c0b4d to
535a8bf
Compare
3bb7271 to
a943d05
Compare
5bdfe95 to
f5edf4c
Compare
This comment has been minimized.
This comment has been minimized.
…ress (#23967) Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com> Co-authored-by: Svetoslav Dekov <[email protected]>
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 4 files (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="packages/cli/src/collaboration/collaboration.service.ts">
<violation number="1" location="packages/cli/src/collaboration/collaboration.service.ts:175">
P1: Heartbeat renewal should require *write* access, not just read access, otherwise a user who no longer has write permissions could keep a write lock alive and block editors.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 5 files (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="packages/frontend/editor-ui/src/app/components/MainHeader/WorkflowHeaderDraftPublishActions.vue">
<violation number="1" location="packages/frontend/editor-ui/src/app/components/MainHeader/WorkflowHeaderDraftPublishActions.vue:139">
P2: Autosave handling may be skipped when dirty state is false. If an autosave is in progress but `stateIsDirty` has been cleared (e.g., save started but not completed), the publish modal will open without waiting for the pending save. Consider calling `saveBeforePublish()` unconditionally or at least checking autosave state before opening the modal.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
packages/frontend/editor-ui/src/app/components/MainHeader/WorkflowHeaderDraftPublishActions.vue
Outdated
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 2 files (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="packages/frontend/editor-ui/src/app/components/MainHeader/WorkflowHeaderDraftPublishActions.vue">
<violation number="1">
P2: If `saveCurrentWorkflow` throws an exception, `autoSaveForPublish.value = false` will never execute, leaving the publish button stuck in a loading state. Consider wrapping this in a try-finally block to ensure the loading state is always reset.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
packages/frontend/editor-ui/src/app/components/MainHeader/WorkflowHeaderDraftPublishActions.vue
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 2 files (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="packages/frontend/editor-ui/src/app/composables/useWorkflowSaving.ts">
<violation number="1" location="packages/frontend/editor-ui/src/app/composables/useWorkflowSaving.ts:153">
P2: Incomplete concurrent save prevention: when a manual save is already in progress, another manual save will proceed without waiting because `pendingAutoSave` is only set for autosaves. The code should either track all in-progress saves or add an else case to handle when `pendingAutoSave` is null but `workflowSaving` is still active.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
|
|
||
| // Prevent concurrent saves - if a save is already in progress, skip this one | ||
| // for autosaves (they will be rescheduled), or wait for non-autosaves | ||
| if (uiStore.isActionActive.workflowSaving) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: Incomplete concurrent save prevention: when a manual save is already in progress, another manual save will proceed without waiting because pendingAutoSave is only set for autosaves. The code should either track all in-progress saves or add an else case to handle when pendingAutoSave is null but workflowSaving is still active.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/frontend/editor-ui/src/app/composables/useWorkflowSaving.ts, line 153:
<comment>Incomplete concurrent save prevention: when a manual save is already in progress, another manual save will proceed without waiting because `pendingAutoSave` is only set for autosaves. The code should either track all in-progress saves or add an else case to handle when `pendingAutoSave` is null but `workflowSaving` is still active.</comment>
<file context>
@@ -148,6 +148,19 @@ export function useWorkflowSaving({
+ // Prevent concurrent saves - if a save is already in progress, skip this one
+ // for autosaves (they will be rescheduled), or wait for non-autosaves
+ if (uiStore.isActionActive.workflowSaving) {
+ if (autosaved) {
+ // Autosave will be rescheduled by the finally block of the in-progress save
</file context>
…r is generating (no-changelog) (#23989)
|
@claude review this PR |
|
Claude finished @scdekov's task —— View job Code Review: Autosave Collaboration FeatureOverall AssessmentThis is a well-architected collaboration feature that implements write locks for shared workflow editing. The implementation follows good practices with proper separation between frontend/backend concerns and includes robust error handling. However, there are several important issues that need attention. Review Progress
🚨 Critical Issues1. Security Issue: Heartbeat Authentication -
|
Summary
Description
Implement write locks for users editing workflows. The lock is released after 20 seconds of inactivity.
Explanation of some solutions/decisions:
The
workflowUpdatedevent is handled directly in the collaboration store instead of going through theusePushConnection/handlerspattern because it needs collaboration-specific state (like write locks, spectator mode and canvas refresh callbacks). It also has a different lifecycle - it’s tied to theCollaborationPanecomponent rather than being global.The collaboration store doesn’t talk to the canvas directly. Instead, it exposes a callback that the canvas hooks into. This avoids circular dependencies and keeps a clean split between business logic (the store) and view logic (the component). The store decides when a refresh should happen, and the NodeView handles how it happens, like restoring UI state or reopening the NDV.
Fix stuck workflow write locks with TTL + heartbeat + expiration detection
When a writer’s tab crashes/goes offline, the workflow write lock could previously remain held indefinitely, blocking collaborators until manual backend intervention. So these were introduced:
writeAccessHeartbeatmessage to renew the TTL.currentWriterIdwhen the backend lock has expired.We send telemetry for audit in
log-streaming.event-relaywhere we could putworkflowUpdated, but as it is only needed for collaboration to work correctly, it is not needed here.Related Linear tickets, Github issues, and Community forum posts
Closes ADO-4284
Review / Merge checklist
release/backport(if the PR is an urgent fix that needs to be backported)