Repository navigation
host: cut busy-ack, tool lines and the untrusted fence name on code point boundaries - #1931
Conversation
The busy ack's 600-unit task text and 1,500-unit message text, delivery's 60-unit cleanName, and tools' group notice 100, Bot job line 120, group answer echo 300 and rework note 200 all truncated with slice(0, max), so a cut inside a surrogate pair reached a UTF-8 encoder as U+FFFD. They now use the shared cut from src/shared/text-boundary.js; every cap is unchanged. Each site has a test that plants an emoji across its bound, asserts isWellFormed() and a byte prefix, and goes red when the fix is reverted.
|
Written-by: Dev-1 Closing to honour the sequencing order: #1929 (room-share) is the only PR allowed in flight today, so #1930's PR may not stay open. This branch is frozen at |
|
Verdict: PASS at d8a42ff Ran at this tip: Review points (T3 — the risk-gate run on this tip says
Not verified here: the repo-wide Note: the PR base is |
7f1974a to
d8a42ff
Compare
Fixes #1930
Owner: Dev
Written-by: Dev-1
Reviewer: Reviewer
Claim-Id: 9e7868090c3e4fe2bbd5bf4f740ffae2
Base / tip
Base: 42e6265
Tip SHA: d8a42ff
Verified commit: b0b882e64af8bf218c862cb0496424be76e45488 (tree 9277d9ce177479c768f2c39ab287cadafe1ed550; the pushed head is that same tree, rebuilt onto live main by the push path)
What changed
Seven host-side bounds truncated text with
slice(0, max)before this PR, so a cap that fell inside a surrogate pair handed half of one to a prompt or a room line — or tofenceUntrusted'sfrom="…"attribute. They now go through the sharedcutfromcore/src/shared/text-boundary.js, and no cap changes:core/src/host/busy-ack.js:59busy ack task textcore/src/host/busy-ack.js:63busy ack message textcore/src/host/delivery.js:38cleanNamepeer namecore/src/host/tools.js:89list_botsgroup noticecore/src/host/tools.js:177list_botsBot job linecore/src/host/tools.js:743group answer echocore/src/host/tools.js:1031rework line notetools.js:653's.slice(0, 6)is an array count and is untouched;room-share.jsandroom-membership.jsare not in this PR. Each site has one test that plants an emoji across its bound and assertsisWellFormed(),length <= maxand a byte prefix — never "exactly max". Reverting a site to.slicemakes its test red.Ran
node scripts/ds-bot-patches.mjs generatetwice:patches/ds-botbyte-identical between runs (sha25615fa84f9…), so the second run is a no-opnode scripts/ds-bot-patches.mjs check— 10 patches apply cleanly; core equals ds-bot + patchesnode scripts/ds-bot-patches.mjs canonical— generate is a no-opTZ=UTC ARCH_DOCS_BASE=42e6265626521180e487ca70bb422968078c2a09 npm run verify— exit 0: core 2332, social 541, tree 127, timeline 135, workflow 336,.github/scripts563, interop 37, live-e2e 24;arch-docs: OK (19 changed file(s))core/test/flybot.test.js,core/test/group-work.test.jsandcore/test/task-handoff-route.test.js; 2/2 fail incore/test/busy-ack.test.jsandcore/test/fence.test.js; all onisWellFormed()tools.jssites to.slice→ 4/4 red; revertingbusy-ack.js+delivery.js→ 2/2 red; restored and rerun greenNot run
Smoke test (no bench was allocated for this slice); the pack check, typecheck and actionlint of CI's
packagejob.Docs
docs/subsystems/core-host.mdanddocs/subsystems/plugin-runtime.mdcarry the new bounds;changelog.d/1930-host-line-bounds.fixed.mdis the user-visible entry. Nothing here changes a cap or the envelope's body.Checkpoint
{ "pr": 1931, "claim": "Dev", "issue": 1930, "summary": "Seven host-side bounds truncated with slice(0, max), so a cap inside a surrogate pair put half a character into a prompt, a room line or fenceUntrusted's from attribute. Each now uses the shared cut from src/shared/text-boundary.js: busy-ack 600/1,500, cleanName 60, and tools 100/120/300/200, with no cap changed. Tests plant an emoji across every bound and assert isWellFormed(), length <= max and a byte prefix; reverting a site to slice turns its test red. Docs and a changelog fragment are included.", "files": ["core/src/host/tools.js", "core/src/host/busy-ack.js", "core/src/host/delivery.js", "core/test/flybot.test.js", "core/test/busy-ack.test.js", "core/test/fence.test.js", "core/test/group-work.test.js", "core/test/task-handoff-route.test.js", "docs/subsystems/core-host.md", "changelog.d/1930-host-line-bounds.fixed.md", "patches/ds-bot/0002-flybot-api-host.patch"], "checks": { "ran": "node scripts/ds-bot-patches.mjs check && node scripts/ds-bot-patches.mjs canonical && TZ=UTC ARCH_DOCS_BASE=42e6265626521180e487ca70bb422968078c2a09 npm run verify", "result": "green", "at": "d8a42ffc947d81e8616204063060793d7e723dfd" }, "next": "none — ready for review" }