ReviewOS

home-lang/home

Port gRPC pick-first load balancer

#244
Closed chris opened this 10 days ago ·
10 days ago

Scope

Port Bun corpus position 3986, js/third_party/grpc-js/test-pick-first.test.ts (22 active tests).

Required contracts

  • preserve shuffle multisets and randomize selection when configured
  • create and observe subchannels across endpoint/address lists
  • implement CONNECTING, READY, IDLE, and sticky TRANSIENT_FAILURE transitions
  • retain a READY subchannel while a replacement address list connects
  • hand off to READY replacements and react correctly when the old subchannel disconnects
  • request resolver updates for exhausted/failing address generations
  • reconnect the same address list from exitIdle
  • expose picker, load-balancer helper, address, and fixture surfaces
  • preserve causes and add operation/address/source context for invalid updates

Verification

  • all 22 focused upstream tests pass without unsupported cases
  • permanent diagnostics cover invalid updates and state handoff
  • existing gRPC, SQL adapter, and third-party gates remain green
10 days ago

Implemented and pushed in 8cfef6f11.

Completed contracts:

  • shuffle preserves the input multiset and varies address selection when enabled
  • endpoint/address lists create observable subchannels and READY pickers
  • CONNECTING, READY, IDLE, and sticky TRANSIENT_FAILURE transitions follow pick-first lifecycle rules
  • an established READY child remains active while a replacement list connects
  • READY replacements hand off immediately; old-child disconnects evaluate the pending generation
  • exhausted generations request resolver updates
  • exitIdle reconnects the last address list
  • process.nextTick now drains ahead of setImmediate, fixing the underlying Node event-loop ordering contract
  • invalid addresses/helper failures produce ERR_GRPC_PICK_FIRST with preserved causes and operation/address/source stack context

Verification:

  • focused Bun corpus: 22 passed, 0 failed, 0 todo, 0 unsupported
  • permanent gRPC diagnostics: 13 passed
  • SQL adapter contracts: passed
  • permanent third-party JWT/utility mini-suite: passed
  • zig fmt --check and git diff --check: passed

Cumulative through position 3986: 328 files, 2,741 passed, 209 todo, 0 failed, 0 unsupported, 171 allowed-empty.

Sign in to comment on this issue.