Python
language boundary
JavaScript
Before
Python backend
content.find('music')
→ 10 code points
10
Stored row
tracked_changes
.start_offset = 10
bare int — units undocumented
10
Transform
→ 10
copies 10 verbatim
10 — unconverted
JS frontend
content.slice(10, 15)
→ musi
✗ wrong
After
Python backend
content.find('music')
→ 10 code points
10
Stored row
tracked_changes
.start_offset = 10
bare int — units undocumented
10
Transform
→ 10
copies 10 verbatim
10
NEW Conversion
codePointToCodeUnitOffset(
content, 10)
→ 11 code units
11
JS frontend
content.slice(11, 16)
→ music
✓ correct
the backend never changes
the conversion lives at the boundary
Hover any stage to see what it does.