# `LlmCall.Media.Conformance`
[🔗](https://github.com/gilbertwong96/llm_call/blob/main/lib/llm_call/media/conformance.ex#L1)

Fixture-based assertions for media codec authors.

Test support, not a runtime dependency. Every function returns `:ok` or raises
an `ExUnit.AssertionError` naming the failed expectation.

    test "my media codec conforms" do
      Conformance.assert_info(MyCodec)
      Conformance.assert_submit_path(MyCodec, request, "/v1/my-images")
    end

# `assert_capabilities`

```elixir
@spec assert_capabilities(module(), LlmCall.Media.Request.t(), LlmCall.Config.t()) ::
  :ok
```

# `assert_capability_consistency`

```elixir
@spec assert_capability_consistency(
  module(),
  LlmCall.Media.Request.t(),
  LlmCall.Config.t()
) :: :ok
```

Checks that `capabilities/2` and `validate_request/2` agree.

Every declared `size`, `aspect_ratio`, `duration_s`, and `max_n` must be
accepted, and an undeclared non-nil value must be a validation error. The same
holds for the `seed` and `negative_prompt` flags and for `max_references`.

# `assert_capture_raw`

```elixir
@spec assert_capture_raw(module(), LlmCall.wire_value()) :: :ok
```

# `assert_encoded_request`

```elixir
@spec assert_encoded_request(LlmCall.EncodedRequest.t(), String.t()) :: :ok
```

Asserts the shape of any encoded request: a map body, a map query, a list of
headers, and no credential header.

`assert_operation/1` runs this over `Operation.next`, so a poll or asset-fetch
request cannot smuggle an `authorization` header past the submit check.

# `assert_info`

```elixir
@spec assert_info(module()) :: :ok
```

Asserts well-formed `info/0` metadata (see `LlmCall.Conformance`).

# `assert_operation`

```elixir
@spec assert_operation(LlmCall.Operation.t()) :: :ok
```

Checks one `LlmCall.Operation` against the state-machine invariants.

A state a codec can return must satisfy: `:queued`/`:in_progress` poll with no
result; `:completed` never polls, always has a result, and an `:asset` fetch
names its media type; `:failed` carries an error and nothing else. `id` is a
non-empty string or `nil`, `progress` is an integer in `0..100` or `nil`, and
`raw` is a map or `nil`.

# `assert_operation_capture_raw`

```elixir
@spec assert_operation_capture_raw(module(), LlmCall.wire_value(), LlmCall.Config.t()) ::
  :ok
```

Asserts that `decode_operation/2` applies the `capture_raw` policy to
`Operation.raw`.

The operation payload is the provider's job body, so `:none` must drop it and
`:response`/`:all` must keep it, matching `decode_submit/2`. `Error.raw` is
intentionally unconditional: an error keeps the payload it came from.

# `assert_submit_path`

```elixir
@spec assert_submit_path(module(), LlmCall.Media.Request.t(), String.t()) :: :ok
```

# `assert_sync_rejects_operation`

```elixir
@spec assert_sync_rejects_operation(module()) :: :ok
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
