Repository navigation
Commit bcd09b5
authored
fix: Forward the create-time step symbol table to openjd-sessions (#237)
* test: Pin declared-extension activation, Job.Name, Step.Name, and enter-failure cleanup
Six behaviours the RFC 0007/0008 CLI work introduced were unpinned: reverting
the template-declared-extensions fix entirely still passed all 307 tests. Each
new test drives a real template through do_run and asserts on observed output.
- Extension behaviours activate only when a template DECLARES the extension,
never from the CLI's --extensions accept-list. A job template declaring no
extensions must not get REDACTED_ENV_VARS even though --extensions defaults
to every supported one. Kills: supported_extensions=extensions in
_run_command (the pre-fix behaviour).
- The declared set is the UNION over the job template and every external
environment template. Only the environment template declares
REDACTED_ENV_VARS, and redaction is active for the whole session. Kills:
dropping the environment-template union loop.
- Job.Name is seeded into the session symbol table, so a step-level EXPR `let`
binding resolves it. Asserts the printed VALUE equals the job's name, so
neither omitting job_name= from Session() nor passing an empty string
satisfies it.
- The step name reaches Session.run_task and feeds WrappedStep.Name inside an
active onWrapTaskRun hook. Asserts the resolved value equals the step's real
name. Kills: passing a wrong constant for step_name.
- Step.Name is out of scope outside a step: a job environment referencing it is
rejected. NOTE this is openjd-model static validation at template-read time,
so it does NOT pin the CLI's non-seeding of step_name on job/external enters
-- no loadable template can observe that, because the same rejection applies
to every environment-template location including RFC 0008 wrap hooks. The
docstring records the limit; the CLI's decision stays pinned only by
test_localsession_step_env_enter_receives_step_name.
- An enter that raises BEFORE the session registers the environment (two
external wrap-hook environments hitting RFC 0008's "at most one") must drop
it from the CLI's entered list, so the real error surfaces instead of a
masking "Cannot exit unknown Environment". Kills: never popping on raise.
Signed-off-by: David Leong <116610336+leongdl@users.noreply.github.com>
* docs: Correct three claims in the RFC 0007/0008 threading comments
The enter-failure comment named two triggers that cannot reach it: at the
pinned openjd-sessions floor (0.10.11) enter_environment has no `raise`
after it registers the environment -- every failure it detects past that
point routes through _fail_action_before_start() and returns normally
(verified by AST-walking the function: raises at 780/782/793, append at
812, none after). The post-registration branch is therefore defensive, and
now says so rather than implying a reachable path.
The dependency-floor comment named run_task as what breaks below 0.10.11,
but `job_name` is passed to Session() unconditionally, so construction
raises TypeError first; `extra_let_bindings` is also 0.10.11-only.
The forwarding comment explained that None is not passed without saying
that pthat pthat pthat pteqthat pthat pthat pthat pteqthat pthat pthat pthat pteqthat pthat pthat pthat pteqthat pthat pthat pthat pteqthat pthat pthaion pins it.
Signed-off-by: David Leong <116610336+leongdl@users.noreply.github.com>
* test: Widen the timing margins on two timeout fixtures
Both tests asserted on a race against a tight action timeout and failed
intermittently once this branch added 12 tests to the 12-worker parallel
run: job_sleep_exit_normal left under 2s for interpreter startup before
the timeout killed the action, so 'SLEEP' was never printed; and
feature_bundle_1_timeout gave a bash action that sleeps 1s a 5s budget,
which a loaded run exceeded, turning exit 0 into exit 1.
Measured before: the full suite failed 2 of 3 runs on this branch while
the base commit passed 3 of 3 (301 tests vs 313 -- the added contention,
not a behaviour change; both tests pass 5/5 in isolation on both trees).
After: 3 of 3 runs green.
Neither test's subject changes. TaskTimeout still times out, because the
sleep is now an order of magnitude longer than the timesleep is now an order of magnitude longer than the timesleep is now an order of magnitude longer than the timesleep is now an order of magnitude longer thanit
asserts moves, 5s to 20s.
Signed-off-by: David Leong <116610336+leongdl@users.noreply.github.com>
* fix: Forward the create-time step symbol table to sessions
A step's template-scope `let` (RFC 0005 §3.6) is resolved once at job
creation. openjd-model no longer merges the resolved bindings into
`script.let` and openjd-sessions no longer re-evaluates the source
expressions, so the only channel those values have into a session is the
`resolved_symtab` argument. The CLI forwarded nothing, so a step-level
`let` produced no bindings at all.
It also still passed `extra_let_bindings`, which openjd-sessions removed in
0.12.0 in favour of `resolved_symtab`. That raised TypeError for any step
with a `let`, which surfaced as "Cannot exit unknown Environment" once the
failed enter left the environment unregistered.
Take the tables from `create_job_with_symbol_tables` (same job as
`create_job`, tables returned instead of discarded), carry them on
LocalSession keyed by step name, and forward the right one at all three
entry points: `run_task`, `enter_environment` for a step's environments,
and `exit_environment` with the same table the enter used. The values are
already `SerializedSymbolTable`, which is what the sessions API takes, so
nothing is converted. `extra_let_bindings` is removed rather than kept
beside the new channel.
Raise both floors, since neither range contained a release with the API:
openjd-sessions to >= 0.12.0 (first release with `resolved_symtab` on all
three entry points; 0.10.11 through 0.11.0 have `extra_let_bindings` and no
`resolved_symtab`, so no version satisfies both) and openjd-model to
>= 0.11.4 (first release exporting `create_job_with_symbol_tables`).
Signed-off-by: David Leong <116610336+leongdl@users.noreply.github.com>
* docs: Point the conftest note at a real fixture
The note in `sample_job_and_dirs` sent readers to a
`sample_job_with_symtabs` fixture "below" that exists nowhere in the
suite. The fixture that actually carries the per-step resolved symbol
tables is `step_let_job` in test_step_symbol_tables.py, which builds them
through a real `job_from_template` call.
Comment only; no behaviour change.
The CodeQL "unused import" report for `SerializedSymbolTable` in
_run/_run_command.py is a false positive and is deliberately not acted
on: the import is already guarded by `if TYPE_CHECKING`, and the quoted
annotation on `_run_local_session`'s `step_symbol_tables` parameter needs
it. Removing it makes mypy fail with `Name "SerializedSymbolTable" is not
defined`.
Signed-off-by: David Leong <116610336+leongdl@users.noreply.github.com>
* docs: Fix a stale version citation and two step-let docstring overclaims
Three text corrections, no behaviour change.
The enter_environment rationale cited openjd-sessions 0.10.11 for "nothing
raises post-registration" while pyproject now pins >= 0.12.0. The claim still
holds at 0.12.0 (verified against the released wheel: every raise in
enter_environment precedes registration, and the post-registration
resolved_symtab failure calls _fail_action_before_start and returns), so only
the citation moves.
test_do_run_job_name_in_step_let_binding claimed neither omitting job_name from
the Session nor passing an empty one would satisfy it. Measured otherwise:
deleting job_name=str(job.name) leaves the test passing, because the binding is
step-level and openjd-model resolves it at job creation, so the value is already
a literal in the resolved table before Session.__init__ runs. Reworded to the
create-time forward path it does pin: model to step_symbol_tables to CLI to
step-environment enter.
test_do_run_step_name_in_step_environment had the same shape, calling itself
"the end-to-end proof of the feature". Dropping step_name=step_name on the
enter also leaves it passing (measured); that keyword is pinned by
test_localsession_step_env_enter_receives_step_name. Scoped accordingly.
Signed-off-by: David Leong <116610336+leongdl@users.noreply.github.com>
---------
Signed-off-by: David Leong <116610336+leongdl@users.noreply.github.com>1 parent a872650 commit bcd09b5
25 files changed
Lines changed: 789 additions & 79 deletions
File tree
- src/openjd/cli
- _common
- _run
- _local_session
- _summary
- test/openjd/cli
- templates
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
37 | 44 | | |
38 | 45 | | |
39 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
26 | 30 | | |
27 | 31 | | |
28 | 32 | | |
| |||
118 | 122 | | |
119 | 123 | | |
120 | 124 | | |
121 | | - | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
122 | 129 | | |
123 | 130 | | |
124 | 131 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
22 | 29 | | |
23 | 30 | | |
24 | 31 | | |
| |||
111 | 118 | | |
112 | 119 | | |
113 | 120 | | |
114 | | - | |
| 121 | + | |
115 | 122 | | |
116 | 123 | | |
117 | | - | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
118 | 133 | | |
119 | 134 | | |
120 | 135 | | |
| |||
132 | 147 | | |
133 | 148 | | |
134 | 149 | | |
135 | | - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
136 | 154 | | |
137 | 155 | | |
138 | 156 | | |
139 | 157 | | |
140 | | - | |
| 158 | + | |
141 | 159 | | |
142 | 160 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
10 | 16 | | |
11 | 17 | | |
12 | 18 | | |
| |||
40 | 46 | | |
41 | 47 | | |
42 | 48 | | |
| 49 | + | |
43 | 50 | | |
44 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
45 | 58 | | |
46 | 59 | | |
47 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
48 | 67 | | |
49 | 68 | | |
50 | 69 | | |
| |||
53 | 72 | | |
54 | 73 | | |
55 | 74 | | |
| 75 | + | |
56 | 76 | | |
57 | 77 | | |
58 | 78 | | |
| |||
63 | 83 | | |
64 | 84 | | |
65 | 85 | | |
66 | | - | |
| 86 | + | |
67 | 87 | | |
68 | 88 | | |
69 | 89 | | |
70 | 90 | | |
71 | 91 | | |
72 | 92 | | |
73 | 93 | | |
74 | | - | |
| 94 | + | |
75 | 95 | | |
76 | 96 | | |
77 | 97 | | |
78 | 98 | | |
79 | 99 | | |
80 | | - | |
81 | | - | |
82 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
83 | 106 | | |
84 | 107 | | |
85 | 108 | | |
86 | 109 | | |
87 | 110 | | |
88 | 111 | | |
89 | 112 | | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
99 | 127 | | |
100 | 128 | | |
101 | 129 | | |
102 | 130 | | |
103 | 131 | | |
| 132 | + | |
104 | 133 | | |
105 | 134 | | |
106 | 135 | | |
| |||
111 | 140 | | |
112 | 141 | | |
113 | 142 | | |
| 143 | + | |
114 | 144 | | |
115 | | - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
116 | 152 | | |
117 | 153 | | |
118 | 154 | | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
119 | 165 | | |
120 | 166 | | |
121 | 167 | | |
122 | | - | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
123 | 171 | | |
124 | 172 | | |
125 | 173 | | |
| |||
0 commit comments