Skip to content

DYN-9702: Fix flaky PackageLoaderTests broken by shipped definitions folder#17222

Merged
jasonstratton merged 1 commit into
masterfrom
DYN-9702-fix-packageinfo-null-guard
Jul 15, 2026
Merged

DYN-9702: Fix flaky PackageLoaderTests broken by shipped definitions folder#17222
jasonstratton merged 1 commit into
masterfrom
DYN-9702-fix-packageinfo-null-guard

Conversation

@RobertGlobant20

@RobertGlobant20 RobertGlobant20 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Purpose

DYN-9702 (#17201) added a shipped definitions/ folder (containing Curve_Validate.dyf) and changed PathManager.DefinitionDirectories to include the common definitions directory. As a result, Curve_Validate.dyf is now loaded at model startup as a non-package custom node, leaving PackageInfo == null in CustomNodeManager.NodeInfos.

Two tests iterate all of NodeInfos with an unguarded x.Value.PackageInfo.Equals(packageInfo) predicate, which throws a NullReferenceException on the non-package node:

  • LoadingCustomNodeFromPackageSetsNodeInfoPackageInfoCorrectly
  • PlacingCustomNodeInstanceFromPackageRetainsCorrectPackageInfoState

The DYN-9702 change made the failure deterministic in CI whenever the definitions folder is present. This PR null-guards the comparison so non-package nodes are skipped before Equals is called.

Declarations

Check these if you believe they are true

Release Notes

N/A -- test-only fix; no user-facing or behavioral change.

Reviewers

(FILL ME IN) Reviewer 1

FYIs

(FILL ME IN, Optional)

🤖 Generated with Claude Code

The shipped definitions folder (added in DYN-9702) now loads Curve_Validate.dyf
as a non-package custom node at model startup, leaving PackageInfo null in
CustomNodeManager.NodeInfos. The LINQ predicates in
LoadingCustomNodeFromPackageSetsNodeInfoPackageInfoCorrectly and
PlacingCustomNodeInstanceFromPackageRetainsCorrectPackageInfoState called
PackageInfo.Equals on every entry, throwing a NullReferenceException on the
non-package node and failing both tests deterministically.

Add a null guard so non-package nodes are skipped before the Equals comparison.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 15, 2026 18:34

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

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.

Pull request overview

This PR fixes deterministic flakiness in PackageLoaderTests caused by shipped (non-package) custom node definitions being loaded at model startup. Specifically, it prevents NullReferenceException when tests iterate CustomNodeManager.NodeInfos and encounter nodes whose PackageInfo is null.

Changes:

  • Added a null guard around PackageInfo.Equals(packageInfo) in LoadingCustomNodeFromPackageSetsNodeInfoPackageInfoCorrectly.
  • Added the same null guard in PlacingCustomNodeInstanceFromPackageRetainsCorrectPackageInfoState (both initial query and post-placement re-query).

@sonarqubecloud

Copy link
Copy Markdown

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

Perfect! Thank you!

Approved and will merge. I'll make a couple minor changes to the PR description too.

@jasonstratton

Copy link
Copy Markdown
Contributor

I'll wait for the SelfServe to complete before merging

@jasonstratton

Copy link
Copy Markdown
Contributor

Tidied the description on a maintainer's request: dropped the cross-reference to #17221 (being closed as a duplicate of this PR), removed the 'fails randomly' note, and pointed the Jira link at autodesk.atlassian.net. The fix itself is untouched.

@jasonstratton
jasonstratton merged commit f60beb5 into master Jul 15, 2026
37 of 38 checks passed
@jasonstratton
jasonstratton deleted the DYN-9702-fix-packageinfo-null-guard branch July 15, 2026 20:32
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.

3 participants