Repository navigation
fix(sdk): keep a shut down client shut down - #4374
Conversation
|
Thanks for the PR. It is labeled Slash commands (own line, regular comment) move it around the queue:
See CONTRIBUTING.md for details. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4374 +/- ##
============================================
+ Coverage 87.84% 87.95% +0.11%
Complexity 1579 1579
============================================
Files 1290 1290
Lines 230143 230145 +2
Branches 193480 193481 +1
============================================
+ Hits 202169 202425 +256
+ Misses 23259 22970 -289
- Partials 4715 4750 +35
🚀 New features to boost your workflow:
|
|
/skill team-review-slim |
There was a problem hiding this comment.
Summary: The change makes shutdown final on TCP, QUIC and WebSocket by refusing every later state write, un-ignores the two integration tests that pin the contract, and drops the stale Python notes. One gap remains: a connect that is already dialing when shutdown() runs never re-reads the state, so it can still install a live stream and return Ok, which the new trait doc rules out.
Counts: critical 0, warning 1, nit 1, simplification 1
This review was generated by Claude Code 2.1.284 on deepseek-flash[1m]. Review the output before you act on it.
Which issue does this PR address?
Relates to #4287
Rationale
shutdown()must be final, as agreed on #4287: a client that is shut down must not connect again, whatever the caller does next. Problems 1 and 4 of #4287 break this rule. This PR fixes these two problems. Problems 2 and 3, aboutdisconnect(), come in a separate PR.What changed?
A client that was shut down could come back.
WebSocketClientdialed again onconnect(), because itsconnect_innerhad noShutdownarm. On every transport, adisconnect()aftershutdown()wroteDisconnectedoverShutdown, soconnect()worked again.Now one guard in
set_statekeepsShutdownfinal on TCP, QUIC and WebSocket, so no later write can revive the client. This guard also covers theDisconnectedwrites that other paths add, for example a timeout.WebSocketClient::connect_inneralso returnsClientShutdownbefore any dial, as TCP and QUIC already do. The guard alone does not stop that dial.The
Clienttrait now documents this contract onshutdown(). The two lifecycle tests from #4344 for these cases lose their#[ignore]. On the Python side, the strictxfailof the WebSocket case and the known-issue note ofshutdown()go away, because the bug is fixed.Local Execution
I used Zed in devcontainer mode. The build and the tests ran in the devcontainer, and
prekran on macOS.Passed:
cargo fmt --allandcargo clippy -p iggy_common -p iggy -p integration --all-features --all-targets -- -D warnings.Passed:
cargo test -p iggy --lib, with 232 tests.Passed: the lifecycle tests. The 4 cases of problems 1 and 4 pass, and the 6 cases of problems 2 and 3 stay ignored:
Passed: the
sdk::integration suite (63 passed, 6 ignored), in two runs, and thecluster::suite (80 passed), because the guard changes state transitions that reconnects and failovers use.Passed: the Python lifecycle tests against a local server, with no
xfailleft:Passed:
cargo run --bin stub_gen. The stub matches the edited docstring.Passed: pre-commit hooks with
SKIP=web-lint prek run --all-files. I skippedweb-lintbecause this PR does not changeweb/.AI Usage