Batch 1 of the Phase 1 decomposition: the default, wasm-clean crate (producer + consumer + wire + seams + params/errors), per the architecture spec set (ADRs 001-013) and the three POCs' validated shapes. The assembly layer (local/composed providers, front doors) is batch 2, decomposed after review-protocol-core opens. - foundation: crate-deps (alkcall 0.8.0 first consumption), wire-codec (the ASSOCIATE frame + the joint bound), seam-types (the three ADR-004 seams), params-errors (the one-way-door surface) - harness: duplex transport + identities + in-process seams (the alkcall 0.8.0 establishment surface proven before the producer) - verticals: producer/consumer splits per command (CONNECT, ASSOCIATE, BIND) — each POC's scope, producer tasks test via the raw RFC client, consumer tasks e2e through the harness - closing: integration suite (three-command regression, teardown matrix, identity matrix, docs sync) + review-protocol-core (the batch gate) taskgraph: 8 generations, no cycles, risk path 2.55 (no high-risk tasks). Also records the wire.md/bast.md len=0 residue (payload-level F-2 is the operative invariant) as a doc-sync deliverable of the wire-codec task. Verification: cargo test (76 passed), fmt clean; taskgraph validate/cycles/parallel/critical clean.
3.2 KiB
3.2 KiB
id, name, status, depends_on, scope, risk, impact, level
| id | name | status | depends_on | scope | risk | impact | level | |
|---|---|---|---|---|---|---|---|---|
| implementation/core-consumer-connect | Core — consumer half: Socks5ChannelSession (CONNECT) + e2e tests | pending |
|
narrow | low | component | implementation |
Description
Implement the CONNECT consumer session in src/consumer.rs per
consumer.md §The Channels-Native Sessions: Socks5ChannelSession —
the typed client that opens channels/socks5/sub and drives the
client side of the RFC conversation in-stream (POC #1's
use_stream shape).
Deliverables (port from /workspace/alksocks-connect-poc/src/ consumer.rs, adapted to the crate's params/error surface):
Socks5ChannelSession::connect(client, target): opens the channel viaChannelClient::open_channel(OP_SOCKS5_OPEN, params, SOCKS5_ALPN)(trivial params — ADR-001), then drives the forked client typestate'suse_streampath over the channel'sBiStream(generic over the backing stream — the POC #1 fit:Socks5StreamimplsAsyncRead + AsyncWriteitself, so the session over aBiStreamis the intended use).- Target construction via
ToTargetAddr(IP-string forms parse to IP targets; domain form passes through unresolved — ADR-012). - Post-reply payload pipe: after the reply, the session is a
raw byte pipe — expose
split()(read/write halves) andinto_inner()(the underlyingSocks5Stream<BiStream>for advanced use). 0 B framing (CONNECT). - Teardown ownership (alktunnels ADR-005 posture, inherited):
the session owns the channel; on Drop it closes/joins. No
Clone(compile-asserted — aliasing a session would alias its teardown; the alktunnelscompile_faildoctest shape). - Error surface: open failures are the typed
SocksOpenErrorreasons (ADR-049 §4 — a refused session never yields a phantom channel); a refused target is an RFC reply code surfaced through the session type (consumer.md §Error surface). - Tests (end-to-end through the harness): connect → echo round-trip (payload bytes both directions); refused dial → the RFC reply code surfaced as a typed session error; FORBIDDEN open → typed open error, no session; half-close semantics (dropping the write half EOFs the producer's pump cleanly); domain-form target passes through unresolved (assert the wire bytes, the echo dial ignores the target).
Acceptance Criteria
Socks5ChannelSessionwithconnect/split/into_innerper the POC shape- Teardown ownership on Drop; no
Clone(compile-asserted) - Typed error surface (open errors vs reply-code refusals)
- E2E tests through the harness (round-trip, refusals, half-close, domain pass-through)
cargo testgreen; clippy/fmt clean; both wasm checks clean
References
- docs/architecture/consumer.md §The Channels-Native Sessions
- docs/architecture/decisions/003-udp-handle-swap.md (the framing mirror — CONNECT is the 0 B case)
- POC source:
/workspace/alksocks-connect-poc/src/consumer.rs - alktunnels template:
/workspace/@alkdev/alktunnels/src/consumer.rs(the teardown-ownership + no-Clone posture)
Notes
To be filled by implementation agent
Summary
To be filled on completion