Skip to content

DYN-9970 Fix Documentation Browser breadcrumb collision#17067

Merged
RobertGlobant20 merged 3 commits intomasterfrom
DYN-9970-FixingLibrary-Group-DocumentationB
Apr 22, 2026
Merged

DYN-9970 Fix Documentation Browser breadcrumb collision#17067
RobertGlobant20 merged 3 commits intomasterfrom
DYN-9970-FixingLibrary-Group-DocumentationB

Conversation

@RobertGlobant20
Copy link
Copy Markdown
Contributor

Purpose

Fix Documentation Browser breadcrumb collision for String node

Updated breadcrumb resolution in DocumentationBrowserViewModel.cs to prefer exact suffix matches (for example .String) before falling back to broad substring matching. Prevents String node docs from incorrectly resolving to Input/DateTime via DateTime.FromString. Added regression test in DocumentationBrowserViewExtensionTests.cs to verify StringInput shows Input/Basic breadcrumbs and not DateTime.

It only changes ambiguous cases where substring collisions existed (like String matching DateTime.FromString). In those cases, it now picks the more precise match.

Declarations

Check these if you believe they are true

Release Notes

Fix Documentation Browser breadcrumb collision for String node

Reviewers

@aparajit-pratap @QilongTang @jasonstratton

FYIs

Fix Documentation Browser breadcrumb collision for String node

Updated breadcrumb resolution in DocumentationBrowserViewModel.cs to prefer exact suffix matches (for example .String) before falling back to broad substring matching.
Prevents String node docs from incorrectly resolving to Input/DateTime via DateTime.FromString.
Added regression test in DocumentationBrowserViewExtensionTests.cs to verify StringInput shows Input/Basic breadcrumbs and not DateTime.

It only changes ambiguous cases where substring collisions existed (like String matching DateTime.FromString). In those cases, it now picks the more precise match.
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

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-9970

@RobertGlobant20
Copy link
Copy Markdown
Contributor Author

GIF showing the expected behavior for the String node.
DocumentationBrowserString

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes incorrect Documentation Browser breadcrumb resolution for nodes whose names collide as substrings of other node keys (e.g., "String" matching "DateTime.FromString"), by prioritizing exact key-suffix matches before falling back to substring matching.

Changes:

  • Update DocumentationBrowserViewModel.GetBreadCrumbsValue to prefer keys ending in ".{OriginalName}" (e.g., Input.String) before using Contains.
  • Add a regression test ensuring CoreNodeModels.Input.StringInput resolves to Input / Basic instead of Input / DateTime in an ambiguous dictionary.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/DocumentationBrowserViewExtension/DocumentationBrowserViewModel.cs Adjusts breadcrumb lookup order to avoid substring collisions by preferring exact suffix matches.
test/DynamoCoreWpf2Tests/ViewExtensions/DocumentationBrowserViewExtensionTests.cs Adds regression coverage for the String node breadcrumb collision scenario.

Comment on lines +909 to +915
var method = typeof(DocumentationBrowserViewModel).GetMethod(
"GetBreadCrumbsValue",
BindingFlags.NonPublic | BindingFlags.Instance);

// Act
var breadCrumbs = method.Invoke(docsViewModel, new object[] { nodeAnnotationEventArgs }) as string;

Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

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

The test uses reflection to invoke the private GetBreadCrumbsValue method, but it doesn’t assert that GetMethod actually found it. If the method is renamed/overloaded or its accessibility changes, this will fail with a NullReferenceException at Invoke and be harder to diagnose. Add an explicit Assert.IsNotNull(method, ...) (or Assert.Fail) before invoking.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fix applied in the next commit: 75e48c0

@sonarqubecloud
Copy link
Copy Markdown

Address PR review feedback

- Added Assert.IsNotNull guard on reflected GetBreadCrumbsValue method
  before Invoke to produce a clear diagnostic if the method is renamed
- Replaced suffix-match foreach loop with LINQ FirstOrDefault and
  idiomatic KeyValuePair.Key != null check
@zeusongit
Copy link
Copy Markdown
Contributor

@RobertGlobant20
Copy link
Copy Markdown
Contributor Author

Hi Team, any comments in this PR?

@RobertGlobant20 RobertGlobant20 merged commit 187a170 into master Apr 22, 2026
28 of 29 checks passed
@RobertGlobant20 RobertGlobant20 deleted the DYN-9970-FixingLibrary-Group-DocumentationB branch April 22, 2026 16:01
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