Repository navigation
Cut Project text fields on a code point boundary - #2640
Conversation
A Project name that ends in an emoji at its 120-unit bound was cut by String#slice, which counts UTF-16 units, so state.json held the lone high surrogate 0xd83d and every UTF-8 write of it read as U+FFFD. projectText now bounds every Project text field through cut() from src/shared/text-boundary.js, so the kept prefix stops on a code-point boundary; no limit number changes. Fixes #2638 Owner: Dev Reviewer: Reviewer Written-by: Dev
|
Verdict: PASS at 2f99f6f Ran at this tip:
|
Written-by: Dev
Fixes #2638
A Project name that ends in an emoji at its 120-unit bound was cut by
String#slice, which counts UTF-16 units:state.jsonheld the lone high surrogate0xd83d, and every UTF-8 write of it read asU+FFFD.projectTextnow bounds every Project text field throughcut()incore/src/shared/text-boundary.js, so the kept prefix stops on a code-point boundary; no limit number changes. Tests pinisWellFormed()and the code-point length throughsave()/load()for the 120-code-point name and the 400-unit working folder, plus that an under-bound value survives trim unchanged.Owner: Dev
Reviewer: Reviewer
Ran at this tip: 2f99f6f
Not run
npm run verify: the box runs one full suite at a time, so only the affected test files were run.core/scripts/check-arch-docs.mjsandds-bot-patches.mjs canonical: both need git, absent here; the patch series was edited by hand and proved by the git-freecheck, and the owned pagedocs/subsystems/core-host.mdis updated in this PR.Checkpoint
{
"pr": 2640,
"claim": "Dev",
"issue": 2638,
"summary": "Project text fields were bounded with String#slice, which counts UTF-16 units, so a name ending in an emoji at the 120 bound stored half a surrogate pair in state.json and every UTF-8 write showed U+FFFD. projectText now uses the shared cut() helper, so every Project text field keeps a prefix that ends on a code-point boundary; no limit number changed. New tests pin isWellFormed() and the code-point length through save() and load(), plus an under-bound value surviving trim unchanged. The ds-bot patch mirror follows the edited core and is proved by the git-free applier.",
"files": [
"core/src/host/store.js",
"core/test/projects.test.js",
"patches/ds-bot/0002-flybot-api-host.patch",
"patches/ds-bot/files/test/projects.test.js",
"docs/subsystems/core-host.md",
"changelog.d/2638.fixed.md"
],
"checks": {
"ran": "TZ=UTC node --import ./test/harness-resolve.mjs --test test/projects.test.js test/store.test.js test/identity.test.js test/text-boundary.test.js test/text-bounds.test.js (72 pass at 54d0395); node scripts/ds-bot-patches.mjs check; node scripts/build-client.mjs --check; node .github/scripts/changelog.mjs check",
"result": "green",
"at": "2f99f6f7e62f3e666395af0e7d6761f6b69f725c"
},
"next": "none — ready for review"
}