Commit 14af77f
chore(feature_flags): warn on empty schema and empty rules (#8430)
* chore(feature_flags): warn on empty schema and empty rules
SchemaValidator accepted an empty top-level document and any feature
whose 'rules' key was present but falsy (including a list) without any
signal. These are harmless for evaluation, but they usually indicate an
authoring mistake such as a typo'd envelope path.
Emit a warning log for an empty schema, for a feature whose 'rules' is
present but empty, and a more specific warning when the empty value is
not a dictionary. Nothing is raised, so existing documents keep
validating. Omitting 'rules' entirely stays silent since that is the
documented way to declare a static flag.
Pass the real feature name into RulesValidator. It previously derived
the name from the feature's first key (usually 'default'), so error and
warning messages named the wrong thing.
Closes #8427
* fix(feature_flags): emit user-facing schema warnings
---------
Co-authored-by: Leandro <lcdama@amazon.pt>1 parent 362a797 commit 14af77f
2 files changed
Lines changed: 109 additions & 7 deletions
File tree
- aws_lambda_powertools/utilities/feature_flags
- tests/functional/feature_flags/_boto3
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
| |||
212 | 214 | | |
213 | 215 | | |
214 | 216 | | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
215 | 227 | | |
216 | 228 | | |
217 | 229 | | |
| |||
232 | 244 | | |
233 | 245 | | |
234 | 246 | | |
235 | | - | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
236 | 253 | | |
237 | 254 | | |
238 | 255 | | |
| |||
260 | 277 | | |
261 | 278 | | |
262 | 279 | | |
| 280 | + | |
263 | 281 | | |
264 | 282 | | |
265 | | - | |
| 283 | + | |
266 | 284 | | |
267 | 285 | | |
268 | 286 | | |
269 | 287 | | |
270 | 288 | | |
271 | 289 | | |
272 | | - | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
273 | 309 | | |
274 | 310 | | |
275 | 311 | | |
| |||
Lines changed: 70 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| 28 | + | |
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
| |||
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
37 | | - | |
| 39 | + | |
38 | 40 | | |
39 | | - | |
| 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 | + | |
40 | 66 | | |
41 | 67 | | |
42 | 68 | | |
| |||
59 | 85 | | |
60 | 86 | | |
61 | 87 | | |
62 | | - | |
| 88 | + | |
| 89 | + | |
63 | 90 | | |
64 | 91 | | |
65 | 92 | | |
66 | 93 | | |
67 | 94 | | |
68 | 95 | | |
69 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
70 | 133 | | |
71 | 134 | | |
72 | 135 | | |
| |||
87 | 150 | | |
88 | 151 | | |
89 | 152 | | |
90 | | - | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
91 | 157 | | |
92 | 158 | | |
93 | 159 | | |
| |||
0 commit comments