Skip to content

feat(rust): bind non-owning ping handles before initialization - #490

Open
Auro (aurokin) wants to merge 1 commit into
microsoft:mainfrom
aurokin:aurokin-early-weak-ahp-ping
Open

Auro (aurokin) wants to merge 1 commit into
microsoft:mainfrom
aurokin:aurokin-early-weak-ahp-ping

Conversation

@aurokin

Copy link
Copy Markdown

Summary

Allow transport-owned keepalive to use SDK request correlation while a managed host is initialized but still awaiting session discovery. Add the optional, synchronous Transport::bind_client(WeakPingHandle) callback before client transport I/O, with default no-op implementations and forwarding through DynTransport and BoxedTransport.

Ownership and compatibility

WeakPingHandle exposes only ping, sharing the normal root-channel request, request IDs, pending response map, outbound queue, and configured timeout. Neither the handle nor an unanswered ping retains the client driver. Last-client drop, shutdown, and transport closure cancel weak pings deterministically; normal request RPC teardown errors and timeout behavior remain unchanged. Dropping request futures removes pending entries.

Managed hosts privately retain one request-ID allocator across connection attempts, including failed handshakes, so delayed replies from a previous transport cannot match a new request. Independent logical hosts and standalone clients retain independent sequences. The allocator uses the full u64 range through its maximum and fails explicitly on exhaustion without wrapping. No public allocator/configuration API, wire changes, dependencies, or provider-specific keepalive policy are introduced.

Validation

  • cargo test --manifest-path clients/rust/Cargo.toml -p ahp -p ahp-ws --locked: 79 unit/integration tests and 14 doctests pass.
  • cargo fmt --manifest-path clients/rust/Cargo.toml --all --check passes.
  • cargo clippy --manifest-path clients/rust/Cargo.toml -p ahp --lib --tests --locked -- -D warnings passes.
  • npm test and npm run verify:change-fragments pass.
  • Thirteen new tests cover actual boxed/dynamic binding, default callback compatibility, delayed managed-host discovery, concurrent/out-of-order correlation, timeout/server errors, weak owner shutdown, outbound backpressure, pending cleanup, reconnect/failure ID continuity, independent owners, and exhaustion.
  • Reversible production-source proofs fail when boxed binding forwarding is removed or supervisor ID continuity is reset, then pass after exact restoration.
  • Change review recommendations were addressed; a fresh complete code review found no valid findings.

Release

Includes Rust API documentation and a Rust-only changelog fragment. This change does not bump versions, create tags, or publish packages. A subsequent maintainer-owned Rust release is required before tag-pinned downstream adoption.

Share normal request correlation with transport-owned keepalive without retaining the client driver. Keep managed-host request IDs across retries and clean up cancelled requests deterministically.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@aurokin

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree company="Microsoft"

This branch has not been deployed

No deployments
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.

1 participant