docs(arch): hub-wiring cluster — aggregated env, peer_operations, from_call cleanup, alknet-hub crate spec

Three ADRs addressing gaps surfaced by the first hub consumer (alkapi):

- ADR-067: Aggregated peer-env wiring — Dispatcher::with_aggregated_env hook
  so compose_root_env reads a shared PeerCompositeEnv across all calls,
  not a fresh per-call one. The hub-defining gap (alkapi OQ-08 / G.1).

- ADR-068: PeerCompositeEnv::peer_operations override — adds
  list_operation_names() to OperationEnv, overrides on OverlayOperationEnv
  and PeerCompositeEnv. Fixes services/list-peers returning empty operation
  lists for non-local peers (alkapi G.6).

- ADR-069: from_call is a manual free function, not auto-wired — reverses
  the aspirational OQ-27 resolution to match the implementation. Cleans
  the 'v1 default' hedging language in ADR-017 and client-and-adapters.md
  (alkapi G.4).

New crate spec: alknet-hub — reusable hub pattern (aggregated env,
connection lifecycle, worker supervision with backoff, service discovery).

Spec fixes: builder API drift (with_local/with_local_streaming separation),
ScopedOperationEnv → ScopedPeerEnv type name, OQ count 51→54.

Three new OQs: OQ-52 (wait_for_close), OQ-53 (backoff defaults),
OQ-54 (inbound hook placement).
This commit is contained in:
glm-5.2 committed 2026-07-09 16:01:30 +00:00
1 parent 2282647f8b
commit 87b2c2a5ef
15 files changed
+1052 -47

No files matched your search

@@ -0,0 +1,26 @@
# OQ-52: CallConnection::wait_for_close() for Supervision Loop
- **Origin**: [crates/hub/README.md](crates/hub/README.md)
- **Status**: open
- **Door type**: Two-way
- **Priority**: medium
- **Resolution**: Not yet decided.
The hub's worker supervision loop needs a way to await connection close so it
can call `detach_peer` and retry. Today `CallConnection` exposes `connection()`
(the underlying `Connection`) but not a "wait for run_loop exit" future.
Options:
- **(a)** Add a `closed()` method to `CallConnection` that returns a
`Future<Output = ()>` resolving when `run_loop` exits. The dispatcher
signals a `tokio::sync::Notify` on exit; `closed()` awaits it.
- **(b)** Use a `tokio::sync::oneshot` channel created by the caller and
passed to the dispatcher, signaled on `run_loop` exit.
- **(c)** Poll `connection().accept_bi()` in a loop until it returns
`ConnectionClosed` — works but is polling, not event-driven.
Option (a) is the cleanest: a method on `CallConnection` that any caller
(not just the hub) can use to await connection close. It is a small additive
change to `alknet-call`.
- **Cross-references**: ADR-067, [crates/hub/README.md](crates/hub/README.md)