DYN-10569: Only warn on Python port removal when the port has custom properties - #17313
Merged
Merged
Conversation
The "Remove Port?" dialog warned that custom port properties would be lost on every input-port removal from a Python Script node, including freshly added ports that had never been modified. This created friction and implied changes existed where none did. Add PythonNodeBase.HasCustomInputPortProperties(int), which compares a port's live Name and ToolTip against the generated defaults for its index, and gate the dialog on it. Removal always targets the last input port, so only that port is inspected; this also suppresses the prompt when no port remains to remove. The helper is internal, so no public API surface changes. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
There was a problem hiding this comment.
See the ticket for this pull request: https://jira.autodesk.com/browse/DYN-10569
edwin-vasquez-ucaldas
approved these changes
Aug 27, 2026
Contributor
|
@koeylai-adsk Merged! |
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.



Purpose
DYN-10569: The "Remove Port?" confirmation dialog warned that "Your custom port
properties will be lost once the port is removed" on every input-port removal
from a Python Script node — including freshly added ports that had never been
modified. This created friction and implied changes existed where none did.
The dialog is now gated on whether the port actually carries user customizations.
Key changes:
PythonNodeBase.HasCustomInputPortProperties(int index)insrc/Libraries/PythonNodeModels/PythonNode.cs. Compares the port's liveNameand
ToolTipagainst the generated defaults (GetInputName/GetInputTooltip)for that index; any difference means the user renamed the port or edited its
description via the port context menu's Rename Port dialog.
src/DynamoCoreWpf/Controls/DynamoNodeButton.csconsults it before prompting.Removal always targets the last input port, so only that port is inspected.
This also suppresses the prompt when there is no port left to remove
(previously the dialog appeared even though nothing would be removed).
No public API surface changed — the new member is
internal, reachable fromDynamoCoreWpfand the test assemblies through existingInternalsVisibleToattributes.
PublicAPI.Unshipped.txtis therefore untouched, confirmed by aCI-parity build (
Release+ public-API analyzers) reporting no RS0016/RS0017.Known limitation, documented in-code: the index-to-default mapping holds for
PythonNodeonly.PythonStringNodeprepends a fixedscriptport and overridesGetInputIndex()to subtract one, so its ports are offset. It is unaffected herebecause the caller narrows to
is PythonNode, and its pre-existing behaviour(never warning on removal) is unchanged. Widening the type test would require
correcting the mapping first.
Testing:
test/Libraries/DynamoPythonTests/PythonEditTests.cs— 9 tests / 15 cases overthe helper: unmodified, renamed, description-only, case-only edits, out-of-range
and zero-port indices, and save/reload round-trips.
test/DynamoCoreWpfTests/PythonNodeRemovePortWarningTests.cs(new) — 6 testsdriving the real
-button on a realizedNodeViewwith a mockedMessageBoxService.IMessageBox, covering: no prompt for an unmodified port,prompt for a renamed or re-described port, correct port targeting when an
earlier port is the customized one, and that Cancel aborts the removal.
Declarations
Check these if you believe they are true
Release Notes
Removing an unmodified input port from a Python Script node no longer shows the
"Remove Port?" confirmation dialog; the warning now appears only when the port has
a custom name or description that would be lost.
🤖 Generated with Claude Code