UAT: Plan domain model missing spec-required Apply phase fields — applied_artifacts, approval_record, and deployment_record #3834

Open
opened 2026-04-06 06:50:41 +00:00 by freemo · 0 comments
Owner

Metadata

  • Branch: feat/plan-apply-phase-data-model
  • Commit Message: feat(plan): add applied_artifacts, approval_record, and deployment_record fields to Plan model
  • Milestone: (backlog — see note below)
  • Parent Epic: #394

Backlog note: This issue was discovered during autonomous operation
on milestone v3.3.0. It does not block milestone completion and has been
placed in the backlog for human review and future milestone assignment.

Summary

The Plan domain model (src/cleveragents/domain/models/core/plan.py) is missing three spec-required fields for the Apply phase: applied_artifacts, approval_record, and deployment_record. The specification (§19851-19859) defines these as required components of a plan in Apply phase.

What Was Tested

Code-level analysis of Plan domain model against specification §19851-19859 (Apply Data Model).

Expected Behavior (from spec)

Per specification §19851-19859, a plan in Apply phase must include:

  1. apply_summary — Summary of what was applied (partially covered via error_details metadata)
  2. applied_artifacts — Final commit hash, merged PR link, file list
  3. final_validation_results — Per-validation tool invocation results: passed, message, and data for each
  4. approval_record — If human approvals are required
  5. deployment_record — Optional, if apply triggers deploy

Actual Behavior

Searching src/cleveragents/domain/models/core/plan.py for these fields returns no results:

  • applied_artifactsmissing
  • approval_recordmissing
  • deployment_recordmissing

The final_validation_results field exists only in FixThenRevalidateResult (a separate model), not on the Plan model itself.

The PlanApplyService stores apply summary in error_details (a dict[str, str]) as a workaround, but this is not the spec-required structured apply_summary field.

Code Location

  • src/cleveragents/domain/models/core/plan.py, lines 680-760 (execution placeholders section)
  • src/cleveragents/application/services/plan_apply_service.py, lines 357-392 (persist_apply_summary uses error_details as workaround)
  • The spec reference: docs/specification.md §19851-19859

Impact

  • Apply phase results are not properly tracked — no record of what was actually committed
  • Human approval workflows cannot be tracked (no approval_record)
  • Deployment records cannot be attached to plans
  • agents plan artifacts command cannot show proper applied artifacts (uses changeset entries instead)
  • Audit trail for Apply phase is incomplete

Subtasks

  • Add applied_artifacts: AppliedArtifacts | None field to Plan model
  • Define AppliedArtifacts model with: commit_hash, pr_url, file_list, applied_at
  • Add approval_record: ApprovalRecord | None field to Plan model
  • Define ApprovalRecord model with: approved_by, approved_at, approval_notes
  • Add deployment_record: DeploymentRecord | None field to Plan model
  • Define DeploymentRecord model with: deployment_id, deployed_at, deployment_url, status
  • Update PlanApplyService to populate applied_artifacts during Apply phase
  • Add Behave tests for Apply phase data model fields

Definition of Done

  • Plan model has applied_artifacts, approval_record, and deployment_record fields matching spec §19851-19859
  • PlanApplyService populates applied_artifacts during Apply phase
  • All existing tests pass
  • New Behave tests cover the new fields
  • All nox stages pass
  • Coverage >= 97%

Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: ca-new-issue-creator

## Metadata - **Branch**: `feat/plan-apply-phase-data-model` - **Commit Message**: `feat(plan): add applied_artifacts, approval_record, and deployment_record fields to Plan model` - **Milestone**: *(backlog — see note below)* - **Parent Epic**: #394 > **Backlog note:** This issue was discovered during autonomous operation > on milestone v3.3.0. It does not block milestone completion and has been > placed in the backlog for human review and future milestone assignment. ## Summary The `Plan` domain model (`src/cleveragents/domain/models/core/plan.py`) is missing three spec-required fields for the Apply phase: `applied_artifacts`, `approval_record`, and `deployment_record`. The specification (§19851-19859) defines these as required components of a plan in Apply phase. ## What Was Tested Code-level analysis of `Plan` domain model against specification §19851-19859 (Apply Data Model). ## Expected Behavior (from spec) Per specification §19851-19859, a plan in Apply phase must include: 1. **`apply_summary`** — Summary of what was applied (partially covered via `error_details` metadata) 2. **`applied_artifacts`** — Final commit hash, merged PR link, file list 3. **`final_validation_results`** — Per-validation tool invocation results: `passed`, `message`, and `data` for each 4. **`approval_record`** — If human approvals are required 5. **`deployment_record`** — Optional, if apply triggers deploy ## Actual Behavior Searching `src/cleveragents/domain/models/core/plan.py` for these fields returns no results: - `applied_artifacts` — **missing** - `approval_record` — **missing** - `deployment_record` — **missing** The `final_validation_results` field exists only in `FixThenRevalidateResult` (a separate model), not on the `Plan` model itself. The `PlanApplyService` stores apply summary in `error_details` (a `dict[str, str]`) as a workaround, but this is not the spec-required structured `apply_summary` field. ## Code Location - `src/cleveragents/domain/models/core/plan.py`, lines 680-760 (execution placeholders section) - `src/cleveragents/application/services/plan_apply_service.py`, lines 357-392 (`persist_apply_summary` uses `error_details` as workaround) - The spec reference: `docs/specification.md` §19851-19859 ## Impact - Apply phase results are not properly tracked — no record of what was actually committed - Human approval workflows cannot be tracked (no `approval_record`) - Deployment records cannot be attached to plans - `agents plan artifacts` command cannot show proper applied artifacts (uses changeset entries instead) - Audit trail for Apply phase is incomplete ## Subtasks - [ ] Add `applied_artifacts: AppliedArtifacts | None` field to `Plan` model - [ ] Define `AppliedArtifacts` model with: commit_hash, pr_url, file_list, applied_at - [ ] Add `approval_record: ApprovalRecord | None` field to `Plan` model - [ ] Define `ApprovalRecord` model with: approved_by, approved_at, approval_notes - [ ] Add `deployment_record: DeploymentRecord | None` field to `Plan` model - [ ] Define `DeploymentRecord` model with: deployment_id, deployed_at, deployment_url, status - [ ] Update `PlanApplyService` to populate `applied_artifacts` during Apply phase - [ ] Add Behave tests for Apply phase data model fields ## Definition of Done - [ ] `Plan` model has `applied_artifacts`, `approval_record`, and `deployment_record` fields matching spec §19851-19859 - [ ] `PlanApplyService` populates `applied_artifacts` during Apply phase - [ ] All existing tests pass - [ ] New Behave tests cover the new fields - [ ] All nox stages pass - [ ] Coverage >= 97% --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
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.

Blocks
#394 Epic: Decision Framework
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#3834
No description provided.