Files
cleveragents-core/features/config_get_spec_output.feature
freemo 0cff709531 fix(cli): add missing Origin panel, Overridden field, Winner indicator, and JSON envelope in config get output
Implements all spec-required output for `agents config get`:

Rich output:
- Rename panel title from 'Configuration Value' to 'Config' per spec
- Add 'Overridden' field to the Config panel
- Add 'Origin' panel showing File, Line, and Default fields
- Add 'Resolution Chain' panel (always shown, not just with --verbose)
- Add 'Winner' indicator to the Resolution Chain panel
- Use spec-required type strings (string/boolean/integer) instead of
  Python type names (str/bool/int)
- Add '✓ OK Config read' confirmation message

JSON output:
- Wrap result in standard envelope (command, status, exit_code, data,
  timing, messages)
- Add 'overridden' field to data
- Add 'origin' nested object (file, line, default)
- Add 'winner' nested object (source, level)
- Use human-readable source names (CLI flag, Env var, Config file,
  Default) instead of internal enum values
- Add 'started' timestamp to timing

BDD:
- Add features/config_get_spec_output.feature with 20 scenarios
  covering all Rich panels and JSON envelope fields
- Update existing tests to match new spec-compliant output

ISSUES CLOSED: #3423
2026-06-01 23:37:30 -04:00

121 lines
5.7 KiB
Gherkin

Feature: agents config get spec-compliant output
As a developer
I want `agents config get` to render all spec-required panels and JSON fields
So that the output matches the specification exactly
Background:
Given a clean config get spec test environment
# --- Rich output: three panels ---
Scenario: Rich output shows Config panel with correct title
When I run spec config get "core.log.level"
Then the spec config get should succeed
And the spec config get rich output should contain panel "Config"
Scenario: Rich output shows Overridden field in Config panel
When I run spec config get "core.log.level"
Then the spec config get should succeed
And the spec config get rich output should contain "Overridden"
Scenario: Rich output shows Origin panel
When I run spec config get "core.log.level"
Then the spec config get should succeed
And the spec config get rich output should contain panel "Origin"
Scenario: Rich output shows Resolution Chain panel
When I run spec config get "core.log.level"
Then the spec config get should succeed
And the spec config get rich output should contain panel "Resolution Chain"
Scenario: Rich output shows Winner in Resolution Chain panel
When I run spec config get "core.log.level"
Then the spec config get should succeed
And the spec config get rich output should contain "Winner"
Scenario: Rich output uses spec type string not Python type name
When I run spec config get "core.log.level"
Then the spec config get should succeed
And the spec config get rich output should contain "string"
And the spec config get rich output should not contain "str"
Scenario: Rich output shows OK confirmation message
When I run spec config get "core.log.level"
Then the spec config get should succeed
And the spec config get rich output should contain "OK"
# --- JSON output: standard envelope ---
Scenario: JSON output is wrapped in standard envelope
When I run spec config get "core.log.level" with format "json"
Then the spec config get should succeed
And the spec config get JSON envelope should have field "command" equal to "config get"
And the spec config get JSON envelope should have field "status" equal to "ok"
And the spec config get JSON envelope should have field "exit_code" equal to 0
And the spec config get JSON envelope should have field "data"
And the spec config get JSON envelope should have field "timing"
And the spec config get JSON envelope should have field "messages"
Scenario: JSON data contains all required fields
When I run spec config get "core.log.level" with format "json"
Then the spec config get should succeed
And the spec config get JSON data should have field "key"
And the spec config get JSON data should have field "value"
And the spec config get JSON data should have field "source"
And the spec config get JSON data should have field "overridden"
And the spec config get JSON data should have field "type"
And the spec config get JSON data should have field "origin"
And the spec config get JSON data should have field "resolution_chain"
And the spec config get JSON data should have field "winner"
Scenario: JSON data type field uses spec type string
When I run spec config get "core.log.level" with format "json"
Then the spec config get should succeed
And the spec config get JSON data field "type" should equal "string"
Scenario: JSON data overridden field is false for default value
When I run spec config get "core.log.level" with format "json"
Then the spec config get should succeed
And the spec config get JSON data field "overridden" should be false
Scenario: JSON data overridden field is true when value is set
Given I have set spec config "core.log.level" to "DEBUG"
When I run spec config get "core.log.level" with format "json"
Then the spec config get should succeed
And the spec config get JSON data field "overridden" should be true
Scenario: JSON data origin contains default field
When I run spec config get "core.log.level" with format "json"
Then the spec config get should succeed
And the spec config get JSON origin should have field "default"
Scenario: JSON data resolution chain uses human-readable source names
When I run spec config get "core.log.level" with format "json"
Then the spec config get should succeed
And the spec config get JSON resolution chain should use human-readable source names
Scenario: JSON data winner contains source and level
When I run spec config get "core.log.level" with format "json"
Then the spec config get should succeed
And the spec config get JSON winner should have field "source"
And the spec config get JSON winner should have field "level"
Scenario: JSON timing contains started and duration_ms
When I run spec config get "core.log.level" with format "json"
Then the spec config get should succeed
And the spec config get JSON timing should have field "started"
And the spec config get JSON timing should have field "duration_ms"
# --- Source name mapping ---
Scenario: JSON source uses short name "config" when value from global config
Given I have set spec config "core.log.level" to "WARNING"
When I run spec config get "core.log.level" with format "json"
Then the spec config get should succeed
And the spec config get JSON data field "source" should equal "config"
Scenario: JSON source uses short name "default" when value from default
When I run spec config get "core.log.level" with format "json"
Then the spec config get should succeed
And the spec config get JSON data field "source" should equal "default"