- Rewrote the remaining em dashes outside docs/reviews/ (preserved as historical record, matching the alktty precedent): tests/ (313), fuzz/ (34 plus one shell comment), tasks/ (671 plus 12 kept in fences), docs/research + sdd_process + plans (525 plus 25 in fences), docs/architecture/overview.md fence labels (13), README, CHANGELOG, AGENTS.md, fuzz/README.md (176), and the .opencode/agents prompts (110) - Rewrote fenced content too: ASCII tree and module-map label separators, Rust snippet comments, and template placeholders; wire data, JSON/BAST examples, and transcripts survive verbatim - Rewrote 6 assert/expect message literals in tests/ and 2 format strings in fuzz/shared/src; no test data changed - Added Project Convention 18: no em dashes in prose (doc comments, markdown including docs/ and tasks/, agent prompts, commit messages); fence content rule, en-dash clause rule, and the no-spaced-hyphen prohibition follow alktty's convention 15 Follows6b20924(src doc comments) andcd0afe0(docs/architecture). Verification: cargo test (141 pass); cargo clippy --all-targets -D warnings; cargo fmt --check; cargo doc --no-deps; wasm check and clippy for wasm32-unknown-unknown with -D warnings; em dash grep over the repo returns matches only in docs/reviews/
5.0 KiB
id, name, status, depends_on, scope, risk, impact, level, tags
| id | name | status | depends_on | scope | risk | impact | level | tags | ||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| tunnels/params | TunnelParams + open-op spec (schema, scope gate, constants) | completed |
|
narrow | low | component | implementation |
|
Description
Implement src/params.rs per ADR-001 + wire.md §The Open Op: the
TunnelParams wire type, the Substrate discriminator, and the open-op
OperationSpec builder. This is the wire-stable surface (a one-way
door), so exact conformance to the ADR is the point.
Types
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct TunnelParams {
pub resource: String,
pub substrate: Substrate,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum Substrate { Tcp, Udp, Unix }
deny_unknown_fieldsis the loud-rejection posture (ADR-001: unknown fields fail schema validation, never silently ignored).Substrate::Unixis included in the type AND in the open-op schema's enum list v1 (["tcp", "udp", "unix"]; OQ-TN-14 resolved, so unix has an implementation path via thelocalfeature). The schema list is the authoritative gate for newer-substrate negotiation: an older producer rejecting a newer substrate value is the SSH "unknown channel type" posture (loud, not silent).
The open-op spec (in producer.rs or params.rs; put it where
tunnels/producer-open-op can consume; the spec builder lives in
params.rs per the module map, producer.rs re-exports)
pub const OP_TUNNEL_OPEN: &str = "channels/tunnel/sub";
pub const TUNNEL_ALPN: &str = "alk/tunnel";
pub const TUNNEL_OPEN_SCOPE: &str = "tunnel:open";
pub fn tunnel_open_spec() -> OperationSpec
OperationType::Sub;Visibility::External; channel-open markerChannelOpenSpec::new(TUNNEL_ALPN).input_schema:{resource: string (required), substrate: string enum ["tcp","udp","unix"] (required)}, which is the JSON Schema Draft shape as the POCs used (unix in the list per OQ-TN-14's resolution).output_schema:{channel_id: integer > 0}.AccessControl.required_scopes: [TUNNEL_OPEN_SCOPE](ADR-006).description: a one-line human hint (round-trips through discovery; the spec's SHOULD).
Error surface
src/error.rs: TunnelError (thiserror) covering the codec + session
errors (filled incrementally by later tasks); plus the re-export of
alkcall::channels::client::ChannelOpenError and an
establishment_reason(&CallError) -> Option<&str> helper
(ADR-049 §4 surface; the POC consumer's shape).
Acceptance Criteria
TunnelParamsround-trips serde; unknown fields rejectedtunnel_open_spec()matches wire.md §The Open Op exactly (op id, type, ALPN marker, schemas, ACL, description)- Schema validation test: valid params pass; missing fields, unknown fields, unknown substrate values all fail
establishment_reasonmapschannel:open_faileddetails.reason (POC-pinned shapes:unknown_resource,dial_failed,resource_shortage)- Unit tests cover the serde + schema shapes
- wasm32 check passes
References
- docs/architecture/decisions/001-open-params-layout.md
- docs/architecture/wire.md §The Open Op
- docs/architecture/decisions/006-access-control-posture.md
- POC reference:
/workspace/alktunnels-udp-poc/src/params.rs+producer.rs::tunnel_open_spec(the shape, withdeny_unknown_fieldsadded)
Notes
TunnelParams+Substrateper the task's exact type shapes (deny_unknown_fields,rename_all = "lowercase",Unixin the enum).Eqadded toTunnelParams(test equality).tunnel_open_spec()lives in params.rs per the module map; producer.rs re-exports. Output schema pinschannel_idwithminimum: 1+required(wire.md says integer > 0), which corrects the POC'sminimum: 0/ no-required was loose.establishment_reasondelegates to alkcall 0.7.0'sChannelOpenError::establishment_reasonmethod (upstream has it);ChannelOpenErrorre-exported from params.rs (pub use, since lib.rs re-exports through it).- Schema-validation tests use the
TunnelParamsdeserializer as the enum validator (same deny-unknown/enum posture as the registry's JSON Schema check; no jsonschema dep added for v1, and the input_schema string is asserted structurally inopen_spec_matches_wire_md). - 6 unit tests: round-trip ×3 substrates, unknown-field rejection, missing-field rejection, unknown-substrate rejection, spec-shape conformance, schema enum validation.
Summary
src/params.rs complete: the wire-stable TunnelParams/Substrate
types (ADR-001 exact shapes), tunnel_open_spec() (op id, Sub type,
External visibility, input/output schemas with the 3-value substrate
enum, tunnel:open ACL, channel-open marker, description),
constants, and the establishment_reason helper. Verified: cargo test (6 passed), clippy --all-targets -D warnings (native + wasm32),
fmt --check, and wasm32
check are all clean.