Summary
crates/iroh-http-core/src/endpoint.rs#L29-71 defines EndpointInner as a 17-field god struct holding pool, handles, serve_handle, stats atomics, event subscribers, path subscribers, compression options, etc. ADR-014 D1 named four named subsystems: Transport, HttpRuntime, SessionRuntime, FfiBridge. The split was deferred. Land it now.
Follow-up to the post-rework review at reviews/2026-04-30-post-rework-review.md §5.3.
Evidence
EndpointInner has 17 fields covering five distinct concerns.
- Adding a new concern (a metrics export, a discovery hook) means another field on the same struct.
- Tests that need only the handle store have to construct or mock the full inner.
Impact
- High cognitive load — a reader touching one concern must scan 17 fields.
- Discourages independent unit testing of subsystems.
- Couples the lifetimes/visibility of unrelated state.
Remediation
- Extract
Transport (raw iroh Endpoint, node_addr, bound sockets, relay state).
- Extract
HttpRuntime (pool, max_header_size, max_response_body_bytes, request/connection counters, compression options).
- Extract
SessionRuntime (session registry, session events).
- Extract
FfiBridge (handle store, fetch tokens, drain/sweep).
IrohEndpoint becomes a thin façade composing the four; inner becomes Arc<EndpointInner> with one field per subsystem.
- Public API of
IrohEndpoint unchanged — the split is purely internal.
Acceptance criteria
- Four subsystem structs in their own modules (
transport.rs, http_runtime.rs, session_runtime.rs, ffi_bridge.rs).
endpoint.rs is the façade only — no business logic.
- Each subsystem is independently testable (an
#[cfg(test)] new_for_test() helper per subsystem).
- All 92 interop pairs pass.
Summary
crates/iroh-http-core/src/endpoint.rs#L29-71definesEndpointInneras a 17-field god struct holdingpool,handles,serve_handle, stats atomics, event subscribers, path subscribers, compression options, etc. ADR-014 D1 named four named subsystems:Transport,HttpRuntime,SessionRuntime,FfiBridge. The split was deferred. Land it now.Follow-up to the post-rework review at reviews/2026-04-30-post-rework-review.md §5.3.
Evidence
EndpointInnerhas 17 fields covering five distinct concerns.Impact
Remediation
Transport(raw irohEndpoint,node_addr, bound sockets, relay state).HttpRuntime(pool, max_header_size, max_response_body_bytes, request/connection counters, compression options).SessionRuntime(session registry, session events).FfiBridge(handle store, fetch tokens, drain/sweep).IrohEndpointbecomes a thin façade composing the four; inner becomesArc<EndpointInner>with one field per subsystem.IrohEndpointunchanged — the split is purely internal.Acceptance criteria
transport.rs,http_runtime.rs,session_runtime.rs,ffi_bridge.rs).endpoint.rsis the façade only — no business logic.#[cfg(test)]new_for_test()helper per subsystem).