Commit 8912b00
authored
Fix YAML print idempotency for asterisk placeholders inside block scalars (#7466)
The asterisk placeholder preprocessing (introduced in #6626 to handle
credential values like `*** REMOVED ***`) replaces matched text with
UUIDs before parsing and restores them afterward. Restoration for the
variable/asterisk UUID map used exact-match against the scalar value,
so when the regex matched inside a multi-line block scalar — e.g.
markdown bold like `**CI Alert**` on a line containing `: ` from an
emoji — the UUID was embedded within a longer scalar value and never
restored, breaking print idempotency.
Align restoration with the helm and single-brace template maps on the
same code path, which already use `contains`/`replace`. UUIDs are
random per-parse and only produced by the parser, so substring
replacement is unambiguous.1 parent a9ab1ae commit 8912b00
2 files changed
Lines changed: 27 additions & 3 deletions
File tree
- rewrite-yaml/src
- main/java/org/openrewrite/yaml
- test/java/org/openrewrite/yaml
Lines changed: 8 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
345 | 345 | | |
346 | 346 | | |
347 | 347 | | |
348 | | - | |
349 | | - | |
350 | | - | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
351 | 356 | | |
352 | 357 | | |
353 | 358 | | |
| |||
Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
266 | 266 | | |
267 | 267 | | |
268 | 268 | | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
269 | 288 | | |
270 | 289 | | |
271 | 290 | | |
| |||
0 commit comments