feat(domain): align plan model with spec #233

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

Metadata

  • Commit: feat(domain): align plan model with spec
  • Branch: feature/m1-plan-model

Subtasks

  • Remove Action phase from PlanPhase; align lifecycle to strategize/execute/apply/applied.
  • Replace action_state with processing_state only; enforce phase/state consistency per spec. Field is processing_state with @property def state alias.
  • Add action_name (namespaced) and remove action_id usage throughout plan model.
  • Replace project_ids with project_links (name, alias, read_only) and enforce alias uniqueness.
  • Add automation_profile with provenance tags (plan/action/project/global) and lock after creation. Uses AutomationProfileRef model.
  • Add invariants list with source tags and stable ordering for CLI rendering. Uses InvariantSource enum (not InvariantScope).
  • Add arguments map + arguments_order, and persist rendered description/definition_of_done at plan creation.
  • Add changeset_id, sandbox_refs, validation_summary, decision_root_id, error_message, error_details placeholders.
  • Add Plan.as_cli_dict() for stable output and ProjectLink.validate_alias() helper.
  • Update docs/reference/plan_model.md with phase/state semantics and linkage fields (~270 lines).
  • Tests (Behave): Add scenarios for phase transitions, automation profile provenance, invariant ordering, and project link alias errors. Created features/plan_model_coverage.feature (39 scenarios) + features/steps/plan_model_coverage_steps.py (489 lines). Total: 75 plan model scenarios (36 in plan_model.feature + 39 in plan_model_coverage.feature).
  • Tests (Robot): Add Robot scenario asserting plan status renders action_name + automation profile provenance (plan-status-rendering in robot/plan_lifecycle_v3.robot).
  • Tests (ASV): Add benchmarks/plan_model_bench.py for plan validation + serialization (5 suites, 15 benchmarks).
  • Run nox (all default sessions, including benchmark). NOTE: Benchmark fails because ASV installs from git HEAD; uncommitted code not available in ASV env. All other sessions pass. Results: lint 0 errors, typecheck 0 errors, 130 Behave features / 2246 scenarios / 9868 steps pass, 206 Robot tests pass.
  • Verify coverage >=97% via nox -s coverage_report. Coverage: plan.py 100% (275 stmts / 56 branches / 0 misses). Overall >=97%.

Section: #### Section 3 Notes
Status: Completed

## Metadata - **Commit**: `feat(domain): align plan model with spec` - **Branch**: `feature/m1-plan-model` ## Subtasks - [x] Remove Action phase from `PlanPhase`; align lifecycle to strategize/execute/apply/applied. - [x] Replace `action_state` with `processing_state` only; enforce phase/state consistency per spec. Field is `processing_state` with `@property def state` alias. - [x] Add `action_name` (namespaced) and remove `action_id` usage throughout plan model. - [x] Replace `project_ids` with `project_links` (name, alias, read_only) and enforce alias uniqueness. - [x] Add `automation_profile` with provenance tags (plan/action/project/global) and lock after creation. Uses `AutomationProfileRef` model. - [x] Add `invariants` list with source tags and stable ordering for CLI rendering. Uses `InvariantSource` enum (not `InvariantScope`). - [x] Add `arguments` map + `arguments_order`, and persist rendered `description`/`definition_of_done` at plan creation. - [x] Add `changeset_id`, `sandbox_refs`, `validation_summary`, `decision_root_id`, `error_message`, `error_details` placeholders. - [x] Add `Plan.as_cli_dict()` for stable output and `ProjectLink.validate_alias()` helper. - [x] Update `docs/reference/plan_model.md` with phase/state semantics and linkage fields (~270 lines). - [x] Tests (Behave): Add scenarios for phase transitions, automation profile provenance, invariant ordering, and project link alias errors. Created `features/plan_model_coverage.feature` (39 scenarios) + `features/steps/plan_model_coverage_steps.py` (489 lines). Total: 75 plan model scenarios (36 in `plan_model.feature` + 39 in `plan_model_coverage.feature`). - [x] Tests (Robot): Add Robot scenario asserting `plan status` renders action_name + automation profile provenance (`plan-status-rendering` in `robot/plan_lifecycle_v3.robot`). - [x] Tests (ASV): Add `benchmarks/plan_model_bench.py` for plan validation + serialization (5 suites, 15 benchmarks). - [x] Run `nox` (all default sessions, including benchmark). NOTE: Benchmark fails because ASV installs from git HEAD; uncommitted code not available in ASV env. All other sessions pass. Results: lint 0 errors, typecheck 0 errors, 130 Behave features / 2246 scenarios / 9868 steps pass, 206 Robot tests pass. - [x] Verify coverage >=97% via `nox -s coverage_report`. Coverage: `plan.py` 100% (275 stmts / 56 branches / 0 misses). Overall >=97%. **Section**: #### Section 3 Notes **Status**: Completed
freemo added this to the v3.0.0 milestone 2026-02-22 23:40:22 +00:00
Author
Owner

Implementation Notes — Stage A2b.beta: Plan Model Alignment

2026-02-13: Stage A2b.beta Complete - Plan Model Alignment

  • Rewrote plan.py to align with spec: processing_state replaces action_state/state, project_links replaces project_ids, added action_name, automation_profile, invariants, actor fields, subplan hierarchy.
  • Rebased feature/m1-plan-model onto A2b.alpha commit. Resolved 30 merge conflicts. Key design decisions during merge:
    1. Plan field name: processing_state (per spec), NOT state.
    2. Invariant enum: InvariantSource (our naming), NOT InvariantScope.
    3. Action model: HEAD taken as-is (authoritative for action domain).
    4. No action_id on Action domain model — uses namespaced_name only.
    5. project_links used everywhere (NOT project_ids).
  • Fixed 6 post-rebase test failures.
  • Final results: 130 Behave features / 2246 scenarios / 9868 steps all pass, 206 Robot tests all pass, plan.py coverage 100%.

(Migrated from docs/implementation-notes.md)

## Implementation Notes — Stage A2b.beta: Plan Model Alignment **2026-02-13**: Stage A2b.beta Complete - Plan Model Alignment - Rewrote `plan.py` to align with spec: `processing_state` replaces `action_state`/`state`, `project_links` replaces `project_ids`, added `action_name`, `automation_profile`, `invariants`, actor fields, subplan hierarchy. - Rebased `feature/m1-plan-model` onto A2b.alpha commit. Resolved 30 merge conflicts. Key design decisions during merge: 1. Plan field name: `processing_state` (per spec), NOT `state`. 2. Invariant enum: `InvariantSource` (our naming), NOT `InvariantScope`. 3. Action model: HEAD taken as-is (authoritative for action domain). 4. No `action_id` on Action domain model — uses `namespaced_name` only. 5. `project_links` used everywhere (NOT `project_ids`). - Fixed 6 post-rebase test failures. - Final results: 130 Behave features / 2246 scenarios / 9868 steps all pass, 206 Robot tests all pass, `plan.py` coverage 100%. *(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.

Blocks Depends on
#49 feat(domain): align plan model with spec
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#233
No description provided.