From 05f1c3014d510d24d0fad0779548edd37dacf5ad Mon Sep 17 00:00:00 2001 From: Seongho Bae Date: Sat, 5 Sep 2026 05:24:35 +0900 Subject: [PATCH 1/2] test(collaboration): reject invalid connection status Signed-off-by: Seongho Bae Commit-Message-Assisted-by: Claude (via Claude Code) --- src/collaboration/awareness.test.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/collaboration/awareness.test.ts b/src/collaboration/awareness.test.ts index 4d41fbca4..bbaa6e986 100644 --- a/src/collaboration/awareness.test.ts +++ b/src/collaboration/awareness.test.ts @@ -218,6 +218,14 @@ describe('collaboration awareness presentation', () => { expect(collaborationConnectionLabel(status)).toBe(label); }); + it('rejects a runtime connection status outside the public states', () => { + expect(() => collaborationConnectionLabel('failed' as never)).toThrowError( + new RangeError( + 'Collaboration connection status must be connecting, connected, disconnected, or offline.', + ), + ); + }); + it('renders a text-only high-contrast cursor for valid remote data', () => { const cursor = renderCollaborationCursor({ name: 'Remote Alice', From 02f55466c0111bb53c6886f5d4a95de2068e944a Mon Sep 17 00:00:00 2001 From: Seongho Bae Date: Sat, 5 Sep 2026 05:24:49 +0900 Subject: [PATCH 2/2] fix(collaboration): reject invalid connection status Signed-off-by: Seongho Bae Commit-Message-Assisted-by: Claude (via Claude Code) --- src/collaboration/awareness.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/collaboration/awareness.ts b/src/collaboration/awareness.ts index 6525b580f..149b8028e 100644 --- a/src/collaboration/awareness.ts +++ b/src/collaboration/awareness.ts @@ -215,6 +215,8 @@ export function collaborationConnectionLabel( status: CollaborationConnectionStatus | undefined, ): string { switch (status) { + case undefined: + return 'Collaboration ready'; case 'connecting': return 'Connecting'; case 'connected': @@ -224,7 +226,9 @@ export function collaborationConnectionLabel( case 'offline': return 'Offline'; default: - return 'Collaboration ready'; + throw new RangeError( + 'Collaboration connection status must be connecting, connected, disconnected, or offline.', + ); } }