fix(android): keep link preview metadata UTF-16 safe#102988
Conversation
2cf519c to
d06a52f
Compare
|
Codex review: needs real behavior proof before merge. Reviewed July 9, 2026, 3:57 PM ET / 19:57 UTC. Summary PR surface: Other +14. Total +14 across 4 files. Reproducibility: yes. source-level: current main caps sanitized og:title and og:description metadata with raw take(maxChars), so an emoji split at the limit can leave only the high surrogate. I did not run an Android app repro in this read-only review. Review metrics: none identified. Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the narrow shared sanitizer after redacted real Android chat-preview proof shows emoji-at-boundary metadata renders without a dangling surrogate and required checks finish green. Do we have a high-confidence way to reproduce the issue? Yes, source-level: current main caps sanitized og:title and og:description metadata with raw take(maxChars), so an emoji split at the limit can leave only the high surrogate. I did not run an Android app repro in this read-only review. Is this the best way to solve the issue? Yes. The PR fixes the sanitizer boundary used by both title and description metadata and shares the already-tested Android notification truncation rule instead of adding a second policy path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ee9d9ea6dbb7. Label changesLabel justifications:
Evidence reviewedPR surface: Other +14. Total +14 across 4 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
|
1eea530 to
c83f93f
Compare
c83f93f to
74386e4
Compare
|
Land-ready review completed at exact head What changed during review:
Proof:
Known proof gaps:
No blocking or optional review findings remain. Thanks @ly85206559. |
|
Merged via squash.
|
* fix(android): keep link preview metadata UTF-16 safe * refactor(android): share UTF-16-safe truncation --------- Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Android link previews cap Open Graph title and description metadata before rendering compact preview cards. Kotlin
take(maxChars)counts UTF-16 code units, so it could leave an unpaired high surrogate when the cap landed between the two units of an emoji or another supplementary-plane character.Why This Change Was Made
The final implementation keeps the existing 120/200-unit metadata limits while backing up one unit only when the boundary would retain a lone high surrogate. Review also moved that invariant into one Android-owned
takeUtf16Safehelper shared with notification snapshot sanitation, replacing the earlier duplicate private implementation. This leaves production code net -1 LOC and one canonical truncation path.User Impact
Long Android link-preview titles and descriptions no longer carry malformed UTF-16 at an emoji boundary. A split pair is omitted; a complete pair ending exactly at the cap remains intact. Notification snapshot truncation keeps its existing behavior through the shared helper.
Evidence
74386e4c7e566151934ca3debe6a82fd7e0bd9f9git diff --check: passandroid-test-playjob86212977276android-test-third-partyjob86212977364android-build-playjob86212977286android-ktlintjob86212977287native-i18njob862129771922026-07-09T19:57:11Z, modehosted_exact_or_recent_rebase, verified exact PR head/treeKnown proof gap: no exact-head Android APK was available for device/emulator rendering. Source-blind runtime validation therefore reported 0 pass, 0 fail, and 4 blocked clauses; no device-render claim is made. Sanitized AWS fallback runs
run_11199f6ce6eaandrun_6565652416e0were infrastructure-blocked before tests because the generic image lacked Java and then the Android SDK. The exact-head hosted Android matrix above is the runtime build/test proof.Changelog is intentionally deferred: per contributor policy, this branch stays changelog-free; a maintainer-owned consolidated UTF-16 changelog follow-up will include #102988 and thank @ly85206559.