fix(api): IRoomSession.password + sendBackgroundMessage + optional chatColour

The IRoomSession interface was missing three things that have always
existed on the RoomSession implementation:

- `password: string` — the room session's join password (used by the
  reconnect flow in RoomSessionManager).
- `sendBackgroundMessage(backgroundImage, backgroundStand, backgroundOverlay, backgroundCard?)`
  — sends the profile-background composer (used by the React client's
  BackgroundsView).

Plus a signature relaxation:
- `sendChatMessage` / `sendShoutMessage` `chatColour` is now optional.
  The implementation already accepted `undefined` (the composer forwards
  it through), and every historical call site in the React client passes
  only 2 args — making the 3rd optional simply types reality.

Net renderer typecheck: 26 → 23.
The change also drops 7 errors on the consumer side
(see ../Nitro-V3 typecheck after the workspace link picks this up).

CLAUDE.md gotchas updated to reflect the new interface contract.
This commit is contained in:
simoleo89
2026-05-10 21:48:49 +02:00
parent e82d3e03be
commit afb5f33ec2
2 changed files with 12 additions and 6 deletions
+8 -4
View File
@@ -109,10 +109,14 @@ for the React-side bridge code.
- **`SessionDataManager.getUserData(id)` does NOT exist.** Some legacy - **`SessionDataManager.getUserData(id)` does NOT exist.** Some legacy
code in the React client used it under a `getUserData ?` truthy guard; code in the React client used it under a `getUserData ?` truthy guard;
the branch was always dead. Only `getUserDataSnapshot()` exists. the branch was always dead. Only `getUserDataSnapshot()` exists.
- `IRoomSession.sendChatMessage` / `sendShoutMessage` require **3 args** - `IRoomSession.sendChatMessage` / `sendShoutMessage` accept an optional
(text, styleId, chatColour). The React client's chat-input legacy `chatColour` 3rd arg (was required pre-2.1.1, now optional to match
passes 2 — known pre-existing gap, do not "fix" the client without the historical call sites in the React client). The implementation
also threading chatColour through the chat composer pipeline. forwards `undefined` to the composer just fine; pass a value only when
you need a specific bubble colour.
- `IRoomSession.password` and `IRoomSession.sendBackgroundMessage` are
now part of the public interface (they always existed on the
implementation class — interface caught up).
- The renderer is **synchronous**: `EventDispatcher.dispatchEvent` is a - The renderer is **synchronous**: `EventDispatcher.dispatchEvent` is a
synchronous loop over listeners. Don't add `await` inside the synchronous loop over listeners. Don't add `await` inside the
`processEvent` loop — it would change ordering guarantees that `processEvent` loop — it would change ordering guarantees that
@@ -9,10 +9,11 @@ export interface IRoomSession
setRoomOwner(): void; setRoomOwner(): void;
start(): boolean; start(): boolean;
reset(roomId: number): void; reset(roomId: number): void;
sendChatMessage(text: string, styleId: number, chatColour: string): void; sendChatMessage(text: string, styleId: number, chatColour?: string): void;
sendShoutMessage(text: string, styleId: number, chatColour: string): void; sendShoutMessage(text: string, styleId: number, chatColour?: string): void;
sendWhisperMessage(recipientName: string, text: string, styleId: number): void; sendWhisperMessage(recipientName: string, text: string, styleId: number): void;
sendChatTypingMessage(isTyping: boolean): void; sendChatTypingMessage(isTyping: boolean): void;
sendBackgroundMessage(backgroundImage: number, backgroundStand: number, backgroundOverlay: number, backgroundCard?: number): void;
sendMottoMessage(motto: string): void; sendMottoMessage(motto: string): void;
sendDanceMessage(danceId: number): void; sendDanceMessage(danceId: number): void;
sendExpressionMessage(expression: number): void; sendExpressionMessage(expression: number): void;
@@ -50,6 +51,7 @@ export interface IRoomSession
sendScriptProceed(): void; sendScriptProceed(): void;
userDataManager: IUserDataManager; userDataManager: IUserDataManager;
roomId: number; roomId: number;
password: string;
state: string; state: string;
tradeMode: number; tradeMode: number;
isPrivateRoom: boolean; isPrivateRoom: boolean;