Commit 63dfc3d
committed
fix(config): [global] and [docker] unknown-key warnings carry "did you mean?"
Pre-fix, the unknown-key warning was asymmetric across INI section
types: job sections (job-exec, job-run, etc.) printed
'(did you mean "..."?)' via findClosestMatch, but [global] and [docker]
printed bare '(typo?)' with no suggestion — leaving the operator to
read the line and guess.
Surfaced in PR #677's parallel-reviewer pass: the new
webhook-default-preset global key is easy to mistype
(webhook-defauls-preset swaps t/s) and the typo logged a [global]
warning with no hint at the right spelling.
Fix extracts a logSectionUnknownKeyWarnings helper that mirrors
logJobUnknownKeyWarnings's filename/suggestion matrix and call it from
both [global] and [docker] paths in logUnknownKeyWarnings (file-based)
and BuildFromString (string-based). Known keys come from
extractMapstructureKeys(Config{}.Global) and
extractMapstructureKeys(DockerConfig{}) via two thin helpers
(globalKnownKeys / dockerKnownKeys) so the suggestion list cannot drift
from the actual decoded struct.
Three new tests:
- TestGlobalSectionUnknownKeyWarning_DidYouMean: the issue's exact
example — webhook-defauls-preset suggests webhook-default-preset.
- TestGlobalSectionUnknownKeyWarning_NoSuggestion: locks the fallback
to '(typo?)' when no close match exists.
- TestDockerSectionUnknownKeyWarning_DidYouMean: same parity assertion
for the [docker] path so a future code split can't silently drop
suggestions on one half.
Closes #678. Tracks against #621 (global-keys drift detection family).
Signed-off-by: Sebastian Mendel <info@sebastianmendel.de>1 parent 33d4f93 commit 63dfc3d
2 files changed
Lines changed: 126 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
| 244 | + | |
| 245 | + | |
252 | 246 | | |
253 | 247 | | |
254 | 248 | | |
255 | 249 | | |
256 | 250 | | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 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 | + | |
257 | 288 | | |
258 | 289 | | |
259 | 290 | | |
| |||
322 | 353 | | |
323 | 354 | | |
324 | 355 | | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
332 | 359 | | |
333 | 360 | | |
334 | 361 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
470 | 470 | | |
471 | 471 | | |
472 | 472 | | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
473 | 557 | | |
474 | 558 | | |
475 | 559 | | |
| |||
0 commit comments