Skip to content

fix: duplicate uuid issue in test data by adding a new load_valid_model_from_json function - #2142

Open
LAKSHJAIN14 wants to merge 6 commits into
oscal-compass:developfrom
LAKSHJAIN14:fix/dup-uuids-in-test-data
Open

fix: duplicate uuid issue in test data by adding a new load_valid_model_from_json function#2142
LAKSHJAIN14 wants to merge 6 commits into
oscal-compass:developfrom
LAKSHJAIN14:fix/dup-uuids-in-test-data

Conversation

@LAKSHJAIN14

Copy link
Copy Markdown
Contributor

Types of changes

  • Hot fix (emergency fix and release)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Documentation (change which affects the documentation site)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Release (develop -> main)

Summary

As discussed during the community meeting, This is the first PR related to the issue #2089 which fixes all the duplicate uuids in comp_def test files that were there and I have looked if there exists a current check which checks for duplicate uuid and yeah there is a check in /tests/trestle/core/commands/validate_test.py but it doesn't load any of the file from the test data , it loads comp_def using the sample_component_definition pytest fixture and then changes uuid to become duplicate and then check which is sufficent I guess,

There is another file with duplicate uuid which is tests/data/yaml/bad_component_dup_uuid.yaml but I couldn't find any test function using it so i think its a dead data and this file is also there in the issue #2116 ,So I guess we can handle it there.

If these all things seem ok then I could look into the test_utils.load_from_json function and have it also validate like it happens when we do trestle import but I think we could do that in another PR and discuss it there.

@degenaro @vikas-agarwal76

@LAKSHJAIN14
LAKSHJAIN14 requested a review from a team as a code owner March 11, 2026 17:17
Signed-off-by: LAKSHJAIN14 <jainlaksh07@gmail.com>
@LAKSHJAIN14
LAKSHJAIN14 force-pushed the fix/dup-uuids-in-test-data branch from 0da07d2 to 1742e56 Compare March 12, 2026 05:52
Signed-off-by: LAKSHJAIN14 <jainlaksh07@gmail.com>
…the oscal modelis valid or not

Signed-off-by: LAKSHJAIN14 <jainlaksh07@gmail.com>
@LAKSHJAIN14 LAKSHJAIN14 changed the title fix: duplicate uuid in comp_def test files fix: duplicate uuid issue in test data by adding a new load_valid_model_from_json function Mar 13, 2026
@LAKSHJAIN14

Copy link
Copy Markdown
Contributor Author

@degenaro

So added a new load_valid_model_from_json function which checks if the oscal model loading is valid or not and have used it wherever possible and change the name of the previous function load_from_json to load_from_json_without_check.

Couldn't use the new function in some tests where leveraged_ssp or leveraging_ssp was being used as imodel_is_valid function also checks for RuleParametersValidator. This validator needs to check if the rules in your SSP match the rules in the Profile your SSP is based on and since its a dummy test so the linked profile is not there, If we really want the check then we could load the profile and the catalog in each of the functions.

@degenaro

Copy link
Copy Markdown
Collaborator

@LAKSHJAIN14 Please resolve conflicts, thx!

@LAKSHJAIN14

Copy link
Copy Markdown
Contributor Author

resolved the conflicts, PTAL
@degenaro

@degenaro
degenaro force-pushed the develop branch 2 times, most recently from 64cc98c to 4fa5f11 Compare August 7, 2026 11:15
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