Commit 371a6e1
Fix readSettingsFile to handle the keyed-object stages shape
Discovered while validating PR #170 against the real Citizens portal site
(C:\Projects\Citizens portal). The site's deployment-settings.json uses
the Microsoft-standard 2024 schema shape:
{
"$schema": "https://schemas.microsoft.com/power-platform/deployment-settings/2024",
"stages": {
"Deploy to Staging": {
"EnvironmentVariables": [...]
}
}
}
— a keyed OBJECT of stages. readSettingsFile only handled two shapes:
1. Top-level `EnvironmentVariables: []` (single-stage)
2. `Stages: []` array with `{ Name, EnvironmentVariables }` entries
The keyed-object shape returned 0 entries, which meant
validate-deployment-settings.js silently passed even on known-broken
values like `@KeyVault(vaultName=...;secretName=...)`.
Real-world evidence: the Citizens portal's docs/alm/last-deploy.json
records a failed deploy attempt (2026-05-21) where deployment-settings.json
contained `@KeyVault(...)` for c311_api_secret. The pre-deploy validator
"validation passed (validation does not check Secret reference format)"
— because the parser couldn't read the file. The deploy then waited ~4h
in the host queue before failing with `ImportAsHolding failed: The value
provided as a secret reference does not match a valid secret reference
format`. This is exactly what the v3 deploy-pipeline:7.6.4.strip-secret-
values gate is supposed to prevent — but the gate's underlying validator
was broken.
Changes:
- readSettingsFile now handles all three shapes. Each returned entry
now carries `stageLabel` (null for shape 1, the stage name for shapes
2 and 3), so downstream consumers can attribute findings to the right
stage without re-parsing the file.
- validate-deployment-settings.js had a duplicated read-settings parser
(readEntriesPreservingStage) with the same bug. Deleted — it now
uses readSettingsFile directly.
- Tests:
- Existing readSettingsFile tests updated to expect the new stageLabel
field on entries.
- New test: keyed-object shape (Microsoft 2024 schema). Validates the
real-world fix against a fixture matching the Citizens portal file.
- validate-deployment-settings.test.js renamed readEntriesPreservingStage
references to readSettingsFile.
Verified end-to-end against the real Citizens portal file:
node validate-deployment-settings.js --settingsFile <citizens-portal>
→ summary { invalid: 1 }, one finding flagging the @KeyVault(...) value
on c311_api_secret as 'kv-placeholder' / 'invalid'.
Plugin tests: 993/993 (was 992; +1 new shape-3 test).
Lint: 0 findings.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent b42ddc6 commit 371a6e1
4 files changed
Lines changed: 124 additions & 58 deletions
File tree
- plugins/power-pages/scripts
- lib
- tests
Lines changed: 5 additions & 38 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
326 | 326 | | |
327 | 327 | | |
328 | 328 | | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
359 | | - | |
360 | | - | |
361 | | - | |
362 | | - | |
363 | | - | |
364 | | - | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
365 | 333 | | |
366 | 334 | | |
367 | | - | |
| 335 | + | |
368 | 336 | | |
369 | 337 | | |
370 | 338 | | |
| |||
452 | 420 | | |
453 | 421 | | |
454 | 422 | | |
455 | | - | |
456 | 423 | | |
457 | 424 | | |
458 | 425 | | |
| |||
Lines changed: 63 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
94 | 101 | | |
95 | 102 | | |
96 | 103 | | |
| |||
105 | 112 | | |
106 | 113 | | |
107 | 114 | | |
108 | | - | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
109 | 118 | | |
110 | | - | |
111 | | - | |
| 119 | + | |
112 | 120 | | |
113 | 121 | | |
114 | 122 | | |
115 | 123 | | |
116 | | - | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
117 | 129 | | |
118 | 130 | | |
119 | 131 | | |
120 | 132 | | |
121 | 133 | | |
122 | 134 | | |
123 | | - | |
| 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 | + | |
124 | 173 | | |
| 174 | + | |
| 175 | + | |
125 | 176 | | |
126 | 177 | | |
127 | 178 | | |
128 | 179 | | |
| 180 | + | |
129 | 181 | | |
130 | 182 | | |
131 | 183 | | |
132 | | - | |
| 184 | + | |
133 | 185 | | |
134 | 186 | | |
135 | 187 | | |
136 | 188 | | |
| 189 | + | |
137 | 190 | | |
138 | 191 | | |
139 | 192 | | |
| |||
Lines changed: 10 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | 14 | | |
16 | 15 | | |
17 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
18 | 21 | | |
19 | 22 | | |
20 | 23 | | |
| |||
229 | 232 | | |
230 | 233 | | |
231 | 234 | | |
232 | | - | |
| 235 | + | |
233 | 236 | | |
234 | 237 | | |
235 | 238 | | |
236 | 239 | | |
237 | 240 | | |
238 | 241 | | |
239 | 242 | | |
240 | | - | |
| 243 | + | |
241 | 244 | | |
242 | 245 | | |
243 | 246 | | |
244 | 247 | | |
245 | | - | |
| 248 | + | |
246 | 249 | | |
247 | 250 | | |
248 | 251 | | |
249 | 252 | | |
250 | 253 | | |
251 | 254 | | |
252 | 255 | | |
253 | | - | |
| 256 | + | |
254 | 257 | | |
255 | 258 | | |
256 | 259 | | |
257 | 260 | | |
258 | 261 | | |
259 | | - | |
| 262 | + | |
260 | 263 | | |
261 | 264 | | |
262 | 265 | | |
263 | 266 | | |
264 | 267 | | |
265 | 268 | | |
266 | 269 | | |
267 | | - | |
| 270 | + | |
268 | 271 | | |
269 | 272 | | |
270 | 273 | | |
| |||
Lines changed: 46 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
101 | | - | |
| 100 | + | |
| 101 | + | |
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
128 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
129 | 131 | | |
130 | 132 | | |
131 | 133 | | |
| |||
151 | 153 | | |
152 | 154 | | |
153 | 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 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
154 | 197 | | |
155 | 198 | | |
156 | 199 | | |
| |||
0 commit comments