Repository navigation
core-host: count the task board's question/answer and handoff bounds in code points - #1904
Conversation
The typed card's question/answer and `boundedLine`'s handoff, evidence and lease bounds compared `string.length`, so one emoji cost two: a 1,001-emoji question was refused as 2,002 and a 151-emoji handoff reason as 302, while the sentence named a bound the text never exceeded. Both comparisons now go through `codePoints` from `text.js` (ThinkFlowLab#1895), the host's one counter, so a bound moves with the text rather than with its encoding. Every accepted value and every refusal keeps its field name and sentence; only the unit they count changes.
|
Verdict requested for this tip: 67f957b (tree 7f4f609da4a4dc2bd2dff80b3433d7a01fba06bf, base 2ec1687) @Birfy review request #1901: the task board's typed question/answer (2,000) and its Red first on Owner: Dev |
|
Verdict: PASS at 67f957b Ran at this tip (tarball of 67f957b, Red first holds: at the base implementation with the tip's two test files, the two new cases fail — Scope: Checks at this tip: 14 check-runs, 13 green ( Checkpoint block is present and within limits (1,287 characters with markers, summary 440), Owner: |
Fixes #1901
Owner: Dev
Written-by: Dev-1
Reviewer: Reviewer
Claim-Id: ebe734fb893e410597edb83ae324e9d1
Base: 2ec1687
Tree: 7f4f609da4a4dc2bd2dff80b3433d7a01fba06bf
Verified commit: 657f711bdaa2143839083b89202bba9d274a3f6c (tree above); the pushed head is rebuilt from that same tree by the push path, so the two commits carry identical content
Diff: 8 files, +149/−6
What was missing
selectedInput(the typed card'squestion/answer) andboundedLine(the handoff, evidence and lease lines) comparedstring.length, which counts UTF-16 units. An emoji costs two, so a 1,001-emoji question — 1,001 characters, 2,002 units — was refused withQuestion must contain 1–2000 characters, and a 151-emojihandoff.reasonwithhandoff.reason is at most 300 characters: both sentences named a bound the text never exceeded.#1895/#1898had already put memory, schedules, hooks and the Project store on code points; the task board was the remaining user-visible pair.What changed
core/src/host/tasks.jsimportscodePointsfrom./text.js(the zero-allocation counter from#1898) and counts through it at the two comparisons:codePoints(value) > 2000inselectedInputandcodePoints(text) > maxinboundedLine. The fields, the bounds, the sentences and the stored values are unchanged;boundedLinestill normalises whitespace before counting. The task board's own bound is not moved — 2,000 characters of emoji is now accepted, 2,001 is refused.Red first
At
2ec168700fcewith only the two test files' new cases added (implementation untouched):# tests 39 / # pass 37 / # fail 2.The cases pin 2,000 accepted / 2,001 refused for the question and the answer, 300/301 for
handoff.reason, 200/201 forevidence.checkandlease.holder, and one mixed string (1,999 emoji + 1 ASCIIaccepted,2,000 emoji + 1 ASCIIrefused) so a "halve the bound" shortcut cannot pass. At the tip the same two files are 39/39.Verified at 657f711bdaa2143839083b89202bba9d274a3f6c
git status --porcelainwas empty before and after, andTZ=UTC ARCH_DOCS_BASE=2ec168700fce402e86442505b4f089caeb4f1c2d npm run verifyexited 0:.github/scripts563/563, interop 37/37, live-e2e 24/24; oxlint 0 errors;arch-docs: OK (8 changed file(s));build-client --checkclean.node scripts/ds-bot-patches.mjs check:ok ds-bot/ = Fei2411/DeepSeek-Bot@2b10c70 (tree 5834c00, v0.1.5)/ok 10 patches apply cleanly in order/ok core/ equals ds-bot/ + patches/ds-bot/.node scripts/ds-bot-patches.mjs canonical:ok patches/ds-bot/ is what generate writes (generate is a no-op).node scripts/ds-bot-patches.mjs generateat this tip rewrote all 10 patches and 289files/entries, thengit status --porcelainwas empty and HEAD unchanged: every write was byte-identical to what the tree already held, so the empty status means nothing was left uncommitted, not that a generated file is missing.Not run: the
packagejob's pack check, typecheck and actionlint, and the smoke test (no bench started).Files
This is 8 files: 5 are the ticket's own edits, 3 are
generateoutput. The 5:core/src/host/tasks.js(the import and the two comparisons),core/test/tasks.test.js,core/test/task-contract.test.js,docs/subsystems/core-host.md(two sentences now say the bounds count code points) andchangelog.d/1901-task-text-code-points.fixed.md. The 3:patches/ds-bot/files/src/host/tasks.jsand the two test mirrors —tasks.jsis a FlyBot-added file, sogeneratekeeps it infiles/and mirrors the tests there too; each is byte-identical to itscore/file (cmpsame). No.patchfile changed, and nocore/client.js.core/src/host/tasks.jscore/test/tasks.test.jscore/test/task-contract.test.jsdocs/subsystems/core-host.mdchangelog.d/1901-task-text-code-points.fixed.mdpatches/ds-bot/files/src/host/tasks.jspatches/ds-bot/files/test/tasks.test.jspatches/ds-bot/files/test/task-contract.test.js{
"pr": 1904,
"claim": "Dev",
"issue": 1901,
"summary": "The task board's typed question/answer and its handoff, evidence and lease lines compared string.length, so one emoji cost two: a 1,001-emoji question was refused as 2,002 and a 151-emoji handoff reason as 302. Both comparisons now count through codePoints from text.js, the host's one counter. The fields, the bounds and the refusal sentences are unchanged; only the unit they count changed, and a mixed string counts what the reader sees.",
"files": [
"core/src/host/tasks.js",
"core/test/tasks.test.js",
"core/test/task-contract.test.js",
"docs/subsystems/core-host.md",
"changelog.d/1901-task-text-code-points.fixed.md",
"patches/ds-bot/files/src/host/tasks.js",
"patches/ds-bot/files/test/tasks.test.js",
"patches/ds-bot/files/test/task-contract.test.js"
],
"checks": {
"ran": "TZ=UTC ARCH_DOCS_BASE=2ec16870 npm run verify; node scripts/ds-bot-patches.mjs check; node scripts/ds-bot-patches.mjs canonical; node scripts/ds-bot-patches.mjs generate (git status --porcelain empty, HEAD unchanged)",
"result": "green",
"at": "657f711bdaa2143839083b89202bba9d274a3f6c"
},
"next": "none \u2014 ready for review"
}