Skip to content

gateway: reconnect to the trading farm the auth server named (ibx#295) - #357

Closed
userFRM wants to merge 1 commit into
deepentropy:mainfrom
userFRM:fix/reconnect-trading-farm-name
Closed

gateway: reconnect to the trading farm the auth server named (ibx#295)#357
userFRM wants to merge 1 commit into
deepentropy:mainfrom
userFRM:fix/reconnect-trading-farm-name

Conversation

@userFRM

@userFRM userFRM commented Jul 30, 2026

Copy link
Copy Markdown

Problem

The auth server names the trading farm to use, and the reconnect path re-derived one instead of keeping it — so a session routed to a regional farm reconnected somewhere else.

What this changes

ReconnectAuth carries the trading host and farm as the auth response gave them, and the reconnect selects that route rather than re-deriving one.

The routing was unreachable

Nothing selected it. The reconnect credentials were left blank at construction for the caller to fill, and only the Python binding filled them:

host: String::new(), // Filled by caller (Python EClient or Rust API)

EClient::connect_inner never did. Every scheduler gates on a non-empty auth.host, so no Rust caller reconnected on any transport — farm, CCP or HMDS. The jittered backoff of #218 and the warm-up suppression of #219 were dead code for Rust callers.

The credentials are now a constructor parameter rather than a field set afterwards. into_hot_loop_with_farms takes a CallerAuth, both bindings pass one, and the setter that could be forgotten is gone — a binding that omits them does not compile. That is what closes the class rather than the instance; the compiler found two further construction sites in the bench harnesses while this was applied.

Breaking change to the low-level API

Gateway::into_hot_loop and into_hot_loop_with_farms take a CallerAuth. HotLoop::update_reconnect_auth is removed — pass the values at construction instead. Client/EClient and the Python surface are unchanged.

Closes #295. Closes #378.

Test plan

  • The credentials being a constructor parameter is enforced by the compiler, not by a test: it found two further construction sites in the bench harnesses while this was applied.
  • tests/farm_reconnect_poc updated to the new signature and checks clean.
  • cargo check --offline clean on --lib, --lib --features python, --bins, --examples, and each integration target individually.
  • tests/ib_paper_compat compared against a clean checkout of the base commit — identical sorted diagnostic sets.
  • cargo test --offline --lib — only the two known config::expiry_tests failures, which fail on the base commit for missing legacy tzdata (fixed separately in config: resolve the legacy timezone names IB states its times in (ibx#335) #336).

The auth server names the trading farm to use, and the reconnect path re-derived one instead of keeping it, so a session routed to a regional farm reconnected somewhere else. `ReconnectAuth` now carries the trading host and farm as the auth response gave them, and the reconnect selects that route.

Nothing selected it, though. The reconnect credentials were left blank at construction for the caller to fill, and only the Python binding filled them — `EClient::connect_inner` never did, so every scheduler refused to run on the empty host and no Rust caller reconnected on any transport. The routing this change selects sits downstream of that, and was unreachable.

The credentials are a constructor parameter now rather than a field set afterwards. `into_hot_loop_with_farms` takes a `CallerAuth`, both bindings pass one, and the setter that could be forgotten is gone. A binding that omits them does not compile.

Closes deepentropy#295.
Closes deepentropy#378.
@userFRM
userFRM force-pushed the fix/reconnect-trading-farm-name branch from 2bb32b8 to 82f015f Compare July 30, 2026 16:48
@userFRM

userFRM commented Aug 26, 2026

Copy link
Copy Markdown
Author

Closing this. It's in #409 along with the rest of the fork, which is easier to take in one piece than sixty separate branches.

@userFRM userFRM closed this Aug 26, 2026
@userFRM
userFRM deleted the fix/reconnect-trading-farm-name branch August 30, 2026 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant