[ENHANCEMENT] Align correction diff output with spec's file-level schema (files_changed, comparison list, patch_preview hunks) #10220

Open
opened 2026-04-17 07:54:59 +00:00 by hurui200320 · 1 comment
Member

Metadata

  • Commit Message: feat(plan): align correction diff output with spec file-level schema
  • Branch: feature/m4-correction-diff-spec-alignment

Background and Context

The agents plan diff --correction implementation (PR #9221, ticket #9085) produces a structured three-section output that intentionally deviates from the specification in three areas. These deviations were documented in code comments during the initial implementation and are tracked here for future alignment.

Spec Deviations

1. Summary section missing files_changed, new_insertions, new_deletions

The spec defines the Correction Diff summary section with files_changed, new_insertions, and new_deletions fields. The current implementation omits these file-level statistics (because they require a completed correction execution's ChangeSet) and substitutes state, guidance, created_at, completed_at as immediately available metadata.

Location: cleveragents.application.services.plan_apply_service._build_correction_diff_dict — summary section.

2. Comparison section is a dict instead of a list of file-level objects

The spec defines comparison as a list of file-level objects. The current implementation produces a dict with decision-level data (reverted vs added decisions).

Location: cleveragents.application.services.plan_apply_service._build_correction_diff_dict — comparison section.

3. Patch Preview section is a placeholder note instead of actual diff hunks

The spec defines patch_preview as a list of file-level diff objects with actual unified diff hunks. The current implementation produces only a note string (because full diff output requires the corrected execution's completed ChangeSet).

Location: cleveragents.application.services.plan_apply_service._build_correction_diff_dict — patch preview section.

Acceptance Criteria

  • Summary section includes files_changed, new_insertions, new_deletions fields (with zero/null values when data is unavailable)
  • Comparison section produces a list of file-level objects per the spec
  • Patch Preview section produces actual unified diff hunks when the correction execution is complete
  • All existing BDD and Robot tests updated to match new schema
  • Coverage >= 97%

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly.
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done.

Created by: PR #9221 review cycle 2 — tracks spec deviations documented in code comments.

## Metadata - **Commit Message**: `feat(plan): align correction diff output with spec file-level schema` - **Branch**: `feature/m4-correction-diff-spec-alignment` ## Background and Context The `agents plan diff --correction` implementation (PR #9221, ticket #9085) produces a structured three-section output that intentionally deviates from the specification in three areas. These deviations were documented in code comments during the initial implementation and are tracked here for future alignment. ## Spec Deviations ### 1. Summary section missing `files_changed`, `new_insertions`, `new_deletions` The spec defines the Correction Diff summary section with `files_changed`, `new_insertions`, and `new_deletions` fields. The current implementation omits these file-level statistics (because they require a completed correction execution's ChangeSet) and substitutes `state`, `guidance`, `created_at`, `completed_at` as immediately available metadata. **Location:** `cleveragents.application.services.plan_apply_service._build_correction_diff_dict` — summary section. ### 2. Comparison section is a `dict` instead of a `list` of file-level objects The spec defines `comparison` as a **list** of file-level objects. The current implementation produces a **dict** with decision-level data (reverted vs added decisions). **Location:** `cleveragents.application.services.plan_apply_service._build_correction_diff_dict` — comparison section. ### 3. Patch Preview section is a placeholder note instead of actual diff hunks The spec defines `patch_preview` as a list of file-level diff objects with actual unified diff hunks. The current implementation produces only a note string (because full diff output requires the corrected execution's completed ChangeSet). **Location:** `cleveragents.application.services.plan_apply_service._build_correction_diff_dict` — patch preview section. ## Acceptance Criteria - [ ] Summary section includes `files_changed`, `new_insertions`, `new_deletions` fields (with zero/null values when data is unavailable) - [ ] Comparison section produces a `list` of file-level objects per the spec - [ ] Patch Preview section produces actual unified diff hunks when the correction execution is complete - [ ] All existing BDD and Robot tests updated to match new schema - [ ] Coverage >= 97% ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly. - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done. --- **Created by:** PR #9221 review cycle 2 — tracks spec deviations documented in code comments.
Owner

@hurui200320 — Thank you for filing this enhancement issue.\n\nIssue #10220 has been received and logged. The three spec deviations you've identified in the agents plan diff --correction output are well-documented and the acceptance criteria are clear.\n\nTriage assessment:\n- Type: Enhancement (spec alignment)\n- Scope: plan_apply_service._build_correction_diff_dict — output schema alignment\n- Priority: Medium (spec compliance, not a blocking bug)\n- Milestone: This work is related to the M4 correction diff feature (v3.3.0)\n\nThe issue will be reviewed by the implementation team and scheduled for a future sprint. Labels and milestone will be applied shortly.\n\n---\nAutomated by CleverAgents Bot\nAgent: automation-tracking-manager\n

@hurui200320 — Thank you for filing this enhancement issue.\n\nIssue #10220 has been received and logged. The three spec deviations you've identified in the `agents plan diff --correction` output are well-documented and the acceptance criteria are clear.\n\n**Triage assessment:**\n- **Type**: Enhancement (spec alignment)\n- **Scope**: `plan_apply_service._build_correction_diff_dict` — output schema alignment\n- **Priority**: Medium (spec compliance, not a blocking bug)\n- **Milestone**: This work is related to the M4 correction diff feature (v3.3.0)\n\nThe issue will be reviewed by the implementation team and scheduled for a future sprint. Labels and milestone will be applied shortly.\n\n---\n**Automated by CleverAgents Bot**\nAgent: automation-tracking-manager\n
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

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