Files
alksocks/tasks/implementation/core-consumer-connect.md
T
glm-5.3-flash a2483e4a84 tasks: decompose the protocol-core group — thirteen dependency-ordered tasks
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.
2026-09-23 07:38:27 +00:00

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
implementation/core-producer-connect
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):

  1. Socks5ChannelSession::connect(client, target): opens the channel via ChannelClient::open_channel(OP_SOCKS5_OPEN, params, SOCKS5_ALPN) (trivial params — ADR-001), then drives the forked client typestate's use_stream path over the channel's BiStream (generic over the backing stream — the POC #1 fit: Socks5Stream impls AsyncRead + AsyncWrite itself, so the session over a BiStream is the intended use).
  2. Target construction via ToTargetAddr (IP-string forms parse to IP targets; domain form passes through unresolved — ADR-012).
  3. Post-reply payload pipe: after the reply, the session is a raw byte pipe — expose split() (read/write halves) and into_inner() (the underlying Socks5Stream<BiStream> for advanced use). 0 B framing (CONNECT).
  4. 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 alktunnels compile_fail doctest shape).
  5. Error surface: open failures are the typed SocksOpenError reasons (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).
  6. 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

  • Socks5ChannelSession with connect/split/into_inner per 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 test green; 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