fix(cli): wrap plan apply --format json output in spec-required JSON envelope (#9817) #10982

Merged
HAL9000 merged 6 commits from pr/9817-plan-apply-json-envelope into master 2026-06-17 11:56:18 +00:00

6 Commits

Author SHA1 Message Date
controller-ci-rerun 90100d889d chore: re-trigger CI [controller]
CI / load-versions (pull_request) Successful in 29s
CI / push-validation (pull_request) Successful in 21s
CI / lint (pull_request) Successful in 35s
CI / typecheck (pull_request) Successful in 1m4s
CI / security (pull_request) Successful in 1m1s
CI / build (pull_request) Successful in 43s
CI / quality (pull_request) Successful in 1m19s
CI / helm (pull_request) Successful in 37s
CI / unit_tests (pull_request) Successful in 5m46s
CI / docker (pull_request) Successful in 1m32s
CI / integration_tests (pull_request) Successful in 9m18s
CI / coverage (pull_request) Successful in 9m11s
CI / status-check (pull_request) Successful in 2s
2026-06-17 07:33:01 -04:00
HAL9000 334a0c745d fix(tests): correct validation key from "test" to "tests" in robot helper
CI / load-versions (pull_request) Successful in 17s
CI / push-validation (pull_request) Successful in 24s
CI / lint (pull_request) Successful in 43s
CI / build (pull_request) Successful in 50s
CI / quality (pull_request) Successful in 53s
CI / typecheck (pull_request) Successful in 1m18s
CI / security (pull_request) Successful in 1m19s
CI / helm (pull_request) Successful in 46s
CI / unit_tests (pull_request) Successful in 4m39s
CI / docker (pull_request) Successful in 1m23s
CI / integration_tests (pull_request) Failing after 8m32s
CI / coverage (pull_request) Successful in 10m13s
CI / status-check (pull_request) Failing after 4s
The verify_validation_sub_fields() helper checked for key "test" but
_apply_output_dict() uses "tests" (plural), causing the Robot Framework
integration test "Validation Contains Test Lint Type Check" to always
exit with rc=1.

ISSUES CLOSED: #9449
2026-06-17 06:49:43 -04:00
HAL9000 bbe8d830d5 fix(cli): correct _apply_output_dict data fields to match spec
Fix the spec-required data structure for `agents plan apply --format json`:
- artifacts: [] -> 0 (integer count per spec)
- changes: [] -> {"insertions": 0, "deletions": 0} (dict per spec)
- validation: rename "test" -> "tests" with nested dict structure, restructure
  "lint" and "type_check" as nested dicts, rename "duration" -> "duration_s" (float)
- lifecycle.child_plans: [] -> 0 (integer count per spec)
- timing.applied_at key renamed to timing.started per spec

Update BDD tests to match corrected implementation:
- plan_apply_json_envelope.feature: check "tests" not "test" in validation
- plan_cli_coverage_boost.feature: remove non-spec "namespaced_name" assertion
- plan_cli_coverage_boost_steps.py: check flat string messages per spec,
  not {"level", "text"} objects

ISSUES CLOSED: #9449
2026-06-17 06:49:43 -04:00
controller-ci-rerun 4287c060b7 chore: re-trigger CI [controller] 2026-06-17 06:49:43 -04:00
controller-ci-rerun aca8573982 chore: re-trigger CI [controller] 2026-06-17 06:49:43 -04:00
HAL9000 e2be4fb4a1 fix(cli): wrap plan apply --format json output in spec-required JSON envelope
The `agents plan apply --format json` command now produces a properly structured
JSON envelope with all required fields (command, status, exit_code, data, timing,
messages). Previously the output used raw plan data without the spec-required
envelope wrapper, making it inconsistent with `plan execute --format json`.

Changes:
- Add `_apply_output_dict()` function to build the spec-required JSON envelope
  for plan apply (matching `_execute_output_dict` pattern)
- Track wall-clock timing in `lifecycle_apply_plan()` and pass to envelope builder
- Update `lifecycle_apply_plan()` to use the new envelope instead of raw data
- Add BDD scenarios verifying the envelope structure for apply output
- Update CHANGELOG.md and CONTRIBUTORS.md

ISSUES CLOSED: #9449
2026-06-17 06:49:43 -04:00