Skip to content

feat(session-net): add bounded persistent least-authority consumer transport #695

Description

@VerifiedOrganic

Downstream parent: https://github.com/VerifiedOrganic/epdg/issues/181

Problem

The production least-authority session consumer transport added by #650 intentionally performs one authenticated request on a fresh connection. At current main (9b85ae1f8a98f5fe9f9f77225f72e5364840b5b1), StatelessSessionConsumerClient resolves, connects, performs TLS/mTLS and the authenticated Hello exchange for every logical operation. A successful ePDG IKE_AUTH round performs many such serial state operations, and real evidence in the downstream P0 shows 4.9–14.8 second response latency with extreme connection/resolver churn.

The legacy persistent RemoteSessionBackend is not an acceptable substitute: it carries replication/rebuild/consensus authority outside the typed consumer boundary and allows only one in-flight request. This capability belongs in opc-session-net; ePDG must not invent a product-local wire protocol or pool.

Required design

Add a bounded persistent, authenticated transport for the existing typed SessionConsumer authority.

  • Maintain a small fixed configured pool per logical endpoint/voter. Connection count is proportional to clients/workers × voters × pool width, never subscribers or records.
  • Reuse warm mTLS connections across logical calls. Support bounded multiplexing with explicit correlation when the wire revision supports it; otherwise use a bounded fair pool with one in-flight request per connection and no global head-of-line blocking.
  • Bound connections, pending acquisition, in-flight requests, per-connection frames, global queue depth, response storage, reconnect attempts, and shutdown drain. Overload must fail quickly with a typed outcome.
  • Preserve exact ALPN, SPIFFE peer identity, scope, revision and least-authority admission. Do not expose raw consensus, replication, rebuild, snapshot, membership or administrative calls.
  • Resolve only when establishing/re-establishing a connection. Preserve endpoint replacement, stable server name/identity, bounded setup, reconnect backoff with jitter, and drain/reconnect on certificate/SVID rotation without a fleet-wide reconnect storm.
  • Preserve the existing write boundary: only a request proven not transmitted may be retried automatically. A mutation that may have crossed the boundary remains OutcomeUnknown; allowed reconnect/failover attempts retain the exact durable request ID and body.
  • Correlate every response. Duplicate, unknown, late, oversized or mismatched correlation IDs fail closed without completing another caller. Cancellation must not make a late response reusable by a new request.
  • Keep latency-sensitive request capacity separate from watches/long-lived streams.
  • Expose bounded, value-free snapshots/metrics for setup phase, pool wait, active/max/idle connections, reuse, reconnects, bounded queue/in-flight counts, oldest queue age and outcome class. No keys, values, request IDs, owners/fences, endpoint addresses, identities or credentials in labels, logs, errors or Debug.
  • Provide a readiness/prewarm surface that proves the configured minimum authenticated capacity without making product readiness depend on subscriber traffic.

Required tests and evidence

  • Retain RED evidence that repeated typed calls on the current client create a fresh authenticated connection each time and miss the downstream latency budget under deterministic setup delay.
  • Cover pool width and queue bounds, fairness between independent session keys, cancellation, late/out-of-order responses, duplicate/unknown correlations, reconnect, endpoint replacement, certificate rotation, identity/scope/revision mismatch, shutdown drain and overload.
  • Cover read and mutation semantics across failures immediately before write, after partial/full write, after server commit and before response; prove no automatic replay after MayHaveWritten.
  • Cover 3- and 5-voter clients, 12+ concurrent callers, leader change/voter loss and one slow caller without global head-of-line blocking.
  • Add deterministic fix-removal and separate adversarial mutations for correlation isolation and ambiguous-outcome handling.
  • Benchmark warm calls with exact methodology and raw bounded samples; target warm quorum p99 <=25 ms and p99.9 <=100 ms in a real three-voter mTLS environment. Synthetic/loopback results must be labeled as such and cannot claim production capacity.
  • Run formatting, warning-denied Clippy, focused tests and repository canonical full CI. Record exact base/head/tree and obtain unconditional exact-head adversarial SHIP review with no unresolved P0/P1/P2.

Coordination

Refs https://github.com/VerifiedOrganic/epdg/issues/181

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestepdgRequired by the ePDG product integrationrustPull requests that update rust codestatus: in progressImplementation underway; check linked branches and PRs before overlapping work.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions