Repository navigation
test: adapt StepScript de-sugaring tests to openjd-model 0.11.9 #1085
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -406,22 +406,24 @@ def test_a_bash_sugar_step_runs_and_resolves_its_own_let( | |
| assert state == ActionState.SUCCESS | ||
| assert any("BASH:hello from bash" in m for m in caplog.messages) | ||
|
|
||
| def test_step_and_sugar_scope_let_both_resolve_through_the_fold( | ||
| def test_step_and_sugar_scope_let_both_resolve( | ||
| self, tmp_path: Path, caplog: pytest.LogCaptureFixture | ||
| ) -> None: | ||
| """Both scopes of a sugar template resolve, via the fold alone. | ||
|
|
||
| ``resolve_syntax_sugar()`` folds the step's ``let`` into the script's own | ||
| as ``[*step lets, *simple-action lets]``, so the de-sugared script | ||
| carries both scopes in RFC 0005 order and a sugar-scope binding can | ||
| reference a step-scope one. This is the only thing that resolves the | ||
| step's scope on this path -- nothing else re-applies it. | ||
| """Both scopes of a sugar template resolve, via two channels. | ||
|
|
||
| Under openjd-model >=0.11.9 the step's ``let`` no longer folds into the | ||
| de-sugared ``script.let``; it travels via ``resolvedSymbolTable`` | ||
| instead. ``resolve_syntax_sugar()`` still synthesizes the script | ||
| structure and folds in the sugar-scope ``let``, so a sugar-scope binding | ||
| (``out``) can reference a step-scope one (``base``) once ``base`` is | ||
| served in the resolved table. | ||
| """ | ||
| caplog.set_level(logging.INFO) | ||
| details = _bash_sugar_step_details( | ||
| step_let=["base = 'from step'"], | ||
| sugar_let=["out = base + '|sugar'"], | ||
| script_body='echo "OUT:{{ out }}"', | ||
| resolved_symbol_table=[{"name": "base", "type": "string", "value": "from step"}], | ||
|
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. Adding After this change, in
So nothing exercises For comparison, |
||
| ) | ||
| assert details.step_template.script is None | ||
|
|
||
|
|
||
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.
The dependency floor should be raised to
>= 0.11.9to match what this PR now relies on.The comment directly above states that
resolve_syntax_sugar()'s fold behaviour changed in openjd-model 0.11.9, and both the docstring inrun_step_task.pyand the assertions intest_run_step_task.py/test_step_scope_let_end_to_end.pynow encode the post-0.11.9 contract. But the specifier still admits0.11.4through0.11.8, where the fold still emits[*step lets, *simple-action lets]. Against any of those versions:test_start_de_sugars_a_bash_stepfails outright (step_script.letwould be["base = 'from step'", "msg = base"], not["msg = base"]).resolvedSymbolTableand as source expressions re-evaluated by the session — which is exactly the unverified double-declaration hazard the removed docstring paragraph described. The new docstring asserts "those names no longer arrive twice", which is false for a resolvable version in the current range.Note this is the same shape of coupling the
openjd-sessions == 0.12.0pin just above documents ("this pin and the code change in this PR must ship together"). Suggest"openjd-model >= 0.11.9, < 0.12", and updating the comment to say the floor was raised for this reason rather than that no floor change is needed.