feat: Add core edit API for modifying the model (update, replace, add and delete tasks) - #336
Open
handreyrc wants to merge 3 commits into
Open
Conversation
Signed-off-by: handreyrc <handrey.cunha@gmail.com>
Signed-off-by: handreyrc <handrey.cunha@gmail.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Introduces a core workflow-editing API for manipulating Open Workflow models (update/replace/delete/add tasks) using non-indexed editor task IDs, along with realistic fixtures and a comprehensive Vitest suite to validate immutability and reference updates.
Changes:
- Added
workflowEditingcore module implementingupdateTask,replaceTask,deleteTask, andaddTask. - Added a complex real-world workflow fixture used to exercise nested editing behavior.
- Added extensive Vitest coverage for editing operations, including switch-case pruning and
thenreference rewriting.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/open-workflow-diagram-editor/src/core/workflowEditing.ts | Implements the new task editing APIs and path traversal logic. |
| packages/open-workflow-diagram-editor/tests/core/workflowEditing.test.ts | Adds end-to-end tests covering editing behavior and immutability. |
| packages/open-workflow-diagram-editor/tests/fixtures/workflows.ts | Adds a complex workflow fixture to exercise nested editing cases. |
| packages/open-workflow-diagram-editor/src/core/index.ts | Exports the new workflowEditing module from the core entrypoint. |
| .changeset/core-editing-api.md | Publishes a minor version bump announcing the new core editing API. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Signed-off-by: handreyrc <handrey.cunha@gmail.com>
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.
Closes #325
Summary
This PR introduces a core API to modify the model by updating, replacing, adding and deleting tasks and then returning a draft model (model to be).
Changes
core/workflowEditing.tsfile to host the API to handle changes in the model.updateTaskfunction to update a task with new property values.replaceTaskfunction to handle cases when a task name changes affecting the id, and for cases where the task type changes. It also updates the references to the new task in other tasks at the same level (taskList).addTaskfunction to add new tasks to a specific path (parentId).deleteTaskfunction to remove tasks and remove references to the deleted task.