Skip to content

DYN-10569: Only warn on Python port removal when the port has custom properties - #17313

Merged
jasonstratton merged 2 commits into
masterfrom
DYN-10569-python-port-removal-warning
Aug 27, 2026
Merged

DYN-10569: Only warn on Python port removal when the port has custom properties#17313
jasonstratton merged 2 commits into
masterfrom
DYN-10569-python-port-removal-warning

Conversation

@koeylai-adsk

Copy link
Copy Markdown
Contributor

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:

  • New PythonNodeBase.HasCustomInputPortProperties(int index) in
    src/Libraries/PythonNodeModels/PythonNode.cs. Compares the port's live Name
    and ToolTip against 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.cs consults 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 from
DynamoCoreWpf and the test assemblies through existing InternalsVisibleTo
attributes. PublicAPI.Unshipped.txt is therefore untouched, confirmed by a
CI-parity build (Release + public-API analyzers) reporting no RS0016/RS0017.

Known limitation, documented in-code: the index-to-default mapping holds for
PythonNode only. PythonStringNode prepends a fixed script port and overrides
GetInputIndex() to subtract one, so its ports are offset. It is unaffected here
because 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 over
    the 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 tests
    driving the real - button on a realized NodeView with a mocked
    MessageBoxService.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

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>
@sonarqubecloud

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

See the ticket for this pull request: https://jira.autodesk.com/browse/DYN-10569

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@jasonstratton jasonstratton 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.

LGTM

@jasonstratton
jasonstratton merged commit c63f4c5 into master Aug 27, 2026
33 checks passed
@jasonstratton
jasonstratton deleted the DYN-10569-python-port-removal-warning branch August 27, 2026 22:48
@jasonstratton

Copy link
Copy Markdown
Contributor

@koeylai-adsk Merged!

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.

4 participants