feat(plan): add diff review and apply integration #306

Closed
opened 2026-02-22 23:41:08 +00:00 by freemo · 1 comment
Owner

Metadata

  • Commit: feat(plan): add diff review and apply integration
  • Branch: feature/m2-plan-apply-review

Subtasks

  • Add plan diff output using ChangeSet summaries and per-resource diffs.
  • Add plan artifacts output including ChangeSet ID, sandbox refs, and apply summary.
  • Persist apply summary (files changed, validations) and apply timestamps into Plan metadata for plan status.
  • Add merge failure handling with sandbox rollback and explicit error output.
  • Add guard to prevent Apply when ChangeSet is empty unless --allow-empty is set.
  • Update CLI reference for plan diff/plan artifacts output formats.
  • Add apply error cases and recovery steps (re-run execute, fix validation).
  • Tests (Behave): Add features/plan_diff_artifacts.feature for diff/artifact output fields.
  • Tests (Robot): Add robot/plan_diff_artifacts.robot for end-to-end diff/artifacts.
  • Tests (ASV): Add benchmarks/plan_diff_bench.py for diff rendering overhead.
  • Verify coverage >=97% via nox -s coverage_report. If coverage is <97% then review the current unit test coverage report at build/coverage.xml and use it to write new Behave based unit tests to improve code coverage. Specifically, write Behave style unit tests that are descriptively named and specifically improves coverage on whichever file has the most uncovered lines by writing tests that will target the uncovered lines in the report. Once that is done rerun nox -s coverage_report to verify all tests pass and coverage is above >=97%. Only mark this as complete once coverage is >=97%, if not repeat this task as many times as is needed until coverage reaches >=97%.
  • Run nox (all default sessions, including benchmark), fix any errors if needed ensuring nox passes.

Section: ### Section 6: Execution Pipeline, Decisions & Invariants [M1-M4]
Status: Completed

## Metadata - **Commit**: `feat(plan): add diff review and apply integration` - **Branch**: `feature/m2-plan-apply-review` ## Subtasks - [x] Add `plan diff` output using ChangeSet summaries and per-resource diffs. - [x] Add `plan artifacts` output including ChangeSet ID, sandbox refs, and apply summary. - [x] Persist apply summary (files changed, validations) and apply timestamps into Plan metadata for `plan status`. - [x] Add merge failure handling with sandbox rollback and explicit error output. - [x] Add guard to prevent Apply when ChangeSet is empty unless `--allow-empty` is set. - [x] Update CLI reference for `plan diff`/`plan artifacts` output formats. - [x] Add apply error cases and recovery steps (re-run execute, fix validation). - [x] Tests (Behave): Add `features/plan_diff_artifacts.feature` for diff/artifact output fields. - [x] Tests (Robot): Add `robot/plan_diff_artifacts.robot` for end-to-end diff/artifacts. - [x] Tests (ASV): Add `benchmarks/plan_diff_bench.py` for diff rendering overhead. - [x] Verify coverage >=97% via `nox -s coverage_report`. If coverage is <97% then review the current unit test coverage report at `build/coverage.xml` and use it to write new Behave based unit tests to improve code coverage. Specifically, write Behave style unit tests that are descriptively named and specifically improves coverage on whichever file has the most uncovered lines by writing tests that will target the uncovered lines in the report. Once that is done rerun `nox -s coverage_report` to verify all tests pass and coverage is above >=97%. Only mark this as complete once coverage is >=97%, if not repeat this task as many times as is needed until coverage reaches >=97%. - [x] Run `nox` (all default sessions, including benchmark), fix any errors if needed ensuring nox passes. **Section**: ### Section 6: Execution Pipeline, Decisions & Invariants [M1-M4] **Status**: Completed
freemo added this to the v3.2.0 milestone 2026-02-22 23:41:08 +00:00
freemo self-assigned this 2026-02-22 23:41:08 +00:00
Author
Owner

Implementation Notes — D0b.apply: Diff Review + Apply Integration

2026-02-20: D0b.apply Complete - Diff Review + Apply Integration [Jeff]

  • Created PlanApplyService with diff(), artifacts(), persist_apply_summary(), handle_merge_failure(), guard_empty_changeset().
  • Key decision: Used error_details dict on Plan as general metadata store for apply summary fields until a dedicated metadata field lands.
  • Key decision: Service accepts optional changeset_store — when None, builds stub SpecChangeSet from plan metadata only.

(Migrated from docs/implementation-notes.md)

## Implementation Notes — D0b.apply: Diff Review + Apply Integration **2026-02-20**: D0b.apply Complete - Diff Review + Apply Integration [Jeff] - Created `PlanApplyService` with `diff()`, `artifacts()`, `persist_apply_summary()`, `handle_merge_failure()`, `guard_empty_changeset()`. - Key decision: Used `error_details` dict on Plan as general metadata store for apply summary fields until a dedicated metadata field lands. - Key decision: Service accepts optional `changeset_store` — when None, builds stub SpecChangeSet from plan metadata only. *(Migrated from `docs/implementation-notes.md`)*
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
cleveragents/cleveragents-core#306
No description provided.