Commit b255be6
committed
feat: Add WrappedAction.Cancelation.* wrap-hook template variables
Register WrappedAction.Cancelation.Mode and
WrappedAction.Cancelation.NotifyPeriodInSeconds in the environment
script's injected-symbol list so format strings referencing them pass
validation, per the RFC 0008 follow-up
(OpenJobDescription/openjd-specifications#148):
- Mode is string? — "TERMINATE", "NOTIFY_THEN_TERMINATE", or null when
the wrapped action defines no <Cancelation>, following the EXPR
semantics for optional data. The null case is distinct from an
explicit TERMINATE so wrap scripts can tell "author declared
TERMINATE" apart from "author declared nothing".
- NotifyPeriodInSeconds is int? — the effective grace period when the
mode is NOTIFY_THEN_TERMINATE (with the Template Schemas 5.3.2
defaults applied: 120 for a task's onRun, 30 otherwise), and null
when a notify period does not apply.
Also make the legacy (non-EXPR) format-string node render a None value
as the empty string, matching the EXPR engine's null rendering
(RFC 0005). This is required for both nullable variables, whose None
values must not render as the Python repr "None".
Runtime seeding of the two variables lands in
openjd-sessions-for-python; this is the model-side validation and
rendering support. Mirrors the Rust implementation in
OpenJobDescription/openjd-rs#261. Verified by unit tests and the
wrap-cancelation-* conformance fixtures — the full WRAP_ACTIONS suite
(53 tests) passes against the Python CLI.
Signed-off-by: David Leong <116610336+leongdl@users.noreply.github.com>1 parent 9d8f7b8 commit b255be6
4 files changed
Lines changed: 70 additions & 1 deletion
File tree
- src/openjd/model
- _format_strings
- v2023_09
- test/openjd/model_v0/format_strings
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
69 | 75 | | |
70 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
71 | 80 | | |
72 | 81 | | |
73 | 82 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
903 | 903 | | |
904 | 904 | | |
905 | 905 | | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
906 | 915 | | |
907 | 916 | | |
908 | 917 | | |
| |||
Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
111 | 132 | | |
112 | 133 | | |
113 | 134 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
0 commit comments