fix: check resolved host requirement capability names at job creation - #371
Merged
mwiebe merged 1 commit intoSep 25, 2026
Merged
Conversation
The capability name constraints and the uniqueness of names within hostRequirements amounts and attributes apply to the names after their format strings are resolved (OpenJobDescription/openjd-specifications#189). Template validation only compares the raw names, so two different format strings that resolved to the same name, or a name that resolved to more than 100 characters, created a job. Check the 100-character limit on the resolved amount and attribute names, and the case-insensitive uniqueness of the resolved names, when the job is created. The messages match the ones for literal names. Signed-off-by: Mark <399551+mwiebe@users.noreply.github.com>
leongdl
approved these changes
Sep 25, 2026
mwiebe
enabled auto-merge (rebase)
September 25, 2026 00:34
jericht
approved these changes
Sep 25, 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.
Fixes: OpenJobDescription/openjd-specifications#189
What was the problem/requirement? (What/Why)
OpenJobDescription/openjd-specifications#189 records that a host requirement amount or attribute
nameis a format string, and that its constraints apply to the resolved name. That includes the 100-character limit and the rule that no two amounts, and no two attributes, share a name.Template validation only checks the raw names, and job creation didn't re-check the resolved ones. So a job was created in two cases:
{{Param.A}}and{{Param.B}}both resolving toattr.custom.x;Four of the new conformance fixtures in openjd-specifications#189 fail because of this.
What was the solution? (How)
At job creation, in the pure-Python model:
AmountRequirementandAttributeRequirementcheck the 100-character limit on the resolved name.HostRequirementschecks that resolved names are unique withinamountsand withinattributes, ignoring case.The error messages are the same ones already produced for literal names.
What is the impact of this change?
Job creation now rejects templates whose host requirement names, once resolved, are too long or duplicated. Templates that previously created a valid job are unaffected.
How was this change tested?
Added tests in
test/openjd/model_v0/test_create_job.pythat assert the full error message for:They also cover the valid boundary: distinct resolved names, and names that resolve to exactly 100 characters.
The full test suite passes (
hatch run testequivalent, 94% coverage gate met), andblack,ruffandmypyare clean.Ran the conformance suite from openjd-specifications#189 with
openjd-cliusing this build ofopenjd-model:Was this change documented?
Yes. The new checks have comments that reference the spec sections.
Is this a breaking change?
No. Templates that are only rejected now could never have produced a job that satisfies the specification.
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.