fix(line): truncate action fields on code-point boundaries#97470
Conversation
The LINE action builders truncated label (20) and data/displayText (300) with a raw `String.prototype.slice`, which cuts an emoji apart when the limit falls inside a surrogate pair. A 19-char label followed by 😀 (U+1F600) yielded a label ending in a lone high surrogate (\uD83D), which LINE renders as a replacement glyph or rejects. Truncate with `truncateUtf16Safe` instead so a dangling half-emoji is dropped, matching how this plugin already truncates LINE template titles. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
- drop the unnecessary template literal (no-unnecessary-template-expression)
- cast messageAction/uriAction results to { label: string } so loneHighSurrogate.test()
receives a string (matches the postback/datetime test casts)
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Codex review: needs maintainer review before merge. Reviewed June 28, 2026, 2:31 PM ET / 18:31 UTC. Summary PR surface: Source +2, Tests +150. Total +152 across 8 files. Reproducibility: yes. On current main, Review metrics: none identified. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Next step before merge
Security Review detailsBest possible solution: Land this focused LINE action-field fix after required checks, while keeping the separate template title/altText cleanup in #97428. Do we have a high-confidence way to reproduce the issue? Yes. On current main, Is this the best way to solve the issue? Yes. Reusing the existing SDK text helper from LINE-owned action builders and routing sibling action-producing paths through that helper is the narrowest maintainable fix; the adjacent template title/altText work is separate. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 881ec2f93f37. Label changesLabel justifications:
Evidence reviewedPR surface: Source +2, Tests +150. Total +152 across 8 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
a9eb4e5 to
3880ab1
Compare
|
Maintainer follow-up pushed to broaden the original fix before landing. What changed:
Local proof on head
GitHub checks on head |
What Problem This Solves
LINE action labels/data used raw UTF-16 slicing. When an emoji or other astral character landed on the LINE field limit boundary, the outgoing action payload could contain a dangling surrogate half.
Why This Change Was Made
The LINE action builders now use the existing plugin SDK
truncateUtf16Safehelper for label/data/displayText fields while preserving the existing 20 and 300 code-unit limits.User Impact
LINE actions with long labels or postback data containing emoji no longer produce malformed text at truncation boundaries.
Evidence
Autoreview result: clean; no accepted/actionable findings.
After-fix Proof
Boundary probe on this PR branch:
{ "usesSafeTruncate": true, "label": "1234567890123456789", "dataLength": 299, "labelHasLoneSurrogate": false, "dataHasLoneSurrogate": false }The probe places an emoji across the 20-unit LINE label limit and 300-unit postback data limit. Both are truncated without leaving a lone UTF-16 surrogate.