Skip to content

transport: deliver_aliased + collapsed order/request fallback (#930) - #955

Merged
wboayue merged 8 commits into
mainfrom
930-registry-followups
Oct 5, 2026
Merged

wboayue merged 8 commits into
mainfrom
930-registry-followups

Conversation

@wboayue

@wboayue wboayue commented Oct 5, 2026 •

Copy link
Copy Markdown
Owner

Closes #930.

Refactor of the follow-ups from the #929 review, plus the sync counterpart from the issue comment. No wire or routing behavior change; log and panic-recovery changes are listed below.

Changes

  • deliver_aliased on both SenderHashes. Private deliver_then does the single lookup; deliver and deliver_aliased sit on top. The execution alias is inserted under the route's read lock, closing the window where a concurrent Client::drop could clear the maps between routing an execution and recording its alias. Lock order is self (read), then aliases (write); executions is never locked first.
    • Async: deliver_execution and its Option::take / expect("undelivered item") removed; with_route is test-only.
    • Sync: send -> Result<(), Error> (always Ok) becomes deliver -> Result<(), RoutedItem>; bound logic moves to Entry::deliver, mirroring async Route::deliver; store_execution_mapping removed.
  • Collapsed order→request fallback. deliver_to_order_or_request on each bus, one or_else chain, used by ExecutionData and ExecutionDataEnd. Removes the four item = match … blocks (async) and the duplicated contains + send blocks with unreachable Err branches (sync).
  • Sync OrderOrShared. Dropped the is_shared_response(IncomingMessages::OpenOrder) guard: a constant, always true since both OpenOrder and OrderStatus are in every open-orders mapping.
  • Async SharedChannels. channels_mut() next to channels(); close() doc notes it's the counterpart of sync SharedChannels::fail_all.

Follow-ups (parity fixes found in review)

  • Commission report warn. Both transports now warn only when the report reached neither an execution alias nor the order update stream, the same rule as every other arm. Before: sync warned on any missing alias even when the update stream got it; async never warned.
  • Async OrderOrShared. contains check then deliver, instead of cloning every OpenOrder / OrderStatus frame to keep it for the shared fallback. Matches sync.
  • Sync SenderHash lock poisoning. read() / write() helpers recover from poison (PoisonError::into_inner), as async does, so one panic under the lock no longer panics every later route and teardown. Regression test included.
  • Sync order-update slot poisoning. lock_slot helper, mirroring async's. Before: send_order_update_item and clear_order_update_stream skipped on poison (if let Ok), silently dropping updates and leaving the slot uncleanable; other sites panicked. Regression test included.

Notes

  • Route.sender / Route.lease stay pub(super): the async order update stream is a Route and reads both.
  • Sync process_response_with_id and OrderOrShared keep their contains guard: the miss path needs the ResponseMessage (shared send, unroutable report), and Err(item) hands back a RoutedItem.
  • Sync logging: the per-send debug! dump of the whole route map is gone, and the generic "no recipient found" warn is replaced by call-site warns.

Tests

  • Sync poison-recovery tests (route map, order-update slot).
  • New deliver_aliased tests on both sides: alias registered with the shared lease, None alias registers nothing, unrouted hands the item back without aliasing.
  • cargo test --lib, cargo clippy --all-targets -- -D warnings (default, sync, all-features), cargo fmt --check, RUSTDOCFLAGS=-D warnings cargo doc all clean.

- SenderHash (sync + async): private deliver_then primitive; deliver and
  deliver_aliased on top. Alias inserted under the route's read lock.
- Async: drop deliver_execution (Option::take/expect workaround);
  with_route test-only.
- Sync: send -> deliver returning Result<(), RoutedItem>; bound logic moves
  to Entry::deliver; store_execution_mapping removed; contains+send pairs
  collapsed where the miss path doesn't need the message.
- Both: deliver_to_order_or_request as one or_else chain.
- Sync OrderOrShared: drop always-true is_shared_response(OpenOrder) guard.
- Async SharedChannels: channels_mut(); close() doc notes sync fail_all parity.
@wboayue
wboayue merged commit a385c87 into main Oct 5, 2026
7 checks passed
@wboayue
wboayue deleted the 930-registry-followups branch October 5, 2026 05:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Async transport: registry follow-ups from #929 review

1 participant