Repository navigation
Commit 4454e8b
committed
fix: Make task parameter type names case-insensitive under EXPR
Template Schemas §2 says "job parameter and task parameter type names become
case-insensitive" when the EXPR extension is enabled, and so are case-sensitive
without it. `_normalize_parameter_type_case` already implemented that, gated on
the extension, but it was registered only on `parameterDefinitions` in
`JobTemplate` and `EnvironmentTemplate`. `StepParameterSpaceDefinition` had no
such registration, so a task parameter spelled `type: int` was rejected with
`Input tag 'int' found using 'type' does not match any of the expected tags`
even with EXPR declared. The conformance fixture pinning this is
`EXPR/job_templates/proposed/3.4.1--task-param-type-case-insensitive.yaml`,
added by openjd-specifications#166, which failed here and in openjd-rs alike.
The fix is the same three-line registration the other two models carry, on
`taskParameterDefinitions`, before discriminated-union resolution. Nothing else
was needed: `TaskParameterList` is a list of dicts, the shape the shared
function was already written for, and `context.extensions` holds the effective
set by then because `JobTemplate` declares `extensions` before `steps`. That
covers all five task parameter types, `CHUNK[INT]` included -- §3.4.1.5 makes it
a task parameter type name, so EXPR makes `chunk[int]` a spelling of it.
The fold now uses an ASCII-only translation table instead of `str.upper()`.
`str.upper()` is Unicode-aware and folds ten codepoints wholly into the
type-name alphabet, five of which spell a real type: `ıNT` (U+0131), `ſTRING`
(U+017F), `flOAT` (U+FB02) and `ſtRING`/`stRING` (U+FB05/U+FB06) were all accepted
under EXPR. Spec type names are ASCII, so none of those is a spelling variant.
This is a second defect rather than part of the fixture's, and no fixture pins
it, but it shares the line being edited -- and registering the fold on task
parameters would otherwise have extended it to a surface that was accidentally
safe by not folding at all.
81 tests across three files, one class per registration site, each covering the
four cases of EXPR on/off by canonical/mis-cased spelling. Nine mutations, all
caught: un-registering each of the three sites, dropping `mode="before"`,
dropping the EXPR gate, reverting to `str.upper()`, neutering the translation
table, removing the two isinstance guards, and folding only the first list
element.
Three findings came from auditing the tests rather than the code, and each added
tests that were missing. The `EnvironmentTemplate` registration was covered by
nothing: neutering it left the entire model_v0 suite green at 2743 passed, and
the ASCII change had silently altered that shipped path in both directions with
no test either way. The two isinstance guards in the shared function became
load-bearing on a new surface, since registering the fold routed
`taskParameterDefinitions` through them for the first time; without them
`taskParameterDefinitions:` left empty raises `TypeError` and `type: 3` raises
`AttributeError` out of `decode_job_template` instead of
`DecodeValidationError`. And because a mis-cased name now resolves to a variant,
it reaches validators it never used to: two mis-cased `chunk[int]` parameters
now report the one-CHUNK[INT] rule, and `int`/`INT` under one name now reports
the duplicate-name rule.
One test was renamed after mutation testing showed it did not pin what its name
claimed. A template declaring EXPR to a caller that does not allowlist it is
rejected on the extension name, before the type name is reached, so it survives
removal of the EXPR gate; it now says so and asserts the extension message.
The matching openjd-rs change is not yet raised. Both fixtures stay in
`proposed/` until both implementations release, since a fixture is promotable
only when it passes on both.
Design note: SuperDaveDocs docs/conformance-0901/4.3-parameter-insensitive/fix.md
Signed-off-by: David Leong <116610336+leongdl@users.noreply.github.com>1 parent ffd628b commit 4454e8b
4 files changed
Lines changed: 462 additions & 1 deletion
File tree
- src/openjd/model/v2023_09
- test/openjd/model_v0/v2023_09
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1828 | 1828 | | |
1829 | 1829 | | |
1830 | 1830 | | |
| 1831 | + | |
| 1832 | + | |
| 1833 | + | |
| 1834 | + | |
| 1835 | + | |
| 1836 | + | |
| 1837 | + | |
1831 | 1838 | | |
1832 | 1839 | | |
1833 | 1840 | | |
| |||
3967 | 3974 | | |
3968 | 3975 | | |
3969 | 3976 | | |
| 3977 | + | |
| 3978 | + | |
| 3979 | + | |
| 3980 | + | |
| 3981 | + | |
3970 | 3982 | | |
3971 | 3983 | | |
3972 | 3984 | | |
3973 | 3985 | | |
3974 | 3986 | | |
| 3987 | + | |
| 3988 | + | |
3975 | 3989 | | |
3976 | 3990 | | |
3977 | 3991 | | |
| |||
3981 | 3995 | | |
3982 | 3996 | | |
3983 | 3997 | | |
3984 | | - | |
| 3998 | + | |
3985 | 3999 | | |
3986 | 4000 | | |
3987 | 4001 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
256 | 257 | | |
257 | 258 | | |
258 | 259 | | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
0 commit comments