fix(cli): add missing Origin panel, Overridden field, Winner indicator, and JSON envelope in config get output #3458

Merged
HAL9000 merged 4 commits from fix/config-get-output-missing-origin-panel-and-envelope into master 2026-06-02 04:27:05 +00:00

4 Commits

Author SHA1 Message Date
HAL9000 082b39db79 fix(cli): repair config get JSON envelope and step staleness
CI / lint (pull_request) Successful in 45s
CI / push-validation (pull_request) Successful in 20s
CI / typecheck (pull_request) Successful in 1m2s
CI / build (pull_request) Successful in 47s
CI / helm (pull_request) Successful in 53s
CI / quality (pull_request) Successful in 1m8s
CI / security (pull_request) Successful in 1m11s
CI / unit_tests (pull_request) Successful in 7m21s
CI / docker (pull_request) Successful in 1m35s
CI / integration_tests (pull_request) Successful in 10m46s
CI / coverage (pull_request) Successful in 8m15s
CI / status-check (pull_request) Successful in 2s
The previous attempt left three CI-breaking issues:

- features/steps/config_cli_safety_net_coverage_steps.py imported
  _env_var_for_key/_normalize_key from config.py, but those helpers
  moved to _config_helpers.py and were never re-exported. Import
  from _config_helpers directly (matches where the symbols live).

- features/steps/config_get_spec_output_steps.py defined two when-
  steps whose default-parse {key} placeholders made the longer step
  ambiguous against the shorter one (behave raised AmbiguousStep on
  load). Switch those two patterns to the re matcher with [^"]+ so
  the quoted argument can't swallow ` with format "..."`.

- The same step file cached parsed JSON on context._spec_json with
  no invalidation. Behave layers context attributes — a value set at
  one scenario's layer remained visible to later scenarios, so the
  assertion read stale JSON from an earlier scenario's get. Parse
  fresh each call.

- src/cleveragents/cli/commands/config.py built a spec-correct JSON
  envelope and then passed it through format_output, which wraps its
  input in another envelope — the outer envelope's data field was
  the inner envelope, so data.type / data.source / data.overridden
  were absent. Emit the manually-built envelope directly via
  json.dumps / yaml.safe_dump so the started timing field and all
  spec data fields appear at the correct depth.

ISSUES CLOSED: #3423
2026-06-01 23:37:30 -04:00
cleveragents-auto 9d8a5b8813 chore: worker ruff auto-fix (pre-push lint gate) 2026-06-01 23:37:30 -04:00
HAL9000 8c926f9bba fix(cli): repair test import and restore --verbose no-op in config get
- Import _env_var_for_key from _config_helpers (where it was moved
  during refactor) instead of config module, fixing ImportError that
  blocked all unit_tests from running
- Restore --verbose / -v as a deprecated no-op parameter on config_get
  so existing tests and user scripts that pass --verbose continue to work;
  resolution chain is always shown per spec regardless of the flag
- Fix CliRunner(mix_stderr=False) in config_get_spec_output_steps.py to
  CliRunner() — mix_stderr is not accepted by this version of Typer

ISSUES CLOSED: #3423
2026-06-01 23:37:30 -04:00
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