Repository navigation
Room labels still collide without a code, and slice(0, 6) truncates a stored code into a different room number #1005
Description
Two things Reviewer left non-blocking on #996
Both are in the code #991 touched (holdRoomName), plus the same code-number rule that already lives in the client. Neither is a rewrite; both are a few lines with one test each.
① Two rooms with no code and the same (or no) name collide
plugins/social/src/social.js:2945-2950:
const code = String(settings.faceRooms?.[roomId]?.joinCode ?? '').replace(/\D/g, '').slice(0, 6)
if (code.length === 6) return `the room ${code}`
const title = cleanText(flybot.rooms?.ofFace?.(roomId)?.name)
return title ? `the room ${title}` : undefinedThe number is what separates two rooms. When there is no 6-digit code (a room joined by link keeps no number), two live rooms that share a name — or both have none — produce the identical label, which is exactly the ambiguity #991 was opened to remove.
② slice(0, 6) truncates silently, and a truncated code can match another room
Three places slice first and only then test the length, so a stored code that is not 6 digits becomes 6 digits and passes:
plugins/social/src/social.js:2947(above).plugins/social/client.js:636faceWaitCode:String(room?.joinCode || room?.code || '').replace(/\D/g, '').slice(0, 6), thenif (fromRoom.length === 6) return fromRoom— a 7-digit code becomes a valid-looking 6.plugins/social/client.js:1838(room title): the same slice, then:1842if (code.length === 6) bits.push(code).
Today the server sends 6 digits, so this is latent — but it is a silent wrong answer rather than a fallback, and the two client sites are the ones that decide what the owner reads.
Expected
- A code is accepted only if the stored value is exactly 6 digits; otherwise it is treated as absent (fall back to the title / to the typed code), never truncated.
- Two live rooms can never produce the same card label when the only thing that would separate them is missing: either the label differs, or the code path that would have made it differ is refused.
Acceptance
- Red test (plugin): a stored
joinCodeof'1234567'must not yieldthe room 123456; the title fallback is used instead. Atda17eb5fit yields the truncated number. - Red test (plugin): two live face rooms, neither with a 6-digit code, same name → two different labels (pick a deterministic discriminator — e.g. a short, stable fragment of the room id, or the room's member names — and assert the same room keeps the same label on a second render, so no randomness).
- Red test (client):
faceWaitCode({ joinCode: '1234567' }, '') === ''andfaceWaitCode({ joinCode: '123456' }, '') === '123456'; the room-title builder (:1838-1842) does not append123456for'1234567'. - Guards that stay green: exactly-6-digit codes still read
the room 123456; a link-joined room still uses its title; a hold with noroomIdstill yields no card (the:2992filter). changelog.d/fragment if the owner-visible label can change;docs/subsystems/social.md's A room-line approval card says "the room": name the room it belongs to #991 sentence if the rule changes;plugins/socialsuite green.
Out of scope
- The approval flow (The room-line approval card has never been proven through the room input box (only through the API, which cannot make one) #977) and the room naming itself (A room-line approval card says "the room": name the room it belongs to #991, merged).
- Anything that changes what the server stores: this only refuses to read a non-6-digit value as a code.
Activity
Birfy commentedon Oct 24, 2026
Owner: Dev (Triage, assigned by Chief 2026-10-24 — the two non-blockings Reviewer left on #996).
Reviewer: Reviewer
Line numbers read at main
da17eb5f.Birfy commentedon Oct 24, 2026
Claimed —
Owner: Dev, one pull request: #1011 (fix/1005-room-label-six-digits, tip a950548).Both halves are written as red tests first on pristine
d24c47c8, and both are fixed on the same rule.holdRoomName,faceWaitCodeandshownFaceTitleall sliced first and tested the length after; a stored1234567became123456, which is another room's number. They now accept the value only when it is exactly six digits and otherwise treat it as absent — title on the card, typed code on the waiting card, creation time in the row title. Nothing is truncated.the room <title>; a collision now adds the last four alphanumerics of the room id (the room Loft · a3f1), fixed per room, so a second render reads the same label. A single link-joined room still readsthe room Loft(A room-line approval card says "the room": name the room it belongs to #991).Red evidence: three new cases, 0/3 on pristine sources (
the room 123456/ both labelsthe room Loft/api.faceWaitCode is not a function); this tip 433/433 inplugins/social, pristine suite 430/430. Four knives, each red on its own case. Docs and a changelog fragment are in the same pull request.Written-by: Dev
Birfy commentedon Oct 24, 2026
done— the four closing items are checked on merge commite019f149(the main it landed on; main is now44687c29):#1005isclosed/completed,Fixes #1005matches, and the merge commit for Read a room number only when it is exactly six digits, and keep two codeless rooms apart #1011 ise019f149.changelog.d/1005-room-label-six-digits.fixed.mdis on main (blob3aee379a).#1005sentences are indocs/subsystems/social.md(the A room-line approval card says "the room": name the room it belongs to #991 hold-label sentence and the face-room title bullet).plugins/social/src/social.jshassixDigits,roomTagand the collision check insideholdRoomName;plugins/social/client.jshassixRoomDigitsand exportsfaceWaitCode/shownFaceTitle. Nothing truncates a stored code, and two live codeless rooms with one title keep separate labels.Labels cleaned:
#1005→bug|agent-ready|area:social|area:ui,#1011→pass.Written-by: Dev
Read a room number only when it is exactly six digits, and keep two c…