fix: subgraph create should deduplicated bindings on name conflict#2110
Open
Conversation
🎩 PreviewA preview build has been created at: |
Collaborator
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
This was referenced Apr 22, 2026
Mbeaulne
approved these changes
Apr 22, 2026
camielvs
reviewed
Apr 22, 2026
Comment on lines
+290
to
+300
| function deduplicatePortName(baseName: string, usedNames: Set<string>): string { | ||
| if (!usedNames.has(baseName)) { | ||
| usedNames.add(baseName); | ||
| return baseName; | ||
| } | ||
| let counter = 2; | ||
| while (usedNames.has(`${baseName}_${counter}`)) counter++; | ||
| const unique = `${baseName}_${counter}`; | ||
| usedNames.add(unique); | ||
| return unique; | ||
| } |
Collaborator
There was a problem hiding this comment.
could this run into conflicts if the a port(s) already have names in the form name_number?
Collaborator
There was a problem hiding this comment.
I think the while loop may catch this. but worth keeping an eye out once in the wild
camielvs
approved these changes
Apr 22, 2026
Collaborator
camielvs
left a comment
There was a problem hiding this comment.
Issue appears to be fixed.
This was referenced Apr 23, 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.

Description
Closes #2123
Fixes two bugs in the
createSubgraphaction and adds comprehensive roundtrip tests to verify correctness ofcreateSubgraphfollowed byunpackSubgraph.Bug 1 – Duplicate port names when grouping external bindings: When multiple external bindings targeted different selected tasks but shared the same port name (e.g., two tasks both receiving a
trainer_nameinput), the subgraph would generate duplicate input/output port names. AdeduplicatePortNamehelper is introduced to append a numeric suffix (_2,_3, …) when a name collision is detected, preventing ghost or duplicate bindings after an unpack.Bug 2 –
executionOptionsnot preserved through subgraph creation: TaskexecutionOptions(caching strategy, retry strategy, etc.) were not included in the task snapshot taken duringcreateSubgraph, causing them to be silently dropped. The snapshot and task reconstruction now carryexecutionOptionsthrough correctly.Related Issue and Pull requests
Type of Change
Checklist
Test Instructions
The new test suite in
unpackSubgraph.test.tscovers the following scenarios and can be run directly:componentRef.executionOptionswithmaxCacheStaleness,retryStrategy, or both are preserved.isEnabledpredicates are preserved.argumentsare preserved.Additional Comments
The
deduplicatePortNamehelper is intentionally simple: it tries the base name first, then appends_2,_3, etc. This matches the convention used elsewhere in the codebase for name collision resolution.