-
Notifications
You must be signed in to change notification settings - Fork 23
chore(deps): Bump openjd-model to 0.7.1 and openjd-sessions to 0.5.8 #363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: mainline
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -405,3 +405,69 @@ def test_json_explicit(self) -> None: | |
| def test_invalid_yaml_raises(self) -> None: | ||
| with pytest.raises(DecodeValidationError): | ||
| decode_environment_template_str(": not a mapping") | ||
|
|
||
|
|
||
| class TestStepEnvironmentNameScope(object): | ||
| """A Step Environment's ``name`` is scoped to the Step that defines it (Template | ||
| Schemas §3 StepTemplate, §4 Environment): unique within that Step's list, and | ||
| distinct from every Job Environment. Different Steps may reuse a name. | ||
|
|
||
| openjd-model 0.7.1 (openjd-rs#381) relaxed an over-strict check that held every | ||
| environment name in the template in one set, so the second Step to declare | ||
| ``StepEnv`` was rejected. The v0 path always accepted this; this is the v1 path, | ||
| which had no coverage. | ||
| """ | ||
|
|
||
| @staticmethod | ||
| def _environment(name: str) -> dict[str, Any]: | ||
| return { | ||
| "name": name, | ||
| "script": {"actions": {"onEnter": {"command": "echo", "args": [name]}}}, | ||
| } | ||
|
|
||
| @classmethod | ||
| def _step(cls, name: str, environment_names: list[str]) -> dict[str, Any]: | ||
| return { | ||
| "name": name, | ||
| "stepEnvironments": [cls._environment(n) for n in environment_names], | ||
| "script": {"actions": {"onRun": {"command": "echo", "args": [name]}}}, | ||
| } | ||
|
|
||
| @classmethod | ||
| def _template(cls, steps: list[dict[str, Any]]) -> dict[str, Any]: | ||
| return { | ||
| "specificationVersion": "jobtemplate-2023-09", | ||
| "name": "T", | ||
| "jobEnvironments": [cls._environment("JobEnv")], | ||
| "steps": steps, | ||
| } | ||
|
|
||
| def test_same_name_across_steps_is_accepted(self) -> None: | ||
| """Four Steps each declare ``StepEnv``. Only one Step's environments are ever | ||
| active in a Session, so these names never collide.""" | ||
| template = self._template([self._step(f"Step{i}", ["StepEnv"]) for i in range(4)]) | ||
| job_template = decode_job_template(template=template, supported_extensions=[]) | ||
| names = [[e.name for e in (s.step_environments or [])] for s in job_template.steps] | ||
| assert names == [["StepEnv"]] * 4 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Upstream #381 carried a second behavior change that this PR neither mentions nor covers: From the upstream PR body: " That limit is reachable from this repo — it is a public Searching A test in this class would pin it, reusing the helpers already here (4 steps x def test_max_env_count_counts_repeated_names_separately(self) -> None:
template = self._template([self._step(f"Step{i}", ["StepEnv"]) for i in range(4)])
with pytest.raises(ModelValidationError):
decode_job_template(
template=template,
supported_extensions=[],
caller_limits=CallerLimits(max_env_count=4),
)( |
||
|
|
||
| def test_duplicate_within_one_step_is_rejected(self) -> None: | ||
| """Control for §3 rule 1: the per-Step uniqueness check must survive the relaxation.""" | ||
| template = self._template( | ||
| [self._step("Step0", ["StepEnv"]), self._step("Step1", ["StepEnv", "StepEnv"])] | ||
| ) | ||
| with pytest.raises(ModelValidationError) as excinfo: | ||
| decode_job_template(template=template, supported_extensions=[]) | ||
| message = str(excinfo.value) | ||
| assert "steps[1] -> stepEnvironments[1]" in message | ||
| assert "duplicate environment name: 'StepEnv'" in message | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The two control tests here cover the §3 per-Step rule and the Step-vs-Job rule, but not the rule most at risk from this particular relaxation: uniqueness within Upstream #381 relaxed a check that "held every environment name in the template in one set". Collapsing that single set is exactly the kind of change that can drop the job-level duplicate check along with the cross-step one, and there is currently no v1 coverage of it — grepping A third control would close that: def test_duplicate_job_env_names_is_rejected(self) -> None:
template = self._template([self._step("Step0", ["StepEnv"])])
template["jobEnvironments"] = [self._environment("JobEnv"), self._environment("JobEnv")]
with pytest.raises(ModelValidationError):
decode_job_template(template=template, supported_extensions=[]) |
||
|
|
||
| def test_step_env_named_like_job_env_is_rejected(self) -> None: | ||
| """Control for §3 rule 2: a Step Environment may not reuse a Job Environment name.""" | ||
| template = self._template( | ||
| [self._step("Step0", ["StepEnv"]), self._step("Step1", ["JobEnv"])] | ||
| ) | ||
| with pytest.raises(ModelValidationError) as excinfo: | ||
| decode_job_template(template=template, supported_extensions=[]) | ||
| message = str(excinfo.value) | ||
| assert "steps[1] -> stepEnvironments[0]" in message | ||
| assert "duplicate environment name: 'JobEnv'" in message | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These assertions newly pin v1 error text for the step-vs-job rule that does not match the v0 reference — worth a deliberate decision rather than being locked in as a side effect of a dependency bump. AGENTS.md:176-180 ("Test Quality Standard") states the goal is that failure messages "match the pure-Python reference where one exists", and that "the Rust bindings reproduce the same format" as pydantic's path-prefixed output. For this specific rule the two diverge on both halves of what is asserted here:
If the divergence is intended, a note in the class docstring would keep the next reader from reading these as parity assertions. If not, it is a real gap to file — but pinning the current strings in a test makes it harder to notice later. |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Process note on release visibility: this bump is a user-visible validation relaxation — a template where two Steps each declare a
stepEnvironmentnamedStepEnvwas rejected on the v1 path and now decodes — but it is very likely to ship with no changelog entry describing it.[tool.semantic_release.commit_parser_options]listschoreinpatch_tags, so achore(deps):subject does bump the version. But.semantic_release/CHANGELOG.md.j2only renders thebreaking,features,bug fixes, andperformance improvementselement groups — there is nochoresection, so achore-typed commit produces a release with nothing written about it. That is the observed history: #349 (chore(deps): Bump openjd-* Rust crates to the 0.6.0 release) appears in neither the 0.11.8 nor the 0.11.9 CHANGELOG section. The 0.11.11 entry for #359 exists only because its text was hand-written (it carries no commit-hash link, unlike every template-generated line).Since this bump changes what templates are accepted rather than just refreshing a pin, consider a
fix:-typed subject so the behavior change lands in the released notes on its own. The relaxation is exactly the kind of thing a downstream consumer pinning this library would want to read in the changelog.