Skip to content

Number('') makes an empty members/maxMembers render as 0 / 8 in the room #823

Closed

Description

@Birfy

What is wrong

An empty members/maxMembers is shown as a real zero.

plugins/social/client.js:895-899:

const members = seen.members === undefined || seen.members === null ? NaN : Number(seen.members)
const maxMembers = seen.maxMembers === undefined || seen.maxMembers === null ? NaN : Number(seen.maxMembers)
const people = Number.isFinite(members) && Number.isFinite(maxMembers) ? `${members} / ${maxMembers} in the room` : …

Number('') is 0 (and so is Number(' ')), and '' is neither undefined nor null, so a server that sends an empty string produces 0 / 8 in the room — a room that looks empty when the count is simply unknown.

Expected behaviour

Only a value that actually reads as a number counts: a trimmed, non-empty string that parses to a finite number. '', ' ', 'eight' are "not sent" — the line falls back the same way it does for null. A real 0 (0 or '0') still renders 0 / 8, because an empty room is a real state.

Acceptance

  1. A fixture with members: '', maxMembers: 8 renders no 0 / 8 (the members half is treated as missing, so the one-number fallback applies, or the line disappears if both are missing).
  2. A fixture with members: '0', maxMembers: 8 renders 0 / 8 in the room.
  3. Whitespace (' 8 ') is either trimmed to 8 or treated as missing — pinned by a test either way, not left ambiguous.
  4. npm test in plugins/social green.

Kill conditions

  • Number(x) || NaN: turns a legitimate 0 into "missing".
  • parseInt: accepts '8abc' as 8.
  • Requiring both numbers before showing anything: that changes the one-number behaviour the issue asked for.
  • Fixing it in the server by sanitising the payload: the client already receives arbitrary values from older servers.

Out of scope

Activity

  1. 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 23, 2026
  2. HugoXK commented on Oct 23, 2026

    @HugoXK
    Contributor

    Written-by: Dev-3

    Claiming #823 for branch fix/823-empty-members-count (head repo HugoXK/FlyBot, PR against ThinkFlowLab/FlyBot main). Scope kept to plugins/social/client.js and one pinned test: a trimmed, non-empty value that parses to a finite number counts; ''/' '/non-numeric fall back to missing; a real 0 still renders.

  3. added
    agent-workingAn agent has claimed this issue (the claim comment names the branch)
    and removed
    agent-readyMaintainer-approved spec: an agent may take it. Only maintainers set this; never in a template
    on Oct 23, 2026
  4. removed
    agent-workingAn agent has claimed this issue (the claim comment names the branch)
    on Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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