ReviewOS

home-lang/home

runtime: complete HTTP2 teardown ordering and SETTINGS ACK FIFO parity

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

Child of #427 and tracked by #66.

The exact public session-state blockers are fixed locally in 893f3a17222124b2642adf852f76ad948980e084, but the broader HTTP/2 lifecycle still needs one dedicated parity tranche.

Scope:

  • Tear active streams down before session close callbacks on destroy/error paths.
  • Preserve close-listener registration order; stream.close(callback) must register the callback rather than invoke it manually.
  • Keep close() and destroy() public flags distinct across modeled client, modeled server, raw client/server, and handshake sessions.
  • Let graceful close drain active streams, including servers without a stream handler, instead of canceling them.
  • Make repeated close/destroy calls no-ops with immutable first reset code and once-only _destroy, error, end, and close events.
  • Queue the initial and pre-connect SETTINGS submissions FIFO. Apply localSettings only on the corresponding ACK, deliver peer remoteSettings first, and keep pendingSettingsAck true until the queue is empty.
  • Preserve maxOutstandingSettings fail-closed behavior and exactly-once peer/local errors.

Regression gate:

  • Focused stream/session ordering, raw/modelled parity, graceful drain, destroy identity, and SETTINGS FIFO tests.
  • Existing Home bootstrap HTTP2 cumulative suite remains green.
  • The six-way exact cases in test/js/node/http2/node-http2.test.js pass for these behaviors.

This issue alone does not remove the #427 FAIL marker; that still requires the maintained full file at exactly 287 passed / 0 failed / 0 todo / 0 unsupported.

10 days ago

Partial completion: d2eecb5332b1f6cf03916cf45a79abc3ac6e184b (fix(runtime): acknowledge HTTP2 settings in order). Client SETTINGS submissions are now explicit FIFO records. Pre-connect submissions remain pending until connection activation, all peer remoteSettings updates are delivered before local ACKs, localSettings changes only on the matching ACK, callbacks retain submission pairing/order, and pendingSettingsAck stays true until the final record drains. Focused SETTINGS contract passes 2/2 (pre-connect and connected queues); cumulative bootstrap HTTP2 passes 37/37; Zig fmt/diff checks pass. #445 remains open for stream/session teardown ordering, raw/server state parity, repeated close/destroy behavior, and cancellation of queued SETTINGS on terminal errors.

10 days ago

Completed in 0e76ccdc00d7c70270ae047f9b9e1d00e09efd68 (fix(runtime): order HTTP2 session teardown).

This finishes the remaining lifecycle tranche:

  • Modeled, raw, and handshake sessions now keep graceful close() and immediate destroy() state distinct while emitting terminal events once.
  • Active streams terminalize before session close listeners on destroy/error paths; graceful close waits for active streams, including servers without a stream handler.
  • stream.close(callback) registers the callback as a close listener, preserving listener registration order. Repeated close/destroy calls retain the first reset code and once-only _destroy, error, end, and close delivery, including deferred outbound flushes.
  • The existing initial/pre-connect SETTINGS FIFO remains peer-first and ACK-paired. The focused gate also verifies maxOutstandingSettings fails closed once and never acknowledges canceled submissions.
  • Raw server teardown now closes streams before the session and lets graceful raw sessions drain naturally.

Verification:

  • The maintained test/js/node/http2/node-http2.test.js is byte-identical to Bun pin 4982b91e3702094330f3be3883354c52b8c01323 (SHA-256 2f92a4f180ead6c2194a1dc7c9abd295dc85f45359a3ae8d131ad3178a98c18a) and passes exactly 287 passed / 0 failed / 0 todo / 0 unsupported across the six Node/Bun × padding cases.
  • New focused teardown/state/SETTINGS contracts pass 6/6.
  • The complete filtered bootstrap HTTP2 suite passes.
  • Scoped home_rt: 1,829 passed / 19 skipped / 0 failed, 20/20 build steps.
  • Debug build: 18/18 steps.
  • Zig format/diff checks and Pickier pass.

Closing #445. The broader Bun parity effort remains tracked in #66.

Sign in to comment on this issue.