feat(db): rebaseline plan phase/state enums for Action and Apply terminal states #243

Closed
opened 2026-02-22 23:40:29 +00:00 by freemo · 0 comments
Owner

Metadata

  • Commit: feat(db): rebaseline plan phase/state enums for Action and Apply terminal states
  • Branch: feature/m1-db-plan-phase-rebaseline

Subtasks

  • Add Alembic migration that updates v3_plans phase/state constraints to include action phase and Apply terminal outcomes (applied, constrained, errored, cancelled), and removes applied as a phase.
  • Rebuild v3_plans table safely for SQLite (create temp table → copy → drop → rename) to update CHECK constraints and defaults without data loss.
  • Update ORM LifecyclePlanModel to accept Action phase + Apply terminal states; ensure serialization/deserialization maps updated enums.
  • Mark automation_level column as legacy (no new writes); keep nullable for backward compatibility until removal in A6.legacy cleanup.
  • Update docs/reference/database_schema.md with the new phase/state constraints and legacy automation_level note.
  • Tests (Behave): Add migration scenarios asserting phase/state constraints accept Action + Apply terminal values and reject legacy applied phase.
  • Tests (Robot): Add Robot migration smoke test that inserts a plan row with phase=action and processing_state=queued.
  • Tests (ASV): Add benchmarks/plan_phase_migration_bench.py for migration runtime baseline.
  • Run nox (all default sessions, including benchmark), fix any errors if needed ensuring nox passes.
  • 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%.

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

## Metadata - **Commit**: `feat(db): rebaseline plan phase/state enums for Action and Apply terminal states` - **Branch**: `feature/m1-db-plan-phase-rebaseline` ## Subtasks - [x] Add Alembic migration that updates `v3_plans` phase/state constraints to include `action` phase and Apply terminal outcomes (`applied`, `constrained`, `errored`, `cancelled`), and removes `applied` as a phase. - [x] Rebuild `v3_plans` table safely for SQLite (create temp table → copy → drop → rename) to update CHECK constraints and defaults without data loss. - [x] Update ORM `LifecyclePlanModel` to accept Action phase + Apply terminal states; ensure serialization/deserialization maps updated enums. - [x] Mark `automation_level` column as legacy (no new writes); keep nullable for backward compatibility until removal in A6.legacy cleanup. - [x] Update `docs/reference/database_schema.md` with the new phase/state constraints and legacy automation_level note. - [x] Tests (Behave): Add migration scenarios asserting phase/state constraints accept Action + Apply terminal values and reject legacy `applied` phase. - [x] Tests (Robot): Add Robot migration smoke test that inserts a plan row with `phase=action` and `processing_state=queued`. - [x] Tests (ASV): Add `benchmarks/plan_phase_migration_bench.py` for migration runtime baseline. - [x] Run `nox` (all default sessions, including benchmark), fix any errors if needed ensuring nox passes. - [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%. **Section**: #### Section 3 Notes **Status**: Completed
freemo added this to the v3.0.0 milestone 2026-02-22 23:40:29 +00:00
freemo self-assigned this 2026-02-22 23:40:29 +00:00
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
#67 feature/m1-uow-lifecycle
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#243
No description provided.