Skip to content

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-workflow-specification:feature/node-editingfrom
handreyrc:edit-model
Open

feat: Add core edit API for modifying the model (update, replace, add and delete tasks)#336
handreyrc wants to merge 3 commits into
open-workflow-specification:feature/node-editingfrom
handreyrc:edit-model

Conversation

@handreyrc

Copy link
Copy Markdown
Contributor

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

  • Added core/workflowEditing.ts file to host the API to handle changes in the model.
  • Added updateTask function to update a task with new property values.
  • Added replaceTask function 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).
  • Added addTask function to add new tasks to a specific path (parentId).
  • Added deleteTask function to remove tasks and remove references to the deleted task.

Signed-off-by: handreyrc <handrey.cunha@gmail.com>
Signed-off-by: handreyrc <handrey.cunha@gmail.com>
@handreyrc handreyrc self-assigned this Aug 18, 2026
@handreyrc
handreyrc requested a balanced review from Copilot August 18, 2026 17:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 workflowEditing core module implementing updateTask, replaceTask, deleteTask, and addTask.
  • 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 then reference 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.

Comment thread packages/open-workflow-diagram-editor/src/core/workflowEditing.ts
Comment thread packages/open-workflow-diagram-editor/src/core/workflowEditing.ts
Comment thread packages/open-workflow-diagram-editor/src/core/workflowEditing.ts Outdated
Comment thread packages/open-workflow-diagram-editor/src/core/workflowEditing.ts
Comment thread packages/open-workflow-diagram-editor/tests/core/workflowEditing.test.ts Outdated
Signed-off-by: handreyrc <handrey.cunha@gmail.com>

@lornakelly lornakelly left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

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