Commit 4b63b11
fix(adkrest): limit /run_live WebSocket message size (#1664)
* fix(adkrest): limit /run_live WebSocket message size
* Address review: 16 MiB limit, unexported constant, mechanism test
Matches adk-python's uvicorn ws_max_size default (16 MiB). Unexports
the constant since nothing currently overrides it. Adds a
mechanism-level regression test for the SetReadLimit call: this
checkout's Agent interface has no way, via its public API, to build a
fake agent that supports live sessions (agent.New()'s returned type
does not implement the liveAgent interface RunLive() requires), so a
full RunLiveHandler integration test isn't achievable here without
separate, larger live-agent test scaffolding. This test instead
exercises the exact websocket.Upgrader + SetReadLimit configuration
the handler uses, in isolation.
* Address review: replace mechanism test with handler-level test
Removes runtime_live_limit_test.go (needed only because this branch
lacked live-agent test scaffolding at the time it was written) and
adds TestRunLiveHandlerEnforcesMessageSizeLimit to runtime_live_test.go
instead, using mockLiveAgent/dialRunLiveHandler to exercise
RunLiveHandler end to end, per review. golangci-lint's two reported
issues are not addressed by this commit -- see PR discussion.
---------
Co-authored-by: prasanna8585 <prasanna8585@users.noreply.github.com>
Co-authored-by: wolo <wolo@google.com>1 parent 65eff6f commit 4b63b11
2 files changed
Lines changed: 52 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
103 | 113 | | |
104 | 114 | | |
105 | 115 | | |
| |||
423 | 433 | | |
424 | 434 | | |
425 | 435 | | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
426 | 439 | | |
427 | 440 | | |
428 | 441 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
605 | 605 | | |
606 | 606 | | |
607 | 607 | | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
0 commit comments