lizhimins opened a new pull request, #5752:
URL: https://github.com/apache/rocketmq-dashboard/pull/5752
Follow-up to #5213, which could not carry this edit itself
(`maintainerCanModify` is off on that PR).
`capTitleShouldCutOnCodePointBoundariesTest` carried a comment saying the
old 512-UTF-16-unit cut
split the last emoji. Its fixture cannot show that: `("y".repeat(15) +
emoji).repeat(32)` is exactly
512 code points but 544 UTF-16 units, so the old `substring(0, 512)` stopped
after 30 groups plus two
y's - it lost code points rather than splitting a character. The assertion
was correct; the stated
mechanism was not.
This corrects the comment and adds the case that really does land
mid-surrogate. With a three-unit
period, unit 512 falls on a high surrogate (`512 = 3 x 170 + 2`), so capping
`("y" + emoji).repeat(300)`
must yield `("y" + emoji).repeat(256)` (512 whole code points) where the old
cut returned 171 y's,
170 emoji and a lone surrogate that the utf8mb4 `rmq_ai_conversation.title`
column cannot store.
Verification: `mvn -ntp test -Dtest=AiConversationServiceTest
-Dspring.profiles.active=dev` -> 21 tests,
0 failures, 0 checkstyle violations. Mutation-checked: reverting `capTitle`
to the unit-based substring
turns the new assertion red (`AiConversationServiceTest:251`).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]