fix(cli): align output envelope with specification structure #1187

Merged
freemo merged 1 commits from feature/m4-output-envelope into master 2026-03-30 18:06:36 +00:00
Owner

Summary

Aligns the structured output envelope (JSON/YAML modes) with the specification: {command, status, exit_code, data, timing, messages}.

Changes

  • src/cleveragents/cli/output/session.py: Added status: str field to StructuredOutput; snapshot() and close() derive status from exit_code
  • src/cleveragents/cli/output/materializers.py: _snapshot_to_dict() now emits spec-compliant envelope keys (data instead of elements, messages instead of metadata)
  • Updated BDD step definitions and Robot test helpers to use new key names

Motivation

The previous envelope used non-standard field names (elements, metadata) and was missing the status field, causing spec non-compliance in machine-readable output formats.

Closes #884

## Summary Aligns the structured output envelope (JSON/YAML modes) with the specification: `{command, status, exit_code, data, timing, messages}`. ## Changes - `src/cleveragents/cli/output/session.py`: Added `status: str` field to `StructuredOutput`; `snapshot()` and `close()` derive status from `exit_code` - `src/cleveragents/cli/output/materializers.py`: `_snapshot_to_dict()` now emits spec-compliant envelope keys (`data` instead of `elements`, `messages` instead of `metadata`) - Updated BDD step definitions and Robot test helpers to use new key names ## Motivation The previous envelope used non-standard field names (`elements`, `metadata`) and was missing the `status` field, causing spec non-compliance in machine-readable output formats. Closes #884
freemo added this to the v3.4.0 milestone 2026-03-29 04:09:41 +00:00
freemo added the
Type
Task
label 2026-03-29 04:09:46 +00:00
freemo reviewed 2026-03-30 04:22:55 +00:00
freemo left a comment
Author
Owner

Review: Looks Good (self-authored — posted as comment)

Clean spec alignment renaming envelope fields (elements -> data, metadata -> messages) and adding status field. Breaking serialization change should be noted in changelog. SD-13 deviation correctly marked as IMPLEMENTED.

## Review: Looks Good (self-authored — posted as comment) Clean spec alignment renaming envelope fields (`elements` -> `data`, `metadata` -> `messages`) and adding `status` field. Breaking serialization change should be noted in changelog. SD-13 deviation correctly marked as IMPLEMENTED.
freemo requested review from CoreRasurae 2026-03-30 05:14:15 +00:00
freemo requested review from brent.edwards 2026-03-30 05:14:16 +00:00
freemo scheduled this pull request to auto merge when all checks succeed 2026-03-30 17:13:45 +00:00
freemo force-pushed feature/m4-output-envelope from 8dd17abb16 to 1c1f477208 2026-03-30 17:48:51 +00:00 Compare
freemo merged commit 1c1f477208 into master 2026-03-30 18:06:36 +00:00
freemo deleted branch feature/m4-output-envelope 2026-03-30 18:06:37 +00:00
Sign in to join this conversation.
No Label
Type
Task
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: cleveragents/cleveragents-core#1187