Commit c3756ff
docs(realtime): flatten WebSocket error fences onto ErrorMessageSchema (#17186)
`ErrorMessageSchema` (packages/spec/src/api/websocket.zod.ts) is the only schema
on this tree governing a `type: "error"` WebSocket message, and it is flat:
`messageId` / `type` / `timestamp` from `BaseWebSocketMessage`, then top-level
`code` and `message`, plus an optional `details` bag. The realtime protocol page
wrapped those fields in a nested `error` object in four fences, so a client
written from any of them reads `msg.error.code` and gets `undefined`.
Flatten all four (subscribe FORBIDDEN, TOO_MANY_SUBSCRIPTIONS, TOKEN_EXPIRED,
RATE_LIMITED) onto the declared envelope, move the extra per-fence context into
`details`, and fix the one consumer snippet that destructured the nested shape.
Mark the WebSocket rate-limiting section as not implemented: no producer emits
`RATE_LIMITED` on any realtime path and there is no WebSocket transport to carry
it, so the stated per-connection budget is planned, not enforced.
The `type: "auth_error"` fence is deliberately left alone: `auth_error` is not a
member of `WebSocketMessageType`, so `ErrorMessageSchema` does not govern it and
rewriting it would change the protocol rather than the prose.
Claude-Session: https://claude.ai/code/session_012GKcPZbMoGq7WPzKLfRBTU
Co-authored-by: Claude <noreply@anthropic.com>1 parent 65444d5 commit c3756ff
1 file changed
Lines changed: 41 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
266 | 273 | | |
267 | 274 | | |
| 275 | + | |
268 | 276 | | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
274 | 281 | | |
275 | 282 | | |
276 | 283 | | |
| |||
667 | 674 | | |
668 | 675 | | |
669 | 676 | | |
| 677 | + | |
670 | 678 | | |
671 | | - | |
672 | | - | |
673 | | - | |
674 | | - | |
675 | | - | |
676 | | - | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
677 | 683 | | |
678 | 684 | | |
679 | 685 | | |
| |||
1022 | 1028 | | |
1023 | 1029 | | |
1024 | 1030 | | |
| 1031 | + | |
1025 | 1032 | | |
1026 | | - | |
1027 | | - | |
1028 | | - | |
1029 | | - | |
1030 | | - | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
1031 | 1037 | | |
1032 | 1038 | | |
1033 | 1039 | | |
1034 | 1040 | | |
1035 | 1041 | | |
1036 | 1042 | | |
1037 | 1043 | | |
1038 | | - | |
| 1044 | + | |
1039 | 1045 | | |
1040 | 1046 | | |
1041 | 1047 | | |
| |||
1044 | 1050 | | |
1045 | 1051 | | |
1046 | 1052 | | |
1047 | | - | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
1048 | 1067 | | |
1049 | 1068 | | |
1050 | 1069 | | |
| 1070 | + | |
1051 | 1071 | | |
1052 | | - | |
1053 | | - | |
1054 | | - | |
1055 | | - | |
1056 | | - | |
1057 | | - | |
1058 | | - | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
1059 | 1075 | | |
1060 | 1076 | | |
1061 | 1077 | | |
1062 | | - | |
1063 | | - | |
1064 | | - | |
1065 | | - | |
1066 | 1078 | | |
1067 | 1079 | | |
1068 | 1080 | | |
| |||
0 commit comments