Skip to content

Keep workflow compression payloads self-describing#534

Merged
lucasmrdt merged 3 commits into
vibe/workflow-payload-compression-a9710dfrom
vibe/fix-payload-encoding-arity-d982a2
May 20, 2026
Merged

Keep workflow compression payloads self-describing#534
lucasmrdt merged 3 commits into
vibe/workflow-payload-compression-a9710dfrom
vibe/fix-payload-encoding-arity-d982a2

Conversation

@lucasmrdt
Copy link
Copy Markdown

@lucasmrdt lucasmrdt commented May 20, 2026

Context

This PR is stacked on #526. It fixes the workflow worker failure where existing callers still unpack encode_payload_content(...) as two values:

encoded_data, encoding_options = await encoder.encode_payload_content(data, context)

#526 introduced a third returned value for compression metadata, which breaks that caller shape with ValueError: too many values to unpack.

Changes

  • Restores encode_payload_content(...) to its two-value contract: (encoded_data, encoding_options).
  • Wraps compressed bytes in a CompressedPayloadData envelope containing:
    • the compression config
    • the base64-encoded compressed payload
  • Decodes compressed payloads from that envelope, so compression metadata travels with the bytes instead of through a separate return value.
  • Keeps the tampered-compression-level regression test: zstd decompression must not depend on the configured compression level.
  • Raises WorkflowPayloadCompressionException for invalid compressed payload envelopes/base64/config instead of leaking generic validation errors.

Tests

  • uv run ruff check src/mistralai/extra/workflows/encoding/payload_encoder.py src/mistralai/extra/workflows/encoding/payload_compressor.py src/mistralai/extra/tests/test_workflow_encoding.py
  • uv run pytest src/mistralai/extra/tests/test_workflow_encoding.py -q

@lucasmrdt lucasmrdt changed the title Wrap compressed workflow payload data Keep workflow compression payloads self-describing May 20, 2026
@lucasmrdt lucasmrdt marked this pull request as ready for review May 20, 2026 16:51
@lucasmrdt lucasmrdt merged commit c78d437 into vibe/workflow-payload-compression-a9710d May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants