btlqql commented on PR #4692:
URL: 
https://github.com/apache/rocketmq-dashboard/pull/4692#issuecomment-5762167331

   Widened, as you offered — plus the placement item and the cosmetics.
   
   **Scope.** New `common/util/TextBounds` holds the rule once 
(`codePointCount`, and a `truncate` that cuts with `offsetByCodePoints` and 
appends the ellipsis only when it actually cut). It is now used at all seven 
sites: the two `InstanceService` caps, `CliAgentProvider:198`, 
`ClaudeCodeStreamParser:684`, `MessagePropertyDisplay:93`, 
`NotificationOutboxService:540`, and — since #4713 merged while this sat in 
review — its `requireTextWithin` for `endpoint` / `remark` / 
`adminCredentialRef`. So the coordination you asked for happened in this PR 
rather than being promised: #4713's helper now counts code points through the 
same utility, and `MessagePropertyDisplay`'s private `codePointCount` wrapper 
is gone.
   
   You were right that the two `InstanceService` caps are the weakest of the 
seven. I kept them as you allowed, because they are also a column-width 
question: MySQL counts a `varchar` in characters, so 512 emoji fit a 
`varchar(512)` and counting UTF-16 chars rejected a value that fits the column 
with a 500 from the persistence layer. The four you named are the ones with the 
obvious end-user text behind them — the CLI's failure output quotes the 
operator's own prompt back (`CliAgentProvider:159/161`), the stream parser 
bounds a failed tool result, message properties are user-supplied, and the 
delivery reason is a webhook receiver's response body.
   
   **Mutation check**, on the rebased tree — helper reverted to `substring(0, 
budget)`, tests untouched:
   
   ```
   [ERROR] Tests run: 196, Failures: 8, Errors: 0, Skipped: 0
   [ERROR]   TextBoundsTest.truncateShouldNotSplitASurrogatePairTest:44
   [ERROR]   
InstanceServiceTest.deleteInstancesShouldCutFailureMessagesOnCodePointBoundariesTest:1879
   [ERROR]   
InstanceServiceTest.importCloudInstancesShouldBoundFailureMessagesOnCodePointBoundariesTest:1896
   [ERROR]   
CliAgentProviderTest.aFailedCliShouldAbbreviateItsOutputOnCodePointBoundariesTest:159
   [ERROR]   
ClaudeCodeStreamParserTest.aLongFailedToolResultShouldBeAbbreviatedOnCodePointBoundariesTest:495
   [ERROR]   
MessagePropertyDisplayTest.limitPropertiesShouldKeepASupplementaryCharacterThatFitsTheCapTest:89
   [ERROR]   
MessagePropertyDisplayTest.limitPropertiesShouldNotSplitASurrogatePairTest:76
   [ERROR]   
NotificationOutboxServiceTest.abbreviatesALongWebhookRejectionReasonOnCodePointBoundariesTest:333
   ```
   
   Eight tests across five sites, so no site is covered by assertion alone.
   
   **Cosmetics:** `EMOJI` has a javadoc and a blank line before the first 
`@Test`; the trailing blank line is gone; the file ends with a newline.
   
   Whole suite on a host with MySQL 8 reachable: 3156 tests, 0 failures, 0 
errors (3145 on the untouched head). The subject is now `fix: bound user-facing 
text on code point boundaries` since the change spans five packages — `fix:` 
without a scope has precedent on this branch (`ef9b9826`), and I updated the PR 
title to match.
   


-- 
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]

Reply via email to