Repository navigation
host: the two 300-unit oneLine helpers cut on a code point boundary - #1959
Merged
Merged
Conversation
HugoXK
force-pushed
the
dev/1-unit1-oneline-code-point
branch
from
November 1, 2026 01:02
4187d8f to
1c31c81
Compare
Contributor
Author
Collaborator
|
Verdict: PASS at 1c31c81 Ran at this tip:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1958
Owner: Dev-1
Reviewer: Birfy
Written-by: Dev-1
Claim-Id: 152521891c4c4c7cb0043e3094633caf
Branch: dev/1-unit1-oneline-code-point
Base: 37e8162
Two independent 300-unit
oneLinehelpers still cut withString.prototype.slice, which counts UTF-16 code units: a bound that lands between the halves of a surrogate pair keeps the high surrogate alone, and that lone surrogate is what the record keeps and every renderer shows as U+FFFD. They are two copies of the same shape in two files, not one shared function, so each is fixed and tested on its own.cut()fromcore/src/shared/text-boundary.jsalready does this with the same budget, and both sites now call it instead of a new helper.37e81623083bcore/src/host/tasks.js—oneLine(value, max), which caps a card's title (readTitle), its note (readNote) and the flow / links / target fields:105,readTitlecall:106,readNotecall:124, flow:135, links/target:161:105,:106,:124,:135,:161(the fix is one edited line, no line added)core/src/host/work-dispatch.js— its own localoneLine, which turns a group line into a dispatched card'stitleandnote:16, call:33:17, call:34(the newimport { cut }is one added line above it)Before → after:
core/src/host/tasks.js—.trim().slice(0, max)becomes.trim(), max).texton the existing chain:cut(String(value ?? '')…trim(), max).textcore/src/host/work-dispatch.js—.trim().slice(0, 300)becomescut(String(value ?? '')…trim(), 300).text, plus theimport { cut }lineThe budget stays 300 units: a pair that ends exactly on the bound is kept, a pair the bound would split is dropped whole, and the result is never accidentally 299.
Two independent helpers, two separate red tests
tasks.jsandwork-dispatch.jseach carry their own localoneLine; neither imports the other, and a fix in one leaves the other onslice. So one test may not stand for both: each new case drives its own helper, and under a single-site revert only its own case goes red (mutation table below).Red first
With only the two new test cases added to a pristine base
37e81623083b031b4137869b48f6f47122f05b6d(the two source files checked out from the base blob:git show 37e81623:core/src/host/tasks.js > core/src/host/tasks.js, and the same forcore/src/host/work-dispatch.js):Both cases on the base together:
# pass 0 / # fail 2.The new cases in this PR's tree:
core/test/tasks.test.js:1031andcore/test/work-dispatch.test.js:390. Neither existing case changes.Single-site mutation
Each row reverts exactly one of the two helpers to
sliceand reruns both cases:tasks.test.jscasework-dispatch.test.jscasecore/src/host/tasks.js:105core/src/host/work-dispatch.js:17# pass 2 / # fail 0)What else is in the diff
docs/subsystems/core-host.md— one sentence next to the existing 2,000-bound paragraph: the 300-unitoneLinebound those cards share with a room dispatch now goes through the samecut.patches/ds-bot/files/mirrors (src/host/tasks.js,src/host/work-dispatch.js,test/tasks.test.js,test/work-dispatch.test.js) regenerate from the sources on37e81623withnode scripts/ds-bot-patches.mjs generate, never hand-edited, andcmp-checked againstcore/(all four identical).changelog.d/1958-oneline-code-point-bound.fixed.md— onefixedfragment for the user-visible change (node .github/scripts/changelog.mjs check→3 fragment(s) in changelog.d/ are well formed).CHANGELOG.mdis untouched.+50/−5.Verification at the tip
Tip SHA:
1c31c817c6556cfdaf1c8270bab9b8eb39ca4c31— the pushed head, tree7818b2923eb39a8c414600ee45c19ee695722ae0, parent37e81623083b031b4137869b48f6f47122f05b6d. The push path generated it from verified commit19980663bf79f0121149461a4eeb12843908451d, which carries the same tree, so the verify below ran on exactly this tip's content.Ran:
TZ=UTC DSH_HARNESS=/home/xuke/work/flybot-dev/core/dev/harness ARCH_DOCS_BASE=37e81623083b031b4137869b48f6f47122f05b6d npm run verify— exit 0 on verified commit19980663bf79f0121149461a4eeb12843908451d(tree7818b2923eb39a8c414600ee45c19ee695722ae0), which is the tree the pushed head was generated from. Suites: core 2358/2358, social 541/541, tree 127/127, timeline 135/135, workflow 336/336, .github 563/563, interop 37/37, live-e2e 24/24. Lint: 0 errors, 73 warnings, the same 73 the base has. Patches:10 patches apply cleanly in order,core/ equals ds-bot/ + patches/ds-bot/,patches/ds-bot/ is what generate writes (generate is a no-op). arch-docs:ARCH_DOCS_BASE=37e81623083b031b4137869b48f6f47122f05b6d→OK (10 changed file(s)).Not run (and why): no browser run of the card UI (the two new cases assert the stored string, which is what every renderer draws); no manual run against an installed FlyBot instance (this is
core/host code, covered by the suite); the GitHub Actions run for this new tip had not finished when this body was written (the push path cannot wait for it) — the previous tip4187d8f1a3e19aa3460fc6bc835ef69b866a2101was green on every job exceptenqueue-guard, which only waits for a Verifier report naming the tip.Checkpoint
{ "pr": 1959, "claim": "Dev-1", "issue": 1958, "summary": "Two independent 300-unit oneLine helpers, in tasks.js and work-dispatch.js, cut with slice and could keep a lone surrogate; both now call shared/text-boundary.js cut() with the same 300 budget, so a bound inside a pair drops the pair whole. Each helper has its own new case, and reverting one site turns only its own case red. The 2,000-unit bounds in tasks.js are untouched, and the four patches/ds-bot mirrors are regenerated, not hand-edited.", "files": ["core/src/host/tasks.js", "core/src/host/work-dispatch.js", "core/test/tasks.test.js", "core/test/work-dispatch.test.js", "docs/subsystems/core-host.md", "changelog.d/1958-oneline-code-point-bound.fixed.md", "patches/ds-bot/files/src/host/tasks.js", "patches/ds-bot/files/src/host/work-dispatch.js", "patches/ds-bot/files/test/tasks.test.js", "patches/ds-bot/files/test/work-dispatch.test.js"], "checks": { "ran": "TZ=UTC ARCH_DOCS_BASE=37e81623083b031b4137869b48f6f47122f05b6d npm run verify (exit 0); node .github/scripts/changelog.mjs check; node scripts/ds-bot-patches.mjs generate + cmp (four mirrors)", "result": "green", "at": "1c31c817c6556cfdaf1c8270bab9b8eb39ca4c31" }, "next": "none — ready for review" }