- Fix formatting in endpoint.rs - Mark tests.md and review-endpoint.md as completed - All 9 endpoint tasks are now complete - Workspace: all tests pass, clippy clean, fmt clean
6.8 KiB
id, name, status, depends_on, scope, risk, impact, level
| id | name | status | depends_on | scope | risk | impact | level | |
|---|---|---|---|---|---|---|---|---|
| endpoint/review-endpoint | Review alknet-endpoint implementation for spec conformance, API shape, and test coverage | completed |
|
moderate | low | phase | review |
Description
Phase 2 review checkpoint. Verify the alknet-endpoint crate is spec-conformant,
self-contained, and ready for downstream consumption by the assembly layer (Phase 4+
and beyond). The crate must match the ADR-083 shape: new() takes no StaticConfig,
transports are injected via builder methods, dispatch is public, shutdown() is
infallible, and EndpointError is removed.
Review Checklist
-
Crate structure:
- Module layout matches spec:
registry.rs,endpoint.rs,dispatch.rs,accept/{quinn,iroh,tcp_tls}.rs - Public API types:
AlknetEndpoint,HandlerRegistry - Re-exports in
lib.rsare correct and minimal - No dependency on
alknet-tls(endpoint takes pre-built transports)
- Module layout matches spec:
-
AlknetEndpointAPI shape (ADR-083):new(handlers, dynamic, identity_provider, drain_timeout)— noStaticConfig, no TLS configwith_quinn(endpoint: quinn::Endpoint)builder (feature-gated onquinn)with_iroh(endpoint: iroh::Endpoint)builder (feature-gated oniroh)with_tcp_tls(listener, acceptor)builder (feature-gated ontcp)TcpTlsListenertype alias (feature-gated ontcp)shutdown_sender()returnswatch::Sender<bool>run(self: Arc<Self>)spawns accept loops for each active transportshutdown(&self)is infallible (async fn shutdown(&self), noResult)Debugimpl lists handlers and drain_timeout (no transport internals)
-
HandlerRegistry:new(),register(),get(),alpn_strings()methodsregister()panics on duplicate ALPNDefaultimpl delegates tonew()Debugimpl lists ALPNs without exposing handler internals- No feature gates (always available)
-
dispatch(public):- Takes
&self,Connection,alpn,fingerprint,remote_addr - Synchronous (non-async) — spawns handler and returns immediately
- ACME guard (
acme-tls/1→ close + return) whenacmefeature enabled - Handler-not-found is swallowed (close + log, no error)
- Calls
build_auth_contextandtokio::spawns the handler
- Takes
-
build_auth_context:- Resolves identity from fingerprint via
IdentityProvider - Returns
AuthContextwith all fields populated - Feature-gated on
#[cfg(any(feature = "quinn", feature = "iroh"))]
- Resolves identity from fingerprint via
-
Accept loops:
- Quinn:
run_accept_loopspawns per-connection tasks, extracts ALPN + fingerprint, calls dispatch - Iroh:
run_accept_loopnegotiates ALPN, extracts fingerprint, calls dispatch - TCP+TLS:
run_accept_loopaccepts TCP, performs TLS handshake, extracts ALPN + fingerprint, calls dispatch - All three feed the same
dispatch_connectionfree function - All three handle shutdown signal via
watch::Receiver
- Quinn:
-
What's NOT present (correctly absent):
- No
EndpointErrortype (removed —BindFailedvestigial,HandlerNotFoundswallowed) - No
StaticConfigparameter onnew()(assembly layer reads it) - No
TlsSetup,build_rustls_server_config,build_quinn_server_config_from_rustls(inalknet-tls) - No
has_iroh_identityfunction (transport-building decision moved to assembly layer) - No
acme_state_handlefield (ACME state lives inalknet-tls) - No dependency on
alknet-tls
- No
-
Dependency hygiene:
alknet-coreis the only alknet dependencyquinnis optional, gated behindquinnfeature (pullsalknet-core/quinn)irohis optional, gated behindirohfeature (pullsalknet-core/iroh)tokio-rustlsis optional, gated behindtcpfeature- No unexpected heavy deps
-
Test coverage:
- All 7 registry tests pass
- All 3
build_auth_contexttests pass dispatch_decision_logic_lookup_and_authpasses- 3
has_iroh_identityreplacement tests pass (builder pattern) endpoint_constructs_with_iroh_raw_key_identity(adapted) passesiroh_endpoint_runs_accept_loop_and_shutdown(adapted) passesdebug_for_alknet_endpoint_is_implemented_without_panicking(adapted) passes- Tests exercise error paths (unknown ALPN, missing fingerprint, etc.)
- Feature-gated tests are correctly annotated
-
Cross-cutting checks:
cargo build -p alknet-endpointsucceeds (all feature combos)cargo test -p alknet-endpointsucceeds (all feature combos)cargo clippy -p alknet-endpoint --all-targetssucceeds with no warningscargo fmt --check -p alknet-endpointpassescargo build --workspacestill succeeds (old code untouched)cargo test --workspacestill succeeds (old tests untouched)
Acceptance Criteria
- Crate structure matches spec (7 source files, correct module layout)
AlknetEndpointAPI matches ADR-083 shape (noStaticConfig, builder methods, infallible shutdown)HandlerRegistryAPI correct and completedispatchis public, synchronous, transport-agnosticbuild_auth_contextresolves identity correctly- Quinn accept loop extracts ALPN + fingerprint, calls dispatch
- Iroh accept loop negotiates ALPN, extracts fingerprint, calls dispatch
- TCP+TLS accept loop performs TLS handshake, extracts ALPN + fingerprint, calls dispatch
- No
EndpointErrortype present - No
StaticConfiginnew()signature - No
has_iroh_identityfunction - No dependency on
alknet-tls - All 17 tests pass
cargo build -p alknet-endpointsucceeds (all feature combos)cargo test -p alknet-endpointsucceeds (all feature combos)cargo clippy -p alknet-endpoint --all-targetssucceeds with no warningscargo fmt --check -p alknet-endpointpasses- Workspace still green:
cargo build --workspace+cargo test --workspacepass
References
- docs/research/alknet-crate-extraction/findings.md — Phase 2
- docs/architecture/crates/endpoint/README.md — full architecture spec
- docs/architecture/decisions/083-endpoint-as-accept-loop-runner.md — ADR-083
- tasks/endpoint/crate-init.md
- tasks/endpoint/registry.md
- tasks/endpoint/endpoint-core.md
- tasks/endpoint/dispatch.md
- tasks/endpoint/accept-quinn.md
- tasks/endpoint/accept-iroh.md
- tasks/endpoint/accept-tcp-tls.md
- tasks/endpoint/tests.md
Notes
This review gates Phase 2 completion. The crate must be self-contained and spec-conformant before Phase 3 (
alknet-client) begins, since the assembly layer (which consumes both) will wire them together. The old code in core'sendpoint.rsis intentionally still present (duplicated) — the prune happens in Phase 4. If deviations are found, document and fix before proceeding to Phase 3.
Summary
To be filled on completion