Skip to content

projects: show ancestor path#5827

Draft
valentijnscholten wants to merge 4 commits intoDependencyTrack:masterfrom
valentijnscholten:ancestor-path
Draft

projects: show ancestor path#5827
valentijnscholten wants to merge 4 commits intoDependencyTrack:masterfrom
valentijnscholten:ancestor-path

Conversation

@valentijnscholten
Copy link
Contributor

@valentijnscholten valentijnscholten commented Feb 19, 2026

Description

When searching for projects/components/vulnerabilities there's no visual indication of where in the Project Hierarchy a project is shown.

Addressed Issue

(partly) fixes #1353, #1362

Additional Details

In v4 we need to do perform some additional java code to get the "ancestor path" populated. But in v5 this will be easier due to the materialized view being used there. Happy to forward port the feature to v5.

I haven't created tests yet as I first would like to get confirmation this is something that can be added to v4. I know v5 is around the corner. At the same it might take some time before v5 is released as GA and everybody has moved over. This PR fixes a real need in v4.

FrontEnd companion PR: DependencyTrack/frontend#1448

Considerations

Having the full hierarchy view when displaying ony a subset/searchresult of projects is non-trivial to implement if we take features such as paging into account. Maybe for v5 someone has a better proposal, for now an additional column seems helpful in v4.

Checklist

  • I have read and understand the contributing guidelines
  • This PR fixes a defect, and I have provided tests to verify that the fix is effective
  • This PR implements an enhancement, and I have provided tests to verify that it works as intended
  • This PR introduces changes to the database model, and I have added corresponding update logic
  • This PR introduces new or alters existing behavior, and I have updated the documentation accordingly
Screenshot 2026-02-01 200245 Screenshot 2026-02-01 200227

@owasp-dt-bot
Copy link

owasp-dt-bot commented Feb 19, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@codacy-production
Copy link

codacy-production bot commented Feb 19, 2026

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+0.15% (target: -1.00%) 94.77% (target: 70.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (9d012bd) 24524 19953 81.36%
Head commit (eb65130) 24894 (+370) 20291 (+338) 81.51% (+0.15%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#5827) 153 145 94.77%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Signed-off-by: Valentijn Scholten <valentijnscholten@gmail.com>
…endpoints

- Nest all parents inside the parent block (parent.parent...) in API responses
- Add parent to @JsonIncludeProperties for recursive serialization
- Wire parent chain in populateAncestorPaths for nested structure
- Populate ancestor path on single-project getProject endpoints (uuid, lookup, latest)
- Add tests for nested parent chain and ancestor path across detail endpoints

Signed-off-by: Valentijn Scholten <valentijnscholten@gmail.com>
- Remove ancestorPath and AncestorPathElement from Project model
- Replace with nested parent (parent.parent...) for hierarchy
- Add ProjectParentInfo for AffectedProject parent chain
- Update AffectedProject to use parent instead of ancestorPath
- Rename buildAncestorPathFromMap to buildParentChainFromMap
- Update tests to assert parent chain only

Signed-off-by: Valentijn Scholten <valentijnscholten@gmail.com>
@valentijnscholten
Copy link
Contributor Author

valentijnscholten commented Mar 3, 2026

@nscuro I have now refactored both PRs to show the ancestor path as tooltip instead of column. Not perfect, but better than nothing and maybe good to be accepted. I've also refactored the api reponse to just return the chain of parents in the parent block instead of a new ancestor path element.

Global Policy Audit doesn't have the full parent chain as that endpoint returned detached JDO Object which only have the direct parent. If we all like the tooltip approach and/or the parent chain response format I could look at refactoring this endpoint to use value objects instead of detached objects.

Plot twist: Should we just render the tooltip on the fly using an API call for that view (or all views)? (To avoid having to build the full parent chain in the backend for every api response containing projects)

Signed-off-by: Valentijn Scholten <valentijnscholten@gmail.com>
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.

2 participants