Skip to content

Conversation

@clarktsiory
Copy link
Contributor

@clarktsiory clarktsiory commented Nov 13, 2025

https://issues.rudder.io/issues/25061

Adding the implementation that was marked as a TODO comment : save the tree of RuleCategory in the exported archive under rule-categories.json, and be able to import the same JSON file, and create/move categories accordingly.

In tests :

  • I completed the existing API calls with the new category
  • I have added specific tests for the import, which is a critical piece of code since it is recursive and non-trivial

By adding the latter, I identified some inconsistency in the test implementation, that will need a following PR

@clarktsiory clarktsiory force-pushed the bug_25061/archive_api_for_import_export_doesn_t_know_about_rule_categories branch from 686e68d to 5a5748b Compare November 13, 2025 17:41
@clarktsiory
Copy link
Contributor Author

Commit modified

@clarktsiory clarktsiory force-pushed the bug_25061/archive_api_for_import_export_doesn_t_know_about_rule_categories branch from 5a5748b to b6353f0 Compare November 14, 2025 15:10
@clarktsiory
Copy link
Contributor Author

Commit modified

@clarktsiory clarktsiory force-pushed the bug_25061/archive_api_for_import_export_doesn_t_know_about_rule_categories branch from b6353f0 to 5a2f406 Compare November 21, 2025 13:08
@clarktsiory
Copy link
Contributor Author

Commit modified

@clarktsiory clarktsiory force-pushed the bug_25061/archive_api_for_import_export_doesn_t_know_about_rule_categories branch from 5a2f406 to b945333 Compare November 24, 2025 17:33
@clarktsiory
Copy link
Contributor Author

Commit modified

Comment on lines +108 to +120
test("move nested rule category2")(
withCtx(_.save(policyArchiveRuleCategory(rootRuleCategoryWithSubcat2), MergePolicy.KeepRuleTargets))(root => {
// the expected value is wrong : the test Repo does something unexpected, it leads to multiple categories with same ID, and the root is moved.
// for now, check that the "rootRuleCategory" effectively contains the expected format
assertTrue(
root
.find(rootRuleCategory.id)
.map(_._1)
.getOrElse(rootRuleCategory)
.transformInto[JRuleCategories] == rootRuleCategoryWithSubcat2.transformInto[JRuleCategories]
)
})
)
Copy link
Contributor Author

@clarktsiory clarktsiory Nov 25, 2025

Choose a reason for hiding this comment

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

this is problematic in tests : the test ruleCategoryRepo is not behaving the same as the LDAP one, we will need to correct this and add tests in another PR
(#6743)

@clarktsiory clarktsiory requested a review from fanf November 25, 2025 09:24
@clarktsiory clarktsiory marked this pull request as ready for review November 25, 2025 09:24
Copy link
Member

@fanf fanf left a comment

Choose a reason for hiding this comment

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

Work great ! I was able to create a new category and move a rule in it just with an import :)

@Normation-Quality-Assistant
Copy link
Contributor

OK, merging this PR

@Normation-Quality-Assistant Normation-Quality-Assistant merged commit 39d589b into Normation:branches/rudder/8.3 Nov 28, 2025
20 checks passed
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