Skip to content

Room labels still collide without a code, and slice(0, 6) truncates a stored code into a different room number #1005

Closed

Description

@Birfy

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}` : undefined

The 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:636 faceWaitCode: String(room?.joinCode || room?.code || '').replace(/\D/g, '').slice(0, 6), then if (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 :1842 if (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

  1. Red test (plugin): a stored joinCode of '1234567' must not yield the room 123456; the title fallback is used instead. At da17eb5f it yields the truncated number.
  2. 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).
  3. Red test (client): faceWaitCode({ joinCode: '1234567' }, '') === '' and faceWaitCode({ joinCode: '123456' }, '') === '123456'; the room-title builder (:1838-1842) does not append 123456 for '1234567'.
  4. Guards that stay green: exactly-6-digit codes still read the room 123456; a link-joined room still uses its title; a hold with no roomId still yields no card (the :2992 filter).
  5. 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/social suite green.

Out of scope

Activity

  1. Birfy commented on Oct 24, 2026

    @Birfy
    CollaboratorAuthor

    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.

  2. added
    bugSomething isn't working
    agent-readyMaintainer-approved spec: an agent may take it. Only maintainers set this; never in a template
    area:socialFriends, invites, grants, Bot Social
    area:uiWeb/desktop UI and copy
    on Oct 24, 2026
  3. Birfy commented on Oct 24, 2026

    @Birfy
    CollaboratorAuthor

    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.

    1. A code is exactly six digits. holdRoomName, faceWaitCode and shownFaceTitle all sliced first and tested the length after; a stored 1234567 became 123456, 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.
    2. Two live rooms with no number and the same title are told apart. A link-joined room keeps no number, so both read 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 reads the 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 labels the room Loft / api.faceWaitCode is not a function); this tip 433/433 in plugins/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

  4. added
    agent-workingAn agent has claimed this issue (the claim comment names the branch)
    on Oct 24, 2026
  5. self-assigned this
    on Oct 24, 2026
  6. removed
    agent-workingAn agent has claimed this issue (the claim comment names the branch)
    on Oct 24, 2026
  7. Birfy commented on Oct 24, 2026

    @Birfy
    CollaboratorAuthor

    done — the four closing items are checked on merge commit e019f149 (the main it landed on; main is now 44687c29):

    Labels cleaned: #1005 → bug|agent-ready|area:social|area:ui, #1011 → pass.

    Written-by: Dev

  8. removed
    agent-readyMaintainer-approved spec: an agent may take it. Only maintainers set this; never in a template
    on Oct 24, 2026
  9. added a commit that references this issue on Oct 24, 2026
    e019f14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:socialFriends, invites, grants, Bot Socialarea:uiWeb/desktop UI and copybugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions