Skip to content

feat: add test 6.1.57, 58#491

Closed
peinjoh wants to merge 9 commits intomainfrom
feat/test-6-1-57-58
Closed

feat: add test 6.1.57, 58#491
peinjoh wants to merge 9 commits intomainfrom
feat/test-6-1-57-58

Conversation

@peinjoh
Copy link
Copy Markdown
Contributor

@peinjoh peinjoh commented Mar 17, 2026

Resolves #486 #485
This PR:

  • adds a new recursive method on the product tree to depth-first visit all leaf nodes with backtracking to collect their paths
  • adds test 6.1.57 and 6.1.58
  • adds display for the "merged" branch categories on the trait (used for debugging during development, but is also required on the lib api, so I'm leaving it in)

Their is some functional overlap between visit_all_branches and collect_all_leaves, and this could be generalized into a generic tree visitor with a pre-visit and post-visit callback. We should consider that if more similar functionality of the product tree becomes necessary, but IMO it would be overengineered for now.

@peinjoh peinjoh requested a review from a team as a code owner March 17, 2026 07:25
@peinjoh peinjoh linked an issue Mar 17, 2026 that may be closed by this pull request
@peinjoh peinjoh requested a review from Copilot March 17, 2026 07:26
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

Adds CSAF 2.1 validator implementations for test cases 6.1.57 and 6.1.58 by introducing a reusable product-tree traversal helper that enumerates all root-to-leaf paths, and wiring the new validations into the validations module.

Changes:

  • Added ProductTreeTrait::collect_leaf_paths() (and recursive helper on BranchTrait) to depth-first collect root→leaf branch paths plus JSON instance paths.
  • Implemented validations for 6.1.57 (stacked branch categories) and 6.1.58 (product_version + product_version_range in same path), including unit tests.
  • Extended CategoryOfTheBranch with Hash derivation and a Display impl to support hashing and readable error messages.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.

File Description
csaf-rs/src/validations/test_6_1_57.rs New validation for stacked branch categories using collected leaf paths + associated tests.
csaf-rs/src/validations/test_6_1_58.rs New validation preventing product_version and product_version_range in the same path + associated tests.
csaf-rs/src/validations/mod.rs Exposes the new validation modules.
csaf-rs/src/csaf_traits.rs Adds leaf-path collection traversal, plus Hash/Display on CategoryOfTheBranch.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread csaf-rs/src/validations/test_6_1_58.rs Outdated
Comment thread csaf-rs/src/validations/test_6_1_58.rs Outdated
Comment thread csaf-rs/src/csaf_traits.rs Outdated
Comment thread csaf-rs/src/csaf_traits.rs Outdated
Comment thread csaf-rs/src/csaf_traits.rs Outdated
Comment thread csaf-rs/src/validations/test_6_1_57.rs
Comment thread csaf-rs/src/validations/test_6_1_57.rs
@peinjoh peinjoh marked this pull request as draft March 17, 2026 13:13
@peinjoh peinjoh marked this pull request as draft March 17, 2026 13:13
@peinjoh peinjoh marked this pull request as ready for review March 30, 2026 13:36
@peinjoh
Copy link
Copy Markdown
Contributor Author

peinjoh commented Mar 30, 2026

Abandoned after merge fail. Continued on #508

@peinjoh peinjoh closed this Mar 30, 2026
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.

Implement 6.1.58 Use of product_version in one Path with product_version_range for CSAF 2.1 Implement 6.1.57 Stacked Branch Categories for CSAF 2.1

2 participants