Repository navigation
Commit a83db91
authored
fix(names): refuse a Bot name that draws nothing (#2879)
Fixes #2879
Written-by: Dev-5
Bot: FlyBot Lead
Owner: Dev-5
Reviewer: Birfy
## Why
`nameProblem()` decided "no name" as `stripInvisible(name).trim() ===
''`, which removes only `\p{Cf}` and only White_Space respectively.
Characters that are neither survive and draw nothing, so a Bot created
with one of them rendered as a nameless Bot on every surface: U+2800
BRAILLE PATTERN BLANK, U+3164 HANGUL FILLER, U+115F HANGUL CHOSEONG
FILLER and U+034F COMBINING GRAPHEME JOINER were accepted on the new-Bot
form, on creation and on rename.
## Red first
With only the new tests and no source change, at the base this branch
was cut from (`621e547a`):
```
node --import ./test/harness-resolve.mjs --test test/name-identity.test.js
# tests 9 # pass 6 # fail 3
not ok 3 - #2879 a name that draws nothing is refused as empty, whichever characters hide it
not ok 4 - #2879 the create path refuses a name that draws nothing and stores none of them
not ok 5 - #2879 a rename to a name that draws nothing is refused, and a drawn rename still lands
```
The three failing tests walk U+2800, U+3164, U+115F, U+034F and
combinations of them with characters `trim()` does see, through
`nameProblem`, `rt.createBot` and `rt.updateBot`.
Mutation check on the fix: dropping the new condition from `nameProblem`
returns exactly those 3 tests to red (`6 pass / 3 fail`); restoring it
is `9/9`, run twice.
## What
`nameProblem` now also refuses a name whose characters all draw nothing,
with the existing sentence `A Bot needs a name`, so all three entry
points answer the same way (`core/src/host/roster.js` create and rename,
and the panel's pre-check in `core/src/client/create-bot.js`, which
calls the same guard). The class is
`[\p{Mn}\p{Me}\p{Zs}\p{Zl}\p{Zp}\p{Default_Ignorable_Code_Point}\u2800]`;
U+2800 is not in any of those properties and is listed on its own.
`stripInvisible` is unchanged, on purpose: it is the stored-name
`\p{Cf}` rule, and widening it would rewrite `De\u2800v` into `Dev`
instead of refusing a name nobody can see. A name that draws something
keeps the blank it was written with, and the tests hold that.
## Why `core/client.js` is in this diff
`core/src/shared/mentions.js` is imported by the client
(`core/src/client/create-bot.js:11`), and
`core/scripts/build-client.mjs` ships every declaration (`treeShaking:
false`). Probed on this base: adding one line `export const __probe = 1`
to `mentions.js` makes `node scripts/build-client.mjs --check` fail with
`client.js is stale`. So the rule cannot change in one place without
rebuilding the committed bundle and its patch. The rebuild is 3 lines of
`client.js`; `patches/ds-bot/0001` and the `files/` mirror of the
touched test follow from `node scripts/ds-bot-patches.mjs generate`.
## Ran
- `TZ=UTC npm run verify` at this head: lint ok, `arch-docs: OK (7
changed file(s))`, `build-client --check` ok, `ds-bot-patches check` and
`canonical` ok, core suite **3149/3149**, plugin suites **619 / 149 /
172 / 531 / 147** all green.
- That run then reaches `.github/scripts` + `policy`: **674/675**, the
one failure `#749: the repository classifies every test file and every
workflow`. Every line it prints names `.cache/wt-2547/…`, a detached git
worktree of this repository that sits inside the workspace this was
built in: not in this diff, absent upstream, and it fails the same way
on untouched `main`.
- Because `verify` stops at that stage, the rest was run on its own at
the same tree: interop 37/37 (lint clean), live-e2e 34/34 (lint clean),
`node .github/scripts/changelog.mjs check` → 8 fragments well formed,
`core/test/name-identity.test.js` → 9/9 (twice).
Not run: smoke (no `core/index.js` or `core/src/host/` change), Desktop,
a real-model self-test.
## Base and shas
Base `55c5ab48af5de75fbd009c9dab97a74df85fb19c` (live `main` when this
was pushed). The push script overlays the branch onto the live base
tree, so the pushed head `33b0ef8b6acb6942c02e4d9ba861f0329c3e014a` is
not the local commit `965f8963e2978f486df66b1b3215cf716279f19f`: both
carry tree `c110813ca0`, and every check below ran on that tree.
Docs-not-needed: the name rule is already documented on
core-host.md#key-files and the client bundle note on core-client.md; no
architecture changed.
## Checkpoint
<!-- flybot:checkpoint -->
```json
{
"pr": 2929,
"claim": "Dev-5",
"issue": 2879,
"summary": "nameProblem() now refuses a Bot name made only of characters that draw nothing — the braille blank, the Hangul fillers and other default-ignorable points — with the existing sentence A Bot needs a name. It refuses at the new-Bot form, on creation and on rename, and stripInvisible is unchanged so a drawn name keeps its blanks. The tests walk each character through nameProblem, createBot and updateBot, and reverting mentions.js to the base blob turns exactly those three tests red. mentions.js ships in the client bundle, so core/client.js and patches/ds-bot/0008 were rebuilt here.",
"files": [
"core/src/shared/mentions.js",
"core/test/name-identity.test.js",
"core/client.js",
"patches/ds-bot/0001-core-fixes.patch",
"patches/ds-bot/0008-client-bundle.patch",
"changelog.d/2879-blank-bot-name.fixed.md"
],
"checks": {
"ran": "name-identity 9/9; mention-rule+face+flybot-client+client-bundle 47/47; build-client --check ok; ds-bot-patches check ok (this sandbox lacks jsdom, so only those DOM tests did not run; CI tests-ok green at this tip)",
"result": "green",
"at": "33b0ef8b6acb6942c02e4d9ba861f0329c3e014a"
},
"next": "none — PASS at this tip, ready for the merge queue"
}
```
<!-- /flybot:checkpoint -->
1 parent 99e0628 commit a83db91
7 files changed
Lines changed: 121 additions & 8 deletions
File tree
- changelog.d
- core
- test
- patches/ds-bot
- files/test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2451 | 2451 | | |
2452 | 2452 | | |
2453 | 2453 | | |
| 2454 | + | |
2454 | 2455 | | |
2455 | 2456 | | |
2456 | | - | |
| 2457 | + | |
2457 | 2458 | | |
2458 | 2459 | | |
2459 | 2460 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
25 | 31 | | |
26 | | - | |
| 32 | + | |
27 | 33 | | |
28 | 34 | | |
29 | | - | |
| 35 | + | |
30 | 36 | | |
31 | 37 | | |
32 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
97 | 145 | | |
98 | 146 | | |
99 | 147 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9547 | 9547 | | |
9548 | 9548 | | |
9549 | 9549 | | |
9550 | | - | |
| 9550 | + | |
9551 | 9551 | | |
9552 | 9552 | | |
9553 | 9553 | | |
| |||
9558 | 9558 | | |
9559 | 9559 | | |
9560 | 9560 | | |
| 9561 | + | |
| 9562 | + | |
| 9563 | + | |
| 9564 | + | |
| 9565 | + | |
| 9566 | + | |
9561 | 9567 | | |
9562 | | - | |
| 9568 | + | |
9563 | 9569 | | |
9564 | 9570 | | |
| 9571 | + | |
9565 | 9572 | | |
9566 | | - | |
| 9573 | + | |
9567 | 9574 | | |
9568 | 9575 | | |
| 9576 | + | |
9569 | 9577 | | |
9570 | 9578 | | |
9571 | 9579 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1763 | 1763 | | |
1764 | 1764 | | |
1765 | 1765 | | |
1766 | | - | |
| 1766 | + | |
1767 | 1767 | | |
1768 | 1768 | | |
1769 | 1769 | | |
| |||
1811 | 1811 | | |
1812 | 1812 | | |
1813 | 1813 | | |
| 1814 | + | |
1814 | 1815 | | |
1815 | 1816 | | |
1816 | | - | |
| 1817 | + | |
1817 | 1818 | | |
1818 | 1819 | | |
1819 | 1820 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
97 | 145 | | |
98 | 146 | | |
99 | 147 | | |
| |||
0 commit comments