Sort mermaid graph nodes alphabetically for stable code generation#1869
Merged
Sort mermaid graph nodes alphabetically for stable code generation#1869
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Sort nodes by names for mermaid graph generation
Sort mermaid graph nodes alphabetically for stable code generation
Oct 17, 2025
pelikhan
approved these changes
Oct 17, 2025
Contributor
|
Agentic Changeset Generator triggered by this pull request. |
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.
Problem
The mermaid graph generation in workflow compilation was using job insertion order, which led to non-deterministic output when jobs were added in different orders. This created unnecessary git diffs when recompiling workflows, making it harder to track meaningful changes.
Solution
Modified the
GenerateMermaidGraph()function inpkg/workflow/jobs.goto sort job names alphabetically before generating the graph. This ensures:Example
Before this change, jobs added in the order
[zebra, apple, banana]would generate:After this change, the same jobs now generate:
Changes
GenerateMermaidGraph()to create a sorted copy of job names usingsort.Strings()Testing
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.