- src/{params,wire,producer,consumer,error}.rs skeletons with module
docs per overview.md §Module Map; lib.rs crate docs + re-exports
- constants in params.rs (OP_TUNNEL_OPEN, TUNNEL_ALPN,
TUNNEL_OPEN_SCOPE) + establishment_reason helper (delegates to
alkcall 0.7.0's ChannelOpenError::establishment_reason)
- MAX_DATAGRAM_LEN (65535) in wire.rs (ADR-003's frame-time bound)
- async-trait dropped: skeleton confirms no trait (ADR-004)
Verified: cargo check, clippy --all-targets -D warnings (native +
wasm32), fmt --check, test, wasm32 check — all clean
4.5 KiB
4.5 KiB
id, name, status, depends_on, scope, risk, impact, level, tags
| id | name | status | depends_on | scope | risk | impact | level | tags | |||
|---|---|---|---|---|---|---|---|---|---|---|---|
| tunnels/crate-init | Initialize the alktunnels module skeleton (params, wire, producer, consumer, error) | completed |
|
narrow | low | project | implementation |
|
Description
Convert the alktunnels scaffold crate into the real module skeleton per
docs/architecture/overview.md §Module Map. The crate already exists
(Cargo.toml with alkcall 0.7.0, the wasm-clean tokio subset, licenses,
lib.rs stub); this task adds the module structure the subsequent tasks
fill in.
Module skeleton
// src/lib.rs
//! alktunnels — arbitrary bidirectional tunnels over alkcall channels.
//! (crate docs per overview.md §What — the two-paragraph shape)
pub mod error;
pub mod params;
pub mod wire;
pub mod producer;
pub mod consumer;
// Public API surface: re-exports filled in by subsequent tasks (convention 16).
src/error.rs—TunnelError(thiserror; convention 2) + the typed open-error surface re-exported from alkcall (ChannelOpenError,establishment_reason-shaped helper). Skeleton only; filled bytunnels/paramsandtunnels/consumer-session.src/params.rs—TunnelParams {resource, substrate}+Substrateenum (tcp | udp | unix) +tunnel_open_spec()builder +TUNNEL_OPEN_SCOPE/OP_TUNNEL_OPEN/TUNNEL_ALPNconstants. Skeleton with type definitions; the schema builder + tests land intunnels/params.src/wire.rs— the codec module doc (ADR-003 summary + bast.md pointer); skeleton forframe_datagram/DatagramReader/DatagramCodecError, filled bytunnels/wire-codec.src/producer.rs— module doc (producer.md summary); skeleton fortunnel_open_specwiring,register_tunnel_openable, the establisher shape, the pump handler — filled bytunnels/producer-open-op+tunnels/producer-listen.src/consumer.rs— module doc (consumer.md summary); skeleton forTunnelSession— filled bytunnels/consumer-session.
Keep in place / verify
- Cargo.toml: alkcall 0.7.0 pin, the wasm-clean tokio subset, the empty
[features]table (thelocalfeature is added bytunnels/local-socket-halves). bytes,serde,serde_json,thiserror,tracing,futuresstay; dropasync-traitIF the skeleton confirms no trait is needed (ADR-004 — it likely is not; note the decision in Summary if dropped).- The default crate stays wasm-clean:
cargo check --target wasm32-unknown-unknownmust pass at every task in this graph (convention 4; the structural guard).
Acceptance Criteria
src/lib.rsdeclareserror,params,wire,producer,consumerwith doc comments; public API re-exports listed (empty bodies fine)- Every skeleton module compiles (
cargo checkclean) cargo clippy --all-targets -- -D warningscleancargo fmt --checkcleancargo check --target wasm32-unknown-unknownpasses- No comments in code beyond doc comments (convention 1)
References
- docs/architecture/overview.md (module map, feature gates)
- docs/architecture/decisions/004-no-backend-trait.md (module placement)
- AGENTS.md conventions 1/2/4/15/16
Notes
- All five skeleton modules created per the task's shapes, with module
docs pointing at the spec docs + ADRs and
tunnels/*tasks that fill them in. - Constants placed early (
OP_TUNNEL_OPEN,TUNNEL_ALPN,TUNNEL_OPEN_SCOPEin params.rs — they are part of the wire surface, not producer-only, so they live in the shared module per the module map's "params.rs … + open-op input schema"). establishment_reasonis a thin delegation toChannelOpenError::establishment_reason(alkcall 0.7.0 has the method upstream); the crate-level helper keeps the POC's free-fn shape for consumers and re-exports the typed error.MAX_DATAGRAM_LEN(65535) placed in wire.rs — the one codec constant ADR-003 pins regardless of the codec functions landing later.async-traitdropped per the task's IF: the skeleton confirms no trait is needed (ADR-004 — halves functions, not traits);cargo checkpasses without it.
Summary
Module skeleton landed (error/params/wire/producer/consumer + lib.rs
docs + re-exports); Cargo.toml unchanged except async-trait dropped
(ADR-004 confirmation). Verified: cargo check, cargo clippy --all-targets -- -D warnings, cargo fmt --check, cargo test,
cargo check --target wasm32-unknown-unknown,
cargo clippy --target wasm32-unknown-unknown -- -D warnings — all
clean.