Repository navigation
fix: reject workflow saves from a stale draft - #638
Merged
Merged
Conversation
Update and publish now require expectedVersion, the workflow version the client's draft is based on. A mismatch returns 409 workflow_version_conflict before anything is written, so a second tab can no longer replace a save it never saw. The existing lock and compare-and-swap checks stay in place; the guarded update already matches on the loaded version, which makes the check atomic. The designer sends the version it synced from the server and advances it after each save or publish. On a conflict it keeps the draft, shows a message and stops autosave until the workflow is reloaded. CLI, MCP, the load-test client and the admin scripts send the version they read. Fixes #609 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #609
Two tabs that loaded the same version could both save, and the second save silently replaced the first one's changes. Update and publish now carry
expectedVersion; the server answers409 workflow_version_conflictwhen it does not match the stored version, before anything is written.expectedVersionis required onPUT /api/workflows/{id}andPOST /{id}/publish. The check runs after the lock check, and the existing compare-and-swap already matches on the loaded version, so it is atomic.This is a breaking change for external callers of the two endpoints: a body without
expectedVersionis now rejected with 400.Tests run locally:
NodePilot.Api.Tests(WorkflowsEditLockTests, WorkflowsControllerTests, WorkflowPortabilityTests): 93 passed, including the two-tab regressionNodePilot.Cli.Tests(NodePilotApiClientTests, ApiDtoParityTests, CommandIntegrationTests): 123 passedNodePilot.Mcp.TestsWorkflowEditToolsTests 7, DocumentationCountsTests 29NodePilot.Engine.TestsLoadHarnessContractTests 8scripts/test_nodepilot_admin_scripts.py(14) andTest-WorkflowCatalogue.ps1🤖 Generated with Claude Code