deepseek-v4-pro f25d0a6920 fix: Unit 5 — ledger decrement on all teardown paths + channel-id adoption (C-06, C-08, C-12, C-13, C-18, C-25 #4 #5)
- C-06: add ChannelLifecyclePolicy to ChannelsAdapter; demux loop decrements
  per-identity counts on connection drop (clear_all path). Handler-exit
  teardown: wrap handler tasks in run_open_wrapper to call teardown_channel
  + on_close on natural completion. Fix check_open leak: on_close on
  allocation failure in run_open_wrapper.
- C-08: odd/even ID split (connect=1, accept=2, step=2) via ChannelSide
  enum. Add adopt_channel to ChannelManager for non-allocating side
  routing. Add ChannelClient::open_channel (call open op + adopt).
- C-12: reject channel_id:0 in channel/close handler.
- C-13: drain-before-close — await handler task (5s timeout) instead of
  abort, then decrement policy.
- C-18: re-check max_channels on re-acquire after mux.register in
  open_channel (TOCTOU-safe).

Tests added: policy_decremented_on_connection_drop,
concurrent_opens_respect_max_channels, channel_close_rejects_channel_zero,
channel_adoption_end_to_end_round_trip, odd_even_split_no_collision,
adopt_channel_installs_routing, adopt_channel_duplicate_id_returns_channel_exists,
open_channel_too_many_channels_rejected, connect_side_starts_at_1_accept_side_starts_at_2.

Verification: 450 tests pass (was 441; +9), clippy clean, fmt clean.
2026-08-13 08:14:55 +00:00
2026-08-11 08:48:35 +00:00
2026-08-11 08:48:35 +00:00
S
Description
No description provided
1.5 MiB
0 Stars 6 Watchers 0 Forks
Languages
Rust 99.3%
Python 0.6%