Repository navigation
Commit dc7ba49
committed
fix: Enforce the 512-character cap on a let binding identifier
Template Schemas §3.6.1 caps a `<UserIdentifier>` at 512 characters. Nothing
checked it, so a 513-character `let` binding name was accepted. The
conformance fixture pinning this is
`EXPR/job_templates/proposed/3.6.1--let-identifier-513.invalid.yaml`, added
by openjd-specifications#164, which failed here and in openjd-rs alike.
The cap is a flat 512 and deliberately does not reuse the §7.1
`<Identifier>` cap that `NameIdentifierLengthMixin` and the inline
`512 if "FEATURE_BUNDLE_1" in context.extensions else 64` checks apply.
§3.6.1 states one maximum for a `<UserIdentifier>` and gates it on no
extension, and the fixture pair proves the flat reading: the 512-character
accept twin `EXPR/job_templates/3.6--let-boundary-edges.yaml` declares EXPR
alone, so borrowing the §7.1 cap would limit it to 64 and reject a template
the spec permits. The two caps share the number 512 and nothing else, so
this adds `LET_MAX_IDENTIFIER_LEN` beside the existing `LET_MAX_BINDINGS`
with its own citation. EXPR gates whether `let` exists at all and moves
neither cap.
All four `_validate_let` field validators route through
`validate_let_field` and then `parse_let_bindings`, so the check goes in
`parse_let_bindings` after the `_LET_NAME_RE` match and every scope is
covered by one insertion. The message omits the offending name: at 513
characters it would dwarf the diagnostic.
Six tests, mutation-checked: removing the check fails all three reject tests
while the three accept tests keep passing, so the accept cases act as
negative controls against a cap set too low. The default `_job` helper
declares EXPR alone, which is what would catch a regression to the
FEATURE_BUNDLE_1-gated cap; the `_with_fb1` variants pin that declaring
FEATURE_BUNDLE_1 does not move it.
The matching openjd-rs change is OpenJobDescription/openjd-rs#358.
Design note: SuperDaveDocs docs/conformance-0901/4.6-let-513/fix.md
Signed-off-by: David Leong <116610336+leongdl@users.noreply.github.com>1 parent 4bfb4a3 commit dc7ba49
2 files changed
Lines changed: 66 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
921 | 921 | | |
922 | 922 | | |
923 | 923 | | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
924 | 937 | | |
925 | 938 | | |
926 | 939 | | |
| |||
941 | 954 | | |
942 | 955 | | |
943 | 956 | | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
944 | 963 | | |
945 | 964 | | |
946 | 965 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
44 | 63 | | |
45 | 64 | | |
46 | 65 | | |
| |||
98 | 117 | | |
99 | 118 | | |
100 | 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 | + | |
101 | 148 | | |
102 | 149 | | |
103 | 150 | | |
| |||
0 commit comments