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
Summary
Functions
Checks that capabilities/2 and validate_request/2 agree.
Asserts the shape of any encoded request: a map body, a map query, a list of headers, and no credential header.
Asserts well-formed info/0 metadata (see LlmCall.Conformance).
Checks one LlmCall.Operation against the state-machine invariants.
Asserts that decode_operation/2 applies the capture_raw policy to
Operation.raw.
Functions
@spec assert_capabilities(module(), LlmCall.Media.Request.t(), LlmCall.Config.t()) :: :ok
@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.
@spec assert_capture_raw(module(), LlmCall.wire_value()) :: :ok
@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.
@spec assert_info(module()) :: :ok
Asserts well-formed info/0 metadata (see LlmCall.Conformance).
@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.
@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.
@spec assert_submit_path(module(), LlmCall.Media.Request.t(), String.t()) :: :ok
@spec assert_sync_rejects_operation(module()) :: :ok