Files
cleveragents-core/features/cli_json_envelope.feature
T
HAL9000 195fbac109
CI / lint (pull_request) Successful in 40s
CI / helm (pull_request) Successful in 38s
CI / build (pull_request) Successful in 48s
CI / quality (pull_request) Successful in 1m0s
CI / typecheck (pull_request) Successful in 1m29s
CI / security (pull_request) Successful in 1m28s
CI / push-validation (pull_request) Successful in 20s
CI / unit_tests (pull_request) Successful in 5m8s
CI / docker (pull_request) Successful in 1m27s
CI / integration_tests (pull_request) Successful in 8m39s
CI / coverage (pull_request) Successful in 11m1s
CI / status-check (pull_request) Successful in 3s
fix: add required @a2a, @session, @cli tags to BDD feature files
Add domain-scenario Gherkin tags to all A2A, session, and CLI feature
files (30 files) so tests can be filtered individually via behave.

- 8 A2A feature files: @a2a tag
- 7 session feature files: @session tag
- 15 CLI feature files: @cli tag

ISSUES CLOSED: #9124
2026-06-02 15:41:06 -04:00

89 lines
4.3 KiB
Gherkin

@cli
Feature: CLI JSON/YAML output envelope structure
As a programmatic consumer of the CleverAgents CLI
I want all --format json and --format yaml outputs to include the spec-required envelope
So that I can reliably parse command, status, exit_code, data, timing, and messages fields
Background:
Given a CLI output format test runner
And a mocked lifecycle service for format tests
# ── Envelope field presence ──────────────────────────────────────────────
Scenario: JSON output includes all required envelope fields
Given there are actions for format testing
When I run action list with --format json
Then the JSON envelope should contain field "command"
And the JSON envelope should contain field "status"
And the JSON envelope should contain field "exit_code"
And the JSON envelope should contain field "data"
And the JSON envelope should contain field "timing"
And the JSON envelope should contain field "messages"
@tdd_issue @tdd_issue_4369 @tdd_expected_fail
Scenario: YAML output includes all required envelope fields
Given there are actions for format testing
When I run action list with --format yaml
Then the YAML envelope should contain field "command"
And the YAML envelope should contain field "status"
And the YAML envelope should contain field "exit_code"
And the YAML envelope should contain field "data"
And the YAML envelope should contain field "timing"
And the YAML envelope should contain field "messages"
# ── Envelope field values ────────────────────────────────────────────────
Scenario: JSON envelope status is "ok" for successful commands
Given there are actions for format testing
When I run action list with --format json
Then the JSON envelope status should be "ok"
Scenario: JSON envelope exit_code is 0 for successful commands
Given there are actions for format testing
When I run action list with --format json
Then the JSON envelope exit_code should be 0
Scenario: JSON envelope timing contains duration_ms
Given there are actions for format testing
When I run action list with --format json
Then the JSON envelope timing should contain "duration_ms"
Scenario: JSON envelope messages is a non-empty list
Given there are actions for format testing
When I run action list with --format json
Then the JSON envelope messages should be a non-empty list
# ── Data field contains actual payload ──────────────────────────────────
Scenario: JSON envelope data field contains actor list payload
Given there are actions for format testing
When I run action list with --format json
Then the JSON envelope data should contain actor records
@tdd_issue @tdd_issue_4370 @tdd_expected_fail
Scenario: YAML envelope data field contains actor list payload
Given there are actions for format testing
When I run action list with --format yaml
Then the YAML envelope data should contain actor records
# ── format_output() direct call envelope ────────────────────────────────
Scenario: Direct format_output call with json wraps data in envelope
When I call format_output with a dict and format json
Then the format result should be valid JSON dict
And the JSON result data field should contain original keys
Scenario: Direct format_output call with yaml wraps data in envelope
When I call format_output with a dict and format yaml
Then the format result should be valid YAML dict
And the YAML result data field should contain original keys
Scenario: Direct format_output call with command name sets envelope command
When I call format_output with command name "agents actor list" and format json
Then the JSON envelope command should be "agents actor list"
Scenario: Plain format does not wrap in envelope
When I call format_output with a dict and format plain
Then the format result should contain plain key-value pairs
And the plain result should not contain envelope keys