Skip to content

Fix bold leaking across legacy round-trip in panel lore#2918

Merged
tastybento merged 1 commit intodevelopfrom
fix/2917-bold-leak-legacy-roundtrip
Apr 7, 2026
Merged

Fix bold leaking across legacy round-trip in panel lore#2918
tastybento merged 1 commit intodevelopfrom
fix/2917-bold-leak-legacy-roundtrip

Conversation

@tastybento
Copy link
Copy Markdown
Member

@tastybento tastybento commented Apr 7, 2026

Summary

  • Adventure's LegacyComponentSerializer does not emit §r when a sibling component clears a decoration that was set on a previous sibling — legacy color codes have no "decoration off" code. The User.getTranslationconvertToLegacyPanelItem.setDescriptionparseMiniMessageOrLegacy round-trip then re-parses under legacy semantics (decorations persist until §r), so bold leaked into the following segment.
  • Example: <green>Resets </green><red><bold>ALL </bold></red><green>the settings to their</green> rendered "the settings to their" as bold.
  • Fix: replace Util.componentToLegacy with a Component walker that tracks emitted color/decorations and emits §r at decoration-off transitions, re-applying color afterwards.
  • Strengthened LegacyToMiniMessageTest.testRoundTripDoesNotProduceLiteralTags to walk the round-tripped Component and assert that only "ALL " is bold (the previous test only checked plain text and missed the leak).

Fixes #2917

Test plan

  • ./gradlew test — full suite (2751 tests) passes
  • New assertion in LegacyToMiniMessageTest fails before the fix and passes after
  • Manual: confirm in-game that the reset-to-default item lore no longer renders "the settings to their" in bold

🤖 Generated with Claude Code

Adventure's LegacyComponentSerializer does not emit §r when a sibling
component clears a decoration that was set on a previous sibling, because
legacy color codes have no "decoration off" code. The User.getTranslation
→ convertToLegacy → PanelItem.setDescription → parseMiniMessageOrLegacy
round-trip then re-parses the legacy string under legacy semantics
(decorations persist until §r), so bold leaked into following segments.

Replace componentToLegacy with a Component walker that tracks emitted
state and inserts §r at decoration-off transitions, re-applying color
afterwards. Strengthen the existing round-trip test to assert that bold
only applies to the intended segment.

Fixes #2917

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@tastybento tastybento merged commit 050e630 into develop Apr 7, 2026
1 check passed
@tastybento tastybento deleted the fix/2917-bold-leak-legacy-roundtrip branch April 7, 2026 03:06
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 7, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Russian Language Update

1 participant