Skip to content

Commit 99554ed

Browse files
HugoXKFlyBot Dev-3Dev-3
authored
fix(names): refuse a Bot name whose drawn form is already taken (#2937)
Fixes #2935 Owner: Dev-3 Reviewer: Reviewer Written-by: Dev-3 Bot: FlyBot Dev-3 Claim-Id: 9b98f5ad369a4641a8f132f75b2a934c Risk tier: T3 — `core/src/shared/**` is T3 in `.github/agent/risk-rules.json` (`identity.js`, `mentions.js`); `core/src/host/**` is T2; `core/test/**`, `core/client.js`, `patches/**`, `changelog.d/**` are T1 and `docs/**` T0, so the highest is T3 Base: 95a793e Verified commit: 302a626 (tree 58c30dd) ## What this changes `#2879` refused only a name that draws nothing at all. A name that draws something and also carries a character the screen does not draw still passed: `Dev` plus a combining grapheme joiner kept the identity key `dev\u034f` beside `dev`, both rows read `Dev`, and `@Dev` could only ever reach the one whose key is `dev`. - `core/src/shared/identity.js` adds `drawnKey(value)`: `nameKey()` with the code points that have no glyph of their own removed. `core/src/shared/mentions.js` exports that explicit set as `NOT_DRAWN`. - `core/src/host/roster.js` compares the drawn form in `createBot` and `updateBot` beside the identity key, from either side, with the sentences already in use (`A Bot named … already exists` / `Name … is not available`). Nothing is stripped from the stored name, and a drawn form nobody holds is still a name. - `core/test/name-identity.test.js`: four new tests (the pure key, create, rename, and the reverse case where the drawn spelling is held first), plus a **counter-control**: two Thai names that differ only in a combining vowel are both created. The `#2879` create test built `De\u2800v` beside `Dev` — exactly the shape this rule now refuses — so its seed renames `dev` to `Devx`, keeping its point (a blank between drawn characters is part of the name); every other assertion there is unchanged. - `docs/subsystems/core-host.md` and `core-client.md` say what the drawn key is and that the bundle carries it; one fragment `changelog.d/2935-rendered-name-dedupe.fixed.md`. - Regenerated `core/client.js` and `patches/ds-bot/` (0008 carries the bundle, 0001/0002 the two shared/host files, `files/` mirrors the whole files) in this same PR; the lane was free. ### The set: glyph-less code points, not the whole `\p{Mn}` class A combining mark is drawn by the letter it sits on — `กิ` and `กี` are two different names on screen — so `NOT_DRAWN` is an explicit list, never a Unicode combining class: U+034F (CGJ), U+115F/U+1160/U+3164/U+FFA0 (Hangul fillers), U+17B4/U+17B5 (Khmer inherent vowels), U+180B–U+180D/U+180F (Mongolian free variation selectors), U+2800 (braille blank), U+FE00–U+FE0F and U+E0100–U+E01EF (variation selectors). `\p{Cf}` is still dropped earlier by `stripInvisible`, so it is not listed twice. `nameProblem` keeps its wider "draws nothing" class: a name made only of a lone combining mark or a separator still draws nothing and is still refused (`#2879`), while a mark beside a letter is a drawn name. ## Red first (tests before the source, on base 95a793e) With the final test file on the base, the suite stops at the import: `SyntaxError: The requested module '../src/shared/identity.js' does not provide an export named 'drawnKey'`. Running the same file with the two `drawnKey` assertions taken out (so the file is importable on base) shows the three behavioral tests are real reds: ``` not ok 7 - #2935 the create path refuses a name whose drawn form is already taken error: 'Missing expected rejection: ["44","65","76","34f"]' (core/test/name-identity.test.js:193) not ok 8 - #2935 the rename path refuses a drawn name that is taken, and a free drawn name lands error: 'Missing expected rejection: ["44","65","76","34f"]' (core/test/name-identity.test.js:204) not ok 9 - #2935 a drawn blank beside drawn characters is a name, and it takes that drawn form error: 'Missing expected rejection.' (core/test/name-identity.test.js:221) ``` The counter-control (`#2935 a combining mark is drawn with its letter, so both spellings are names`) passes on the base by construction — that is the point: it is the guard that the fix must not over-refuse. After the source change the whole file is **14/14, twice**. ## Mutation Each check reverted one piece of the fix at this tip and reran the file; every variant went red and the restored tip is 14/14 again: - A — `drawnKey` made equal to `nameKey`: 4 red (pure key + create + rename + reverse). - B — the create-side `drawnClash` removed: 2 red. - C — the rename-side `drawnClash` removed: 1 red. - D — `drawnKey` strips the whole `\p{Mn}` class instead of the explicit list (the reverse of this fix): 2 red, including the counter-control — its second Thai name is refused as "already exists". ## Checks at this tip (302a626) - `node --import ./test/harness-resolve.mjs --test test/name-identity.test.js` (TZ=UTC, `DSH_HARNESS`, `TMPDIR`) → **14/14**, run twice. - Full suite on `95a793ef`: **3157 / 3132 pass / 25 fail**; at this tip: **3162 / 3137 pass / 25 fail**. Compared failure names one by one: identical sets (the 25 are the standing base failures: bench/EROFS, `#1433` ×3, `#1718`, `#2057`, the symlink probes, `#896` ×3, `#2167` ×2 …). The branch adds exactly the five new `#2935` tests, all green. - `node core/scripts/build-client.mjs --check` → exit 0; `node scripts/ds-bot-patches.mjs check` → pin ok, 10 patches apply cleanly, `core/` equals `ds-bot/` + patches. - `node core/scripts/check-arch-docs.mjs` → `OK (106 changed file(s))`; `node .github/scripts/check-mojibake.mjs --check` → 0 U+FFFD. - `cd core && npm run lint` → 0 errors, 88 warnings (the standing count). - Not run: the smoke test — this checkout cannot start the bench (`EROFS` symlinking the pnpm store into it), same as on `#2933`; CI covers it. `maintainer_can_modify: true`, non-draft. ## Checkpoint <!-- flybot:checkpoint --> ```json { "pr": 2937, "claim": "Dev-3", "issue": 2935, "summary": "A Bot name whose drawn form another Bot holds is refused by createBot and updateBot, from either side: two rows that read the same on screen but differed only by an invisible code point used to coexist, and @name could reach just one. The drawn key removes only the code points with no glyph of their own — an explicit list, not the whole Mn class, so a combining mark that draws on its letter keeps two Thai names apart. Nothing is stripped from a stored name.", "files": [ "core/src/shared/identity.js", "core/src/shared/mentions.js", "core/src/host/roster.js", "core/test/name-identity.test.js", "core/client.js", "patches/ds-bot/0008-client-bundle.patch", "docs/subsystems/core-host.md", "changelog.d/2935-rendered-name-dedupe.fixed.md" ], "checks": { "ran": "name-identity (--test); full suite on base and tip; build-client --check; ds-bot-patches check; check-arch-docs; mojibake; lint", "result": "green", "at": "302a6266526e08d8450439c4815f7052a571ea62" }, "next": "none — ready for review; T3 needs a PASS at this tip" } ``` <!-- /flybot:checkpoint --> --------- Co-authored-by: FlyBot Dev-3 <dev3@flybot.local> Co-authored-by: Dev-3 <dev-3@flybot.local>
1 parent 95a793e commit 99554ed

13 files changed

Lines changed: 865 additions & 714 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
A Bot name whose **drawn** form is already taken is refused. `#2879` refused only a name that draws nothing at all; a name that draws something and also carries a character the screen does not draw still passed, so `Dev` plus a combining grapheme joiner (or a braille blank, or a Hangul filler) sat beside the existing `Dev`: both rows read `Dev` while the identity key stayed distinct, and `@Dev` could only ever reach one of them. `createBot` and `updateBot` now compare `drawnKey()` — `nameKey()` with the code points that have no glyph of their own removed — beside `nameKey()`, from either side. A combining mark is not one of them: the letter under it draws it, so two names that differ there stay two names. A drawn form nobody holds is still a name, and nothing is stripped from the stored name ([#2935](https://github.com/ThinkFlowLab/FlyBot/issues/2935)).

‎core/client.js‎

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2451,10 +2451,23 @@ var LITERAL = /```[\s\S]*?(?:```|$)|`[^`\n]*`|\[[^\]\n]*\]\([^)\s]*(?:\s+(?:"[^"
24512451
var fitsAt = (text2, at, word) => text2.slice(at, at + word.length).toLowerCase() === word.toLowerCase() && !NAME_GOES_ON.test(text2.slice(at + word.length));
24522452
var overlaps = (spans, start, end) => spans.some((span) => start < span.end && span.start < end);
24532453
var stripInvisible = (value) => String(value ?? "").replace(/\p{Cf}/gu, "");
2454-
var NOT_DRAWN = /[\p{Mn}\p{Me}\p{Zs}\p{Zl}\p{Zp}\p{Default_Ignorable_Code_Point}\u2800]/gu;
2454+
var NOT_DRAWN_RANGES = [
2455+
[847, 847],
2456+
[4447, 4448],
2457+
[6068, 6069],
2458+
[6155, 6157],
2459+
[6159, 6159],
2460+
[10240, 10240],
2461+
[12644, 12644],
2462+
[65440, 65440],
2463+
[65024, 65039],
2464+
[917760, 917999]
2465+
];
2466+
var NOT_DRAWN = new RegExp(`[${NOT_DRAWN_RANGES.map(([from, to]) => `\\u{${from.toString(16)}}${to === from ? "" : `-\\u{${to.toString(16)}}`}`).join("")}]`, "gu");
2467+
var DRAWS_NOTHING = /[\p{Mn}\p{Me}\p{Zs}\p{Zl}\p{Zp}\p{Default_Ignorable_Code_Point}\u2800]/gu;
24552468
function nameProblem(name) {
24562469
const text2 = stripInvisible(name).trim();
2457-
if (text2 === "" || text2.replace(NOT_DRAWN, "").trim() === "") return "A Bot needs a name";
2470+
if (text2 === "" || text2.replace(DRAWS_NOTHING, "").trim() === "") return "A Bot needs a name";
24582471
if (/[@`\r\n]/.test(text2)) return "A Bot name cannot contain @, ` or a line break";
24592472
if (ALL_WORDS.includes(text2.toLowerCase())) return `"${text2}" calls everyone in a group, so it cannot be a Bot name`;
24602473
return void 0;
@@ -8774,6 +8787,7 @@ body[data-ds-dark-theme] .bt-mw-ask{color:#f0b84a}
87748787

87758788
// src/shared/identity.js
87768789
var nameKey = (value) => stripInvisible(String(value ?? "").normalize("NFC")).trim().toLowerCase().normalize("NFC");
8790+
var drawnKey = (value) => nameKey(value).replace(NOT_DRAWN, "");
87778791

87788792
// src/shared/task-board.js
87798793
var COLUMNS = ["not-started", "in-progress", "done"];

‎core/src/host/roster.js‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { join } from 'node:path'
55
import { COLORS, EXTRA_COLORS, MAX_AVATAR_IMAGE, ROOM_MAX_MEMBERS, ROOM_MODES, ROOM_NAME_MAX, ROOM_NOTICE_MAX } from './constants.js'
66
import { currentColor, cut, isColor, stripInvisible, unquote } from './text.js'
77
import { nameProblem } from '../shared/mentions.js'
8+
import { drawnKey } from '../shared/identity.js'
89
import { cleanExternal } from './room-participant-external.js'
910
import { currentParticipants, implicitRoomOwner, syncMembers } from './room-membership.js'
1011
import { ownEntry } from './store.js'
@@ -59,6 +60,14 @@ export function install(rt) {
5960
return `${stem} ${index}`
6061
}
6162

63+
// Two names that draw the same read as one Bot on screen, and an `@` only ever reaches the one
64+
// whose `nameKey` matches: the other row can be seen and never called. A stored name keeps the
65+
// characters that draw nothing (#2879), so the guard compares the drawn form as well (#2935).
66+
const drawnClash = (name, exceptId) => {
67+
const drawn = drawnKey(name)
68+
return Object.values(state.bots).find(bot => bot.remote === undefined && bot.id !== exceptId && drawnKey(bot.name) === drawn)
69+
}
70+
6271
// `pickModel` leaves the model to the user: the chat opens on a model card. So does a
6372
// Bot made when no model is served.
6473
async function createBot({ name: botName, role = '', instructions = '', color, brief = '', createdBy, main = false, avatar, model, effort, workDir, pickModel = false, systemPrompt, fields, remote, external, ownerId: explicitOwnerId, hidden, ephemeral }) {
@@ -72,6 +81,7 @@ export function install(rt) {
7281
const problem = nameProblem(cleanName)
7382
if (problem !== undefined) throw new Error(problem)
7483
if (rt.findBot(cleanName)) throw new Error(`A Bot named ${cleanName} already exists`)
84+
if (drawnClash(cleanName) !== undefined) throw new Error(`A Bot named ${cleanName} already exists`)
7585
} else if (cleanName === '') throw new Error('A friend\'s Bot needs a name')
7686
const cleanAvatarValue = cleanAvatar(avatar)
7787
// Validated before the Session exists: a record that cannot be run leaves nothing behind (#198).
@@ -194,9 +204,10 @@ export function install(rt) {
194204
if (patch.name !== undefined) {
195205
const next = cut(stripInvisible(String(patch.name)).trim(), 40).text
196206
const clash = rt.findBot(next)
197-
if (next === '' || (clash && clash.id !== id)) throw new Error(`Name ${next} is not available`)
198207
// A name saved before the rule stays usable until it changes.
199-
const problem = next === bot.name ? undefined : nameProblem(next)
208+
const changed = next !== bot.name
209+
if (next === '' || (clash && clash.id !== id) || (changed && drawnClash(next, id) !== undefined)) throw new Error(`Name ${next} is not available`)
210+
const problem = changed ? nameProblem(next) : undefined
200211
if (problem !== undefined) throw new Error(problem)
201212
// The title write is the one step here that can refuse, so the record moves only after
202213
// it has: a refused rename leaves the Bot, its rooms and the store as they were (#2622).

‎core/src/shared/identity.js‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
// a name that is also a file name cannot drift apart. Both canonical spellings (NFC and NFD) of one
33
// visible name are one key, and so are the invisible format characters `trim()` keeps. The NFC pass
44
// runs again after lowercasing because a lower can compose a new sequence (U+0130).
5-
import { stripInvisible } from './mentions.js'
5+
import { NOT_DRAWN, stripInvisible } from './mentions.js'
66

77
export const nameKey = value => stripInvisible(String(value ?? '').normalize('NFC')).trim().toLowerCase().normalize('NFC')
8+
9+
// The drawn form of a name (#2935): what the screen shows, with the characters that draw nothing
10+
// removed. `NOT_DRAWN` is the explicit list of glyph-less code points, so a combining mark stays:
11+
// the letter under it draws it, and two names that differ there read as two names. NFC runs in
12+
// `nameKey` first, so a mark it composes is already part of the letter. Two names with one drawn
13+
// form read as one Bot, while `nameKey` still tells them apart and `findBot` can only reach one of
14+
// them by an `@`; the roster refuses the second.
15+
export const drawnKey = value => nameKey(value).replace(NOT_DRAWN, '')

‎core/src/shared/mentions.js‎

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,34 @@ const overlaps = (spans, start, end) => spans.some(span => start < span.end && s
2222
// (#2691) drops them, and a stored name drops them too, so what is saved is what is shown.
2323
export const stripInvisible = value => String(value ?? '').replace(/\p{Cf}/gu, '')
2424

25-
// What draws nothing is wider than what `stripInvisible` removes: a braille blank, a Hangul
26-
// filler, a combining grapheme joiner, a no-break space and the other default-ignorable code
27-
// points survive both `\p{Cf}` and `trim()`, so a name made of them would render as an empty
28-
// name. A name is refused on them, but they are never stripped out of a name that draws.
29-
const NOT_DRAWN = /[\p{Mn}\p{Me}\p{Zs}\p{Zl}\p{Zp}\p{Default_Ignorable_Code_Point}\u2800]/gu
25+
// What draws nothing wherever it sits is an explicit list, not a Unicode class (#2935): a
26+
// combining mark is drawn by the letter it sits on — `กิ` and `กี` are two names on screen — so
27+
// only the code points with no glyph of their own belong here: the combining grapheme joiner, the
28+
// Hangul fillers (U+115F, U+1160, U+3164, and the halfwidth U+FFA0), the Khmer inherent vowels, the
29+
// Mongolian free variation selectors (U+180B–U+180D, U+180F), the braille blank, and the variation
30+
// selectors (U+FE00–U+FE0F, U+E0100–U+E01EF). The format characters (Cf) go earlier, in
31+
// `stripInvisible`. These characters are never stripped out of a stored name; the drawn form of a
32+
// name removes them for comparison only (#2935, `drawnKey`). The ranges are numbers rather than a
33+
// character class of their own, so a combining mark in the source cannot merge with a neighbour.
34+
const NOT_DRAWN_RANGES = [
35+
[0x034f, 0x034f], [0x115f, 0x1160], [0x17b4, 0x17b5], [0x180b, 0x180d], [0x180f, 0x180f],
36+
[0x2800, 0x2800], [0x3164, 0x3164], [0xffa0, 0xffa0], [0xfe00, 0xfe0f], [0xe0100, 0xe01ef],
37+
]
38+
// Matched with `replace` alone — never `test` or `exec`, which would carry `lastIndex` between
39+
// callers.
40+
export const NOT_DRAWN = new RegExp(`[${NOT_DRAWN_RANGES.map(([from, to]) =>
41+
`\\u{${from.toString(16)}}${to === from ? '' : `-\\u{${to.toString(16)}}`}`).join('')}]`, 'gu')
42+
43+
// What a name may not consist of (#2879): `NOT_DRAWN` plus the marks and separators that draw
44+
// nothing on their own, which `stripInvisible` and `trim()` may keep. Wider than `drawnKey` on
45+
// purpose — a mark beside a letter draws, but a name made only of marks draws nothing.
46+
const DRAWS_NOTHING = /[\p{Mn}\p{Me}\p{Zs}\p{Zl}\p{Zp}\p{Default_Ignorable_Code_Point}\u2800]/gu
3047

3148
// What a Bot may be named: something "@" can call without a second reading. A name made
3249
// only of characters that draw nothing reads as no name at all (#2879).
3350
export function nameProblem(name) {
3451
const text = stripInvisible(name).trim()
35-
if (text === '' || text.replace(NOT_DRAWN, '').trim() === '') return 'A Bot needs a name'
52+
if (text === '' || text.replace(DRAWS_NOTHING, '').trim() === '') return 'A Bot needs a name'
3653
if (/[@`\r\n]/.test(text)) return 'A Bot name cannot contain @, ` or a line break'
3754
if (ALL_WORDS.includes(text.toLowerCase())) return `"${text}" calls everyone in a group, so it cannot be a Bot name`
3855
return undefined

‎core/test/name-identity.test.js‎

Lines changed: 80 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { join } from 'node:path'
88
import { test } from 'node:test'
99
import { createRuntime } from '../index.js'
1010
import { nameProblem } from '../src/shared/mentions.js'
11+
import { drawnKey, nameKey } from '../src/shared/identity.js'
1112
import { normalize } from '../src/host/text.js'
1213
import { fakeContext } from './fake-ctx.js'
1314

@@ -120,7 +121,11 @@ test('#2879 a name that draws nothing is refused as empty, whichever characters
120121
})
121122

122123
test('#2879 the create path refuses a name that draws nothing and stores none of them', async (t) => {
123-
const { rt, state } = setup(t)
124+
const seed = TEAM()
125+
// No Bot draws the `De\u2800v` spelling created below: a blank beside drawn characters is a name,
126+
// but it may not sit next to the same drawn name (#2935).
127+
seed.bots.dev.name = 'Devx'
128+
const { rt, state } = setup(t, seed)
124129
await rt.load()
125130
for (const name of DRAWS_NOTHING) {
126131
await assert.rejects(rt.createBot({ name, pickModel: true }), /A Bot needs a name/, codePoints(name))
@@ -142,6 +147,80 @@ test('#2879 a rename to a name that draws nothing is refused, and a drawn rename
142147
assert.equal(state().bots.dev.name, 'De\u2800vOps')
143148
})
144149

150+
// #2935: "draws something, plus a character the screen does not draw" is still two Bots reading
151+
// one name. `\p{Cf}` is gone before the key is built, but a combining grapheme joiner, a braille
152+
// blank and the Hangul fillers survive it and `trim()`, so `Dev\u034f` keeps the key `dev\u034f`
153+
// beside `dev` while both rows read `Dev` — and `@Dev` can only ever reach the key `dev`. These are
154+
// the code points with no glyph of their own, listed one by one; a combining mark is not one of
155+
// them, because the letter under it draws it.
156+
const DRAWN_SAME_AS_DEV = [
157+
'Dev\u034f', // COMBINING GRAPHEME JOINER (Mn, zero width)
158+
'Dev\u2800', // BRAILLE PATTERN BLANK beside a drawn name
159+
'De\u3164v', // HANGUL FILLER (Default_Ignorable_Code_Point, Lo)
160+
'De\u115fv', // HANGUL CHOSEONG FILLER (Default_Ignorable_Code_Point, Lo)
161+
]
162+
163+
test('#2935 the drawn key drops what draws nothing, and keeps a mark NFC composes', () => {
164+
for (const name of DRAWN_SAME_AS_DEV) assert.equal(drawnKey(name), 'dev', codePoints(name))
165+
assert.equal(drawnKey('Dev'), 'dev')
166+
// NFC runs inside `nameKey`, so an accent a canonical composition draws with its letter is part
167+
// of the name and not one of the characters this key removes.
168+
assert.equal(nameKey('Cafe\u0301'), nameKey('Caf\u00e9'))
169+
assert.equal(drawnKey('Cafe\u0301'), 'caf\u00e9')
170+
// A combining mark that does not compose is drawn with the letter it sits on, so it stays in the
171+
// drawn form: the vowel in these two Thai names is visible, and they are two names (#2935).
172+
assert.equal(drawnKey('\u0e01\u0e34'), '\u0e01\u0e34')
173+
assert.notEqual(drawnKey('\u0e01\u0e34'), drawnKey('\u0e01\u0e35'))
174+
})
175+
176+
// The counter-control for the narrowing: the fix may refuse only names that draw the same, so a
177+
// combining mark — which draws on its letter — must leave two names apart. A class-wide `\p{Mn}`
178+
// strip would collapse these two onto one drawn form and refuse the second as "already exists".
179+
test('#2935 a combining mark is drawn with its letter, so both spellings are names', async (t) => {
180+
const { rt, state } = setup(t)
181+
await rt.load()
182+
const first = await rt.createBot({ name: '\u0e01\u0e34', pickModel: true })
183+
const second = await rt.createBot({ name: '\u0e01\u0e35', pickModel: true })
184+
assert.equal(state().bots[first.id].name, '\u0e01\u0e34')
185+
assert.equal(state().bots[second.id].name, '\u0e01\u0e35', 'the vowel is drawn, so this is a second drawn name')
186+
})
187+
188+
test('#2935 the create path refuses a name whose drawn form is already taken', async (t) => {
189+
const { rt, state, home } = setup(t)
190+
await rt.load()
191+
const before = readFileSync(join(home, 'state.json'))
192+
for (const name of DRAWN_SAME_AS_DEV) {
193+
await assert.rejects(rt.createBot({ name, pickModel: true }), /A Bot named .* already exists/, codePoints(name))
194+
}
195+
assert.deepEqual(readFileSync(join(home, 'state.json')), before, 'a refused create writes nothing')
196+
assert.deepEqual(Object.keys(state().bots).sort(), ['cafe', 'chief', 'dev', 'ops'], 'a refused create leaves no record behind')
197+
})
198+
199+
test('#2935 the rename path refuses a drawn name that is taken, and a free drawn name lands', async (t) => {
200+
const { rt, state, home } = setup(t)
201+
await rt.load()
202+
const before = readFileSync(join(home, 'state.json'))
203+
for (const name of DRAWN_SAME_AS_DEV) {
204+
await assert.rejects(rt.updateBot('ops', { name }), /Name .* is not available/, codePoints(name))
205+
}
206+
assert.deepEqual(readFileSync(join(home, 'state.json')), before, 'a refused rename writes nothing')
207+
assert.equal(state().bots.ops.name, 'Ops', 'a refused rename leaves the stored name alone')
208+
await rt.updateBot('ops', { name: 'De\u2800vOps' })
209+
assert.equal(state().bots.ops.name, 'De\u2800vOps', 'a drawn form no Bot holds is still a name')
210+
})
211+
212+
test('#2935 a drawn blank beside drawn characters is a name, and it takes that drawn form', async (t) => {
213+
const seed = TEAM()
214+
seed.bots.dev.name = 'Devx'
215+
const { rt, state } = setup(t, seed)
216+
await rt.load()
217+
const created = await rt.createBot({ name: 'De\u2800v', pickModel: true })
218+
assert.equal(state().bots[created.id].name, 'De\u2800v', 'no Bot draws De\u2800v yet, so it is created')
219+
// Once that row exists, its drawn form is taken: a plain `Dev` would read as the same row and
220+
// no `@` can tell the two apart, so it is refused from either side.
221+
await assert.rejects(rt.createBot({ name: 'Dev', pickModel: true }), /A Bot named Dev already exists/)
222+
})
223+
145224
test('#2691 a stored name is found by either canonical spelling or with an invisible character', async (t) => {
146225
const { rt } = setup(t)
147226
await rt.load()

‎docs/subsystems/core-client.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ owned_paths:
77

88
# core-client
99

10-
The browser side of the patched `ds-bot` core (`core/`): sources in `core/src/client/`, built into the committed bundle `core/client.js`. Split out of [ds-bot-core](ds-bot-core.md) so a host-only change does not have to edit this page. `client.js` is generated: never hand-edit it, run `npm run build` in `core/` and commit both. The bundle also carries the `core/src/shared/` modules the client imports — `mentions.js` (the `@Name` rule, `nameProblem` and `stripInvisible`), `text-boundary.js`, `remote-label.js`, `approval-waiting.js`, `room-share.js`, `identity.js` (the name key `nameKey`, #2692, which `task-board.js` compares a role label with) among them — so a change in one of those rebuilds `client.js` too even when no file under `core/src/client/` was edited; the rules themselves are documented on [core-host](core-host.md#key-files).
10+
The browser side of the patched `ds-bot` core (`core/`): sources in `core/src/client/`, built into the committed bundle `core/client.js`. Split out of [ds-bot-core](ds-bot-core.md) so a host-only change does not have to edit this page. `client.js` is generated: never hand-edit it, run `npm run build` in `core/` and commit both. The bundle also carries the `core/src/shared/` modules the client imports — `mentions.js` (the `@Name` rule, `nameProblem` and `stripInvisible`), `text-boundary.js`, `remote-label.js`, `approval-waiting.js`, `room-share.js`, `identity.js` (the name keys `nameKey`, #2692, which `task-board.js` compares a role label with, and `drawnKey`, #2935) among them — so a change in one of those rebuilds `client.js` too even when no file under `core/src/client/` was edited; the rules themselves are documented on [core-host](core-host.md#key-files).
1111

1212
## Owns
1313

0 commit comments

Comments
 (0)