Commit 4c61c95
Go SDK: emit JSON-RPC error on pending-buffer overflow + guard drop
Carries the Rust SDK PR #1394 follow-up review fixes into the Go port:
1. Cap the per-session parked-waiter list at 128. When exceeded, reject
the oldest waiter with errPendingSessionBufferOverflow ('pending
session buffer overflow'). The handler returns a *jsonrpc2.Error with
code -32603 via the new pendingRoutingRPCError helper, so the runtime
receives a proper error response instead of hanging on the request id
until its own timeout. Mirrors Rust commit 491b442 and TS commit
c167bc3.
2. When the last pending-routing guard drops without RegisterSession
(e.g. session.create failed mid-RPC), signal all parked waiters with
errPendingSessionRoutingEnded ('pending session routing ended before
session was registered'). Distinct phrasing from the overflow path so
debugging can tell the two cases apart. Mirrors Rust commit e0ff254
and TS commit c167bc3.
Adds pendingRoutingRPCError helper that routes sentinel errors to
-32603 while unknown-session errors keep -32602.
Adds two tests:
- TestPendingRouting_OverflowEmitsError: 129 parked waiters, oldest
gets -32603 overflow error, remaining 128 resolve normally after
registration.
- TestPendingRouting_GuardDropDistinctMessage: parks a request, drops
the guard without registration, verifies exact routing-ended message
and -32603 code.
Updates TestPendingRouting_RejectsWaitersOnDispose to assert the new
exact message and code instead of the old 'dropped' substring check.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent e7734f8 commit 4c61c95
2 files changed
Lines changed: 156 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
91 | 98 | | |
92 | 99 | | |
93 | 100 | | |
| |||
1021 | 1028 | | |
1022 | 1029 | | |
1023 | 1030 | | |
1024 | | - | |
| 1031 | + | |
1025 | 1032 | | |
1026 | 1033 | | |
1027 | 1034 | | |
| |||
1076 | 1083 | | |
1077 | 1084 | | |
1078 | 1085 | | |
1079 | | - | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
1080 | 1089 | | |
1081 | 1090 | | |
1082 | | - | |
| 1091 | + | |
1083 | 1092 | | |
1084 | 1093 | | |
1085 | 1094 | | |
| |||
2126 | 2135 | | |
2127 | 2136 | | |
2128 | 2137 | | |
| 2138 | + | |
| 2139 | + | |
| 2140 | + | |
| 2141 | + | |
| 2142 | + | |
| 2143 | + | |
| 2144 | + | |
| 2145 | + | |
| 2146 | + | |
| 2147 | + | |
| 2148 | + | |
| 2149 | + | |
2129 | 2150 | | |
2130 | 2151 | | |
2131 | 2152 | | |
| |||
2134 | 2155 | | |
2135 | 2156 | | |
2136 | 2157 | | |
2137 | | - | |
| 2158 | + | |
2138 | 2159 | | |
2139 | 2160 | | |
2140 | 2161 | | |
| |||
2161 | 2182 | | |
2162 | 2183 | | |
2163 | 2184 | | |
2164 | | - | |
| 2185 | + | |
2165 | 2186 | | |
2166 | 2187 | | |
2167 | 2188 | | |
| |||
2185 | 2206 | | |
2186 | 2207 | | |
2187 | 2208 | | |
2188 | | - | |
| 2209 | + | |
2189 | 2210 | | |
2190 | 2211 | | |
2191 | 2212 | | |
| |||
2207 | 2228 | | |
2208 | 2229 | | |
2209 | 2230 | | |
2210 | | - | |
| 2231 | + | |
2211 | 2232 | | |
2212 | 2233 | | |
2213 | 2234 | | |
| |||
2230 | 2251 | | |
2231 | 2252 | | |
2232 | 2253 | | |
2233 | | - | |
| 2254 | + | |
2234 | 2255 | | |
2235 | 2256 | | |
2236 | 2257 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
317 | 317 | | |
318 | 318 | | |
319 | 319 | | |
320 | | - | |
321 | | - | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
322 | 447 | | |
323 | 448 | | |
324 | 449 | | |
| |||
0 commit comments