fix(plugin-sdk): use truncateUtf16Safe for API declaration text truncation#102696
fix(plugin-sdk): use truncateUtf16Safe for API declaration text truncation#102696Pandah97 wants to merge 1 commit into
Conversation
…ation Replace .slice(0, 1175) with truncateUtf16Safe() to prevent UTF-16 surrogate pair corruption in API baseline text.
|
Codex review: needs real behavior proof before merge. Reviewed July 9, 2026, 7:15 AM ET / 11:15 UTC. Summary PR surface: Source +1. Total +1 across 1 file. Reproducibility: yes. from source inspection: current main slices a UTF-16 string at a fixed code-unit boundary, so a declaration with a surrogate pair spanning that boundary would leave a dangling half. I did not run a generated baseline fixture in this read-only review. Review metrics: none identified. 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: Keep the narrow helper substitution, but require a focused proof artifact that exercises API-baseline truncation on a surrogate-pair boundary before merge. Do we have a high-confidence way to reproduce the issue? Yes from source inspection: current main slices a UTF-16 string at a fixed code-unit boundary, so a declaration with a surrogate pair spanning that boundary would leave a dangling half. I did not run a generated baseline fixture in this read-only review. Is this the best way to solve the issue? Yes for the code shape: using the existing normalization-core helper at the lone fallback truncation site is narrower than adding another local slicer or changing the baseline length. The merge-readiness gap is missing real behavior proof, not an alternative implementation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 08663917fa37. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +1. Total +1 across 1 file. 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
|
Summary
.slice(0, 1175), which can split UTF-16 surrogate pairs when declarations contain emoji or other multi-codepoint characters..slice(0, 1175)withtruncateUtf16Safe(text, 1175)— a guarded slice that preserves surrogate pair integrity.@openclaw/normalization-core/utf16-slice.Real behavior proof
pnpm tsgo:coretype check passes.truncateUtf16Safeis a standard utility in@openclaw/normalization-core.pnpm tsgo:coreconfirms compilation. The substitution is a direct 1:1 replacement at a single call site.truncateUtf16Safeis already used in 20+ merged PRs across the codebase.Risk checklist
truncateUtf16Safehas standalone unit tests innormalization-core. Zero behavioral change for ASCII/BMP text paths.AI-assisted
This PR was generated with Claude Code.