> ## Documentation Index
> Fetch the complete documentation index at: https://docs.moltzap.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# protocol/testing/conformance/transport

> Public barrel for transport-layer conformance properties.

# protocol/testing/conformance/transport

*`packages/protocol/src/testing/conformance/transport`*

## Purpose

Public barrel for transport-layer conformance properties.

Transport-layer conformance properties.

Lifecycle transport invariants — adversity around latency,
connection-reset, timeout, and close.

Each `register*` lives in its own file. This barrel re-exports them
by name AND aggregates them into `TRANSPORT_PROPERTIES` for the
`_shared/suite.ts` aggregator.

## Public surface

### [`acquireProxiedClient`](https://github.com/chughtapan/moltzap/blob/main/packages/protocol/src/testing/conformance/transport/_helpers.ts#L57)

*Function*

```ts theme={null}
export function acquireProxiedClient(opts: {
  readonly ctx: ConformanceRunContext;
  readonly proxy: ToxiproxyProxy;
  readonly name: string;
  readonly defaultTimeoutMs: number;
  readonly unavailable: (reason: string) => PropertyUnavailable;
}): Effect.Effect<
  { agent: TestAgent; client: AgentTestClient },
  PropertyUnavailable,
  Scope.Scope
>
```

Acquire an agent client that routes through the Toxiproxy proxy.

### [`ADVERSITY_CATEGORY`](https://github.com/chughtapan/moltzap/blob/main/packages/protocol/src/testing/conformance/transport/_helpers.ts#L24)

*Variable*

```ts theme={null}
export const ADVERSITY_CATEGORY = "adversity" as const
```

### [`adversityViolation`](https://github.com/chughtapan/moltzap/blob/main/packages/protocol/src/testing/conformance/transport/_helpers.ts#L30)

*Function*

```ts theme={null}
export function adversityViolation(
  name: string,
  reason: string,
): PropertyInvariantViolation
```

### [`attachToxic`](https://github.com/chughtapan/moltzap/blob/main/packages/protocol/src/testing/conformance/transport/_helpers.ts#L111)

*Property*

```ts theme={null}
  readonly attachToxic: Effect.Effect<void, PropertyUnavailable, Scope.Scope>;
```

### [`createOneOnOneConversation`](https://github.com/chughtapan/moltzap/blob/main/packages/protocol/src/testing/conformance/transport/_helpers.ts#L216)

*Function*

```ts theme={null}
export function createOneOnOneConversation(
  owner: { agent: TestAgent; client: AgentTestClient },
  participant: { agent: TestAgent; client: AgentTestClient },
  propertyName: string,
): Effect.Effect<
  { taskId: TaskId; conversationId: ConversationId },
  PropertyInvariantViolation
>
```

### [`proxy`](https://github.com/chughtapan/moltzap/blob/main/packages/protocol/src/testing/conformance/transport/_helpers.ts#L109)

*Property*

```ts theme={null}
  readonly proxy: ToxiproxyProxy;
  readonly unavailable: (reason: string) => PropertyUnavailable;
```

### [`proxyName`](https://github.com/chughtapan/moltzap/blob/main/packages/protocol/src/testing/conformance/transport/_helpers.ts#L48)

*Function*

```ts theme={null}
export function proxyName(prefix: string, seed: number): string
```

### [`registerLatencyResilience`](https://github.com/chughtapan/moltzap/blob/main/packages/protocol/src/testing/conformance/transport/adversity-latency-resilience.ts#L24)

*Function*

```ts theme={null}
export function registerLatencyResilience(ctx: ConformanceRunContext): void
```

### [`registerResetPeerRecovery`](https://github.com/chughtapan/moltzap/blob/main/packages/protocol/src/testing/conformance/transport/adversity-reset-peer-recovery.ts#L27)

*Function*

```ts theme={null}
export function registerResetPeerRecovery(ctx: ConformanceRunContext): void
```

### [`registerSlowCloseCleanup`](https://github.com/chughtapan/moltzap/blob/main/packages/protocol/src/testing/conformance/transport/adversity-slow-close-cleanup.ts#L20)

*Function*

```ts theme={null}
export function registerSlowCloseCleanup(ctx: ConformanceRunContext): void
```

### [`registerTimeoutSurface`](https://github.com/chughtapan/moltzap/blob/main/packages/protocol/src/testing/conformance/transport/adversity-timeout-surface.ts#L23)

*Function*

```ts theme={null}
export function registerTimeoutSurface(ctx: ConformanceRunContext): void
```

### [`ToxicBodyParams`](https://github.com/chughtapan/moltzap/blob/main/packages/protocol/src/testing/conformance/transport/_helpers.ts#L108)

*TypeAlias*

```ts theme={null}
export type ToxicBodyParams = {
  readonly proxy: ToxiproxyProxy;
  readonly unavailable: (reason: string) => PropertyUnavailable;
  readonly attachToxic: Effect.Effect<void, PropertyUnavailable, Scope.Scope>;
};
```

Body params — `attachToxic` attaches the toxic inside the caller's
scope. Nesting matters: the caller typically does

```ts theme={null}
Effect.scoped(gen(function* () {
  const client = yield* acquireProxiedClient(...)  // outer
  yield* Effect.scoped(gen(function* () {
    yield* attachToxic                             // inner
    yield* assertion(client)
  }))                                              // toxic removed
}))                                                // client close OK
```

so the toxic is removed BEFORE the agent client's socket close. Under
disruptive toxics (timeout, reset\_peer), this lets the WS close
handshake flow cleanly instead of hanging on a black-holed channel.

### [`TRANSPORT_PROPERTIES`](https://github.com/chughtapan/moltzap/blob/main/packages/protocol/src/testing/conformance/transport/index.ts#L31)

*Variable*

```ts theme={null}
export const TRANSPORT_PROPERTIES: ReadonlyArray<
  (ctx: ConformanceRunContext) => void
> = [
  registerLatencyResilience,
  registerResetPeerRecovery,
  registerTimeoutSurface,
  registerSlowCloseCleanup,
]
```

All transport-layer property registrars, in the order
`_shared/suite.ts` invokes them.

### [`unavailable`](https://github.com/chughtapan/moltzap/blob/main/packages/protocol/src/testing/conformance/transport/_helpers.ts#L110)

*Property*

```ts theme={null}
  readonly unavailable: (reason: string) => PropertyUnavailable;
```

### [`withToxicProxy`](https://github.com/chughtapan/moltzap/blob/main/packages/protocol/src/testing/conformance/transport/_helpers.ts#L120)

*Function*

```ts theme={null}
export function withToxicProxy(opts: {
  readonly ctx: ConformanceRunContext;
  readonly propertyName: string;
  readonly description: string;
  readonly proxyName: string;
  readonly profile: ToxicProfile;
  readonly body: (
    params: ToxicBodyParams,
  ) => Effect.Effect<void, ToxicPropertyError, Scope.Scope>;
}): void
```

Factory — wire a Toxiproxy proxy + attach the toxic; hand a body the
proxy. Hard-deadlines each property body so a hanging toxic can't
block the suite indefinitely; if the deadline fires, the property
reports `PropertyUnavailable` (not a pass, not a crash).

## Files

* `_helpers.ts`
* `adversity-latency-resilience.ts`
* `adversity-reset-peer-recovery.ts`
* `adversity-slow-close-cleanup.ts`
* `adversity-timeout-surface.ts`
* `index.ts`
