fix(chat): log WebSocket message handling errors instead of swallowing (mc#2908 F6) #3032
Reference in New Issue
Block a user
Delete Branch "fix/mobile-chat-f6-socket-error-logging"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes F6 from mobile-chat audit #2908.
The socket message handler in
useChatSocket.tshad a bare catch block that silently ignored parse/handling failures. This change surfaces them viaconsole.errorso malformed or unexpected payloads fail visibly during debugging and monitoring instead of being silently swallowed.Validation
npm run buildincanvas/passes.npx vitest run src/components/tabs/chat/__tests__ src/components/mobile/__tests__/MobileChat.test.tsxpasses (341/341).Relates-to: #2908
APPROVED after independent 5-axis review.
Correctness: malformed WebSocket payload handling now logs the caught error instead of silently swallowing it, without changing the event dispatch paths. Robustness: keeps the socket handler alive while making failures diagnosable. Security: no sensitive payload expansion beyond the existing caught exception object. Performance: only runs on exceptional paths. Readability: small, clear change.
APPROVED. 5-axis review on head
d676da4e.Correctness: replacing the bare catch in useChatSocket with a console.error preserves existing message-handling behavior while making malformed/exceptional socket payload handling visible, which is what mc#2908 F6 asks for.
Robustness/security/performance: no new parsing, trust boundary, or retry behavior is introduced; the handler still contains the exception locally and keeps the socket subscription alive. Logging the Error object is acceptable here and does not add secret material beyond what the existing thrown exception would contain in dev/console diagnostics.
Readability: scoped comment and message are clear. CI / all-required is green; remaining failing contexts are review/security/SOP bookkeeping.