fix!: require attribute and amount names to be unique#265
Merged
crowecawcaw merged 2 commits intoOpenJobDescription:mainlinefrom Mar 4, 2026
Merged
Conversation
Signed-off-by: Stephen Crowe <6042774+crowecawcaw@users.noreply.github.com>
leongdl
reviewed
Mar 3, 2026
| pytest.param( | ||
| { | ||
| "amounts": [ | ||
| {"name": "amount.mycap", "min": 1}, |
There was a problem hiding this comment.
Does the openjd spec allow this or specify properties w/ different cases are duplicates ?
There was a problem hiding this comment.
Trying to find it in the spec and it escapes me right now.
Contributor
Author
There was a problem hiding this comment.
leongdl
approved these changes
Mar 4, 2026
mwiebe
approved these changes
Mar 4, 2026
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What was the problem/requirement? (What/Why)
The amount and attribute names in host requirements are not required to be unique at the moment; duplicate names are allowed. Multiple requirements with the same name is non-sensical though and should be rejected.
Related OpenJD spec PR: OpenJobDescription/openjd-specifications#110
While updating the test, I noticed existing test was incorrectly set up and testing the wrong data model. Since the test just looked for failures, the test passed but the validation failures were for the wrong reason. I made the test more specific to ensure it's testing what we think we're testing.
There are other tests that make similar mistakes and will also need to be updated. Future work.
What was the solution? (How)
Reject a template if a step's host requirements has duplicated attribute or amount names.
What is the impact of this change?
Closes a undefined behavior gap.
How was this change tested?
Unit tests
Was this change documented?
n/a
Is this a breaking change?
Technically yes, but practically no. Duplicated requirements do not have a clear behavior, and templates with duplicates are likely buggy. Marking the PR with
fix!to indicate a minor version bump is recommended.Does this change impact security?
No
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.