feat!: decouple node identity from document location#289
Merged
JBBianchi merged 1 commit intoJul 20, 2026
Merged
Conversation
- compute index-free, name-path node ids (/do/step1) that stay stable when sibling tasks are inserted, removed, or reordered - prefix non-root entry/exit ports with 'port-' to avoid id collisions - expose each task's indexed RFC 6901 pointer via taskReference, with getNodeByTaskReference/getNodeAtPointer lookup helpers - derive edge ids from endpoint node ids only, so label edits (if conditions, switch cases) no longer churn edge identity - render Mermaid nodes under renderer-local aliases (n0, n1, ...) and escape labels, so any task name yields valid diagram syntax - allow callers to supply persistent node ids via GraphBuildOptions.taskId on buildGraph/buildFlatGraph/Workflow.toGraph Signed-off-by: Jean-Baptiste Bianchi <jb.bianchi@neuroglia.io>
lornakelly
approved these changes
Jul 17, 2026
6 tasks
ricardozanini
approved these changes
Jul 20, 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.


Many thanks for submitting your Pull Request ❤️!
What this PR does / why we need it:
Copilot summary:
This pull request introduces significant improvements to the workflow graph builder, focusing on stable, pointer-shaped node IDs for tasks, support for custom task ID factories, and enhanced mapping between graph nodes and workflow document pointers. It also updates the MermaidJS diagram output to use renderer-local aliases, ensuring diagram stability regardless of task name changes or special characters. The changes are reflected in both the TypeScript code and documentation.
Graph Node Identity and Customization
/do/step1), making them resilient to sibling task insertions, removals, or reordering. Only renaming or moving a task changes its ID. Non-root entry and exit ports use aport-prefix to avoid collisions, and edge IDs are derived from endpoint node IDs only. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16]taskIdfactory viaGraphBuildOptions, allowing consumers to provide persistent task identities (e.g., for editors that need to keep node identity across renames). The factory receives rich context and must return unique IDs. [1] [2] [3] [4]Graph-to-Document Mapping
taskReferenceproperty, enabling precise correlation between graph nodes and validation/runtime references. Helper functions for node lookup by pointer are documented. [1] [2] [3] [4]MermaidJS Diagram Output
n0,n1, ...) instead of graph node IDs, ensuring diagrams remain valid regardless of task name content. The documentation clarifies when to use the graph API for addressable node identities. [1] [2]Other Updates
1.0.3-alpha5.These changes collectively make the graph builder more robust, customizable, and easier to integrate with tools that require stable node identities and precise mapping to workflow document structures.
Special notes for reviewers:
Additional information (if needed):