Files
cleveragents-core/robot/cross_plan_correction.robot
T
freemo 4ca4874c4d
CI / lint (pull_request) Successful in 14s
CI / typecheck (pull_request) Successful in 34s
CI / quality (pull_request) Successful in 15s
CI / security (pull_request) Successful in 35s
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Successful in 16s
CI / integration_tests (pull_request) Successful in 2m54s
CI / unit_tests (pull_request) Successful in 4m9s
CI / coverage (pull_request) Successful in 4m48s
CI / docker (pull_request) Successful in 1m46s
CI / lint (push) Successful in 13s
CI / typecheck (push) Successful in 35s
CI / quality (push) Successful in 16s
CI / security (push) Successful in 31s
CI / build (push) Successful in 14s
CI / unit_tests (push) Successful in 2m11s
CI / integration_tests (push) Successful in 3m9s
CI / benchmark-regression (pull_request) Successful in 30m12s
CI / benchmark-regression (push) Has been skipped
CI / docker (push) Successful in 40s
CI / coverage (push) Successful in 4m25s
CI / benchmark-publish (push) Successful in 17m34s
feat(correction): implement cross-plan correction cascading with child plan state handling
Add CrossPlanCorrectionService that implements the four child-plan-state-
dependent behaviours from the specification when a correction's affected
subtree includes child plans:

- Not yet started → cancel the child plan
- In progress → cancel + rollback sandbox to pre-child-plan state
- Completed but not applied → cancel + rollback sandbox
- Already applied → reject the correction (CorrectionRejection)

Key additions:
- ChildPlanState enum classifying child plans into 4 states
- CorrectionRejection result type with reason and affected applied plan IDs
- CascadeAction/CascadeResult models for cascade operation tracking
- CorrectionStatus.REJECTED for rejected corrections
- Atomic cascade-or-rollback: all child plan actions succeed or the
  entire cascade is rolled back
- Protocol-based dependency injection (ChildPlanLookup, ChildPlanCanceller,
  SandboxRollbacker) for testability
- execute_correction_with_cascade() integrates with CorrectionService flow

Testing:
- 24 Behave BDD scenarios in cross_plan_correction.feature
- 8 Robot Framework end-to-end smoke tests
- ASV benchmarks for cascade performance with varying child plan counts

ISSUES CLOSED: #547
2026-03-04 21:20:47 +00:00

67 lines
3.5 KiB
Plaintext

*** Settings ***
Documentation End-to-end tests for cross-plan correction cascading:
... cancel, cancel+rollback, rejection, and atomic cascade.
Resource ${CURDIR}/common.resource
Suite Setup Setup Test Environment
Suite Teardown Cleanup Test Environment
*** Variables ***
${HELPER} robot/helper_cross_plan_correction.py
*** Test Cases ***
Cancel Not-Started Child Plan
[Documentation] Cascade cancels a not-yet-started child plan
[Tags] phase2 correction cross-plan cancel
${result}= Run Process ${PYTHON} ${HELPER} cancel-not-started cwd=${WORKSPACE}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} cancel-not-started-ok
Cancel And Rollback In-Progress Child Plan
[Documentation] Cascade cancels and rolls back an in-progress child plan
[Tags] phase2 correction cross-plan rollback
${result}= Run Process ${PYTHON} ${HELPER} cancel-rollback-in-progress cwd=${WORKSPACE}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} cancel-rollback-in-progress-ok
Cancel And Rollback Completed Unapplied Child Plan
[Documentation] Cascade cancels and rolls back a completed-unapplied child plan
[Tags] phase2 correction cross-plan rollback
${result}= Run Process ${PYTHON} ${HELPER} cancel-rollback-completed cwd=${WORKSPACE}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} cancel-rollback-completed-ok
Reject Applied Child Plan
[Documentation] Cascade rejects correction when child plan is already applied
[Tags] phase2 correction cross-plan rejection
${result}= Run Process ${PYTHON} ${HELPER} reject-applied cwd=${WORKSPACE}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} reject-applied-ok
Mixed States Rejection
[Documentation] Reject correction when any child plan is applied, even if others are cancellable
[Tags] phase2 correction cross-plan rejection mixed
${result}= Run Process ${PYTHON} ${HELPER} mixed-states-reject cwd=${WORKSPACE}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} mixed-states-reject-ok
Atomic Cascade Failure Rollback
[Documentation] Failure during cascade rolls back all completed actions
[Tags] phase2 correction cross-plan atomic
${result}= Run Process ${PYTHON} ${HELPER} atomic-failure cwd=${WORKSPACE}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} atomic-failure-ok
Execute Correction With Cascade No Children
[Documentation] Correction with cascade and no child plans succeeds normally
[Tags] phase2 correction cross-plan integration
${result}= Run Process ${PYTHON} ${HELPER} cascade-no-children cwd=${WORKSPACE}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} cascade-no-children-ok
Execute Correction With Cascade Rejection
[Documentation] Correction with cascade rejects when child plan is applied
[Tags] phase2 correction cross-plan integration rejection
${result}= Run Process ${PYTHON} ${HELPER} cascade-rejection cwd=${WORKSPACE}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} cascade-rejection-ok