Task 1 (stream-interface-message-interface-split):
- Document that TransportKind::Dns EXISTS and must be removed (was incorrectly described as 'never added')
- Document that TransportKind::WebTransport has { host: String } and must be changed to { server_name: Option<String> }
- Document that ListenerConfig is a flat struct, not an enum, and must be restructured per ADR-035
- Move ListenerConfig restructuring, InterfaceConfig rename, and TransportKind cleanup into task 1 to avoid overlap with task 2
- Add HttpListenerConfig/DnsListenerConfig/StreamInterfaceKind/MessageInterfaceKind to task 1 scope
Task 2 (listenconfig-http-dns-stubs):
- Remove work now covered by task 1 (InterfaceConfig rename, TransportKind changes, ListenerConfig enum creation)
- Focus on wiring the new enum form into Server/ServeOptions/StaticConfig, adding constructors, validation, and accept loop stubs
9.9 KiB
id, name, status, depends_on, scope, risk, impact, level
| id | name | status | depends_on | scope | risk | impact | level |
|---|---|---|---|---|---|---|---|
| stream-interface-message-interface-split | Rename Interface → StreamInterface, add MessageInterface trait, remove TransportKind::Dns, restructure ListenerConfig | pending | moderate | medium | phase | implementation |
Description
Rename the current Interface trait to StreamInterface, add a MessageInterface trait for request/response interfaces (HTTP, DNS), remove TransportKind::Dns from the transport enum (DNS is a MessageInterface, not a transport), restructure ListenerConfig from a flat struct to the ADR-035 enum form, and align TransportKind::WebTransport with the spec. This is the most impactful structural change in Phase 2 because all subsequent tasks reference the new trait names and config types.
Per ADR-035 and research/phase2/interface-model.md:
Interface→StreamInterface(the current trait becomes the stream-specific variant; persistent byte streams)InterfaceSessionstays as-is (it's already stream-specific)- Add
MessageInterfacetrait:handle_request(&self, request: InterfaceRequest) -> Result<InterfaceResponse>(stateless request/response) - Add
InterfaceRequestandInterfaceResponsetypes that normalize calls across message interfaces - Add
HttpInterfacestub (struct definition, no route implementations yet) - Add
DnsInterfacestub (struct definition only) - Restructure
InterfaceConfigintoStreamInterfaceConfigandMessageInterfaceConfig - Restructure
ListenerConfigfrom its current flat struct form to the ADR-035 enum withStream,Http, andDnsvariants - Remove
TransportKind::Dns— DNS is aMessageInterface, not a transport. This is a residual from Phase 1 that needs cleanup. All code referencing it must be removed: theListenerConfig::dns()constructor,pairs.rsvalid pairs table,TransportKindBase::Dns, and all related tests. - Update
TransportKind::WebTransportfield from{ host: String }to{ server_name: Option<String> }per ADR-035 (tag-only variant,server_nameis optional)
Why this must go first: Every other Phase 2 task imports and references these types. The rename and new traits must land before SshSession bridge, RawFraming implementation, or HTTP scaffold work begins. The integration plan section 2.3 explicitly states: "This task should be done early in Phase 2 because all subsequent tasks reference the new trait names."
Current state of the code (IMPORTANT — these differ from what the research docs assumed):
Interfacetrait incrates/alknet-core/src/interface/mod.rswithaccept()→Self::SessionInterfaceSessiontrait incrates/alknet-core/src/interface/session.rswithrecv()/send()InterfaceConfigenum withSsh(SshInterfaceConfig)andRawFraming(RawFramingConfig)variantsInterfaceKindenum withSshandRawFramingvariantsTransportKindhasTcp,Tls { server_name: Option<String> },Iroh { endpoint_id: String },Dns { domain: String }, andWebTransport { host: String }TransportKind::Dnsexists in the current code — it must be removed. References exist inpairs.rs(TransportKindBase::Dns),serve.rs(ListenerConfig::dns()constructor, Display impl, validate logic),transport/mod.rs(Display impl, tests), andlib.rsre-exports.TransportKind::WebTransportexists but has{ host: String }— must be changed to{ server_name: Option<String> }per ADR-035.ListenerConfigis currently a flat struct (fields:transport_kind,interface_kind,listen_addr,tls_cert,tls_key,acme_domain,stealth,iroh_relay) with builder-pattern constructors (tcp(),tls(),iroh(),dns(),webtransport()) — NOT an enum. Must be restructured to the ADR-035 enum form.SshInterfaceimplementsInterface,SshSessionimplementsInterfaceSessionRawFramingInterface/RawFramingSessionare stubs (Phase 1 left them)
Acceptance Criteria
Interfacetrait renamed toStreamInterfacethroughout alknet-core (mod.rs, ssh.rs, raw_framing.rs, and all import sites includinglib.rs)MessageInterfacetrait defined incrates/alknet-core/src/interface/mod.rswithhandle_request(&self, request: InterfaceRequest) -> Result<InterfaceResponse>InterfaceRequeststruct defined withoperation_path,input,auth_token,metadatafields per interface-model.mdInterfaceResponsestruct defined withresult,status,headersfields per interface-model.mdHttpInterfacestub struct defined (identity_provider, registry, env fields) — no route implementationsDnsInterfacestub struct defined (domain, identity_provider, registry, env fields) — no implementationInterfaceConfigrestructured:StreamInterfaceConfig::SshandStreamInterfaceConfig::RawFramingreplace current variants;MessageInterfaceConfigenum added withHttpandDnsvariantsListenerConfigrestructured from flat struct to enum withStream { transport: TransportKind, interface: StreamInterfaceKind },Http { config: HttpListenerConfig }, andDns { config: DnsListenerConfig }variants per ADR-035StreamInterfaceKindenum defined (corresponding toStreamInterfaceimplementors:Ssh,RawFraming)MessageInterfaceKindenum defined (corresponding toMessageInterfaceimplementors:Http,Dns)TransportKind::Dnsremoved from the enum and all references cleaned up:TransportKindBase::Dnsin pairs.rs,ListenerConfig::dns()constructor, Display impls, validate logic, and all related testsTransportKind::WebTransportfield changed from{ host: String }to{ server_name: Option<String> }and all references updatedis_valid_pair()/TransportKindBasevalidation updated for StreamInterface pairs only (no DNS pairs)- All existing tests pass after the changes (SshInterface and RawFramingInterface still compile and pass)
- New
StreamInterfaceimplementors still useInterfaceSessionfortype Session MessageInterfacehas at least one compilation test (e.g., a mock struct implements it)HttpInterfaceandDnsInterfacestubs compile and exist in the type systemlib.rsre-exports all new types (StreamInterface,MessageInterface,InterfaceRequest,InterfaceResponse,HttpInterface,DnsInterface,StreamInterfaceConfig,MessageInterfaceConfig,StreamInterfaceKind,MessageInterfaceKind,HttpListenerConfig,DnsListenerConfig)HttpListenerConfigstruct defined withbind_addr: SocketAddr,tls: bool,stealth: boolDnsListenerConfigstruct defined withbind_addr: SocketAddr,tls: boolDisplayimplementations added for all new enums/structs#[non_exhaustive]onListenerConfig,StreamInterfaceKind,MessageInterfaceKind,MessageInterfaceConfig- Serde
Serialize/Deserializeon all new config types - Updated tests cover the new
ListenerConfigenum form, the removedDnstransport, and theWebTransportfield rename
References
- docs/architecture/decisions/035-streaminterface-messageinterface-split.md — ADR-035
- docs/research/phase2/interface-model.md — Full design rationale
- docs/research/integration-plan.md — Phase 2.3
- crates/alknet-core/src/interface/mod.rs — Current Interface trait
- crates/alknet-core/src/interface/session.rs — InterfaceSession, InterfaceEvent
- crates/alknet-core/src/interface/config.rs — Current InterfaceConfig
- crates/alknet-core/src/interface/pairs.rs — Valid transport-interface pairs (has TransportKindBase::Dns to remove)
- crates/alknet-core/src/transport/mod.rs — TransportKind enum (has Dns and WebTransport { host } to fix)
- crates/alknet-core/src/server/serve.rs — ListenerConfig flat struct (to restructure to enum)
- crates/alknet-core/src/lib.rs — Re-exports
Notes
This is the most mechanically invasive change in Phase 2 due to the rename and the
ListenerConfigrestructuring, but it's low-risk behaviorally. TheInterface→StreamInterfacerename is a find-and-replace operation. The newMessageInterfacetrait and stubs are purely additive. TheListenerConfigrestructuring is the biggest change — it's currently a flat struct with builder-pattern constructors, and needs to become an enum withStream,Http, andDnsvariants per ADR-035. TheServer::new()code andStaticConfig::from_serve_options()code that currently uses the struct form will need to be updated.
The
TransportKind::Dnsremoval is cleanup from Phase 1 — it was incorrectly added as a transport variant when DNS is actually aMessageInterface. All references must be removed: theTransportKindBase::Dnsinpairs.rs, theListenerConfig::dns()constructor inserve.rs, theVALID_TRANSPORT_INTERFACE_PAIRStable entry, and the Display/test code. The DNS functionality will be represented byListenerConfig::Dns { config: DnsListenerConfig }instead.
The
TransportKind::WebTransportfield change from{ host: String }to{ server_name: Option<String> }aligns with ADR-035. Since no code currently depends on thehostfield specifically (there's no WebTransport acceptor), this is a safe rename.
The integration plan section 2.3 notes: "Existing
SshInterfaceandRawFramingInterfacebecomeStreamInterfaceimplementations. No behavior change for stream-based interfaces."
Consider using
#[non_exhaustive]on the new enums (MessageInterfaceConfig,ListenerConfig,StreamInterfaceKind,MessageInterfaceKind) so future variants (WebSocket, etc.) don't break downstream.
When restructuring
ListenerConfigfrom struct to enum, theServer::new(),StaticConfig::from_serve_options(), andserve.rsaccept loop code will need updates. TheServeOptions.listenersfield type changes. TheListenerConfig::tcp(),tls(),iroh()constructors should become associated functions that produce theListenerConfig::Streamvariant. New constructors forHttpandDnsvariants will be added.
Summary
To be filled on completion