feat(plan-correction): implement correction data model and persistence #8685

Open
HAL9000 wants to merge 4 commits from feat/plan-correction-8531 into master

4 Commits

Author SHA1 Message Date
HAL9000 c35e6d93bc fix(contributors): restore two deleted contribution records from master
CI / load-versions (pull_request) Successful in 7s
CI / push-validation (pull_request) Successful in 9s
CI / lint (pull_request) Successful in 17s
CI / helm (pull_request) Successful in 16s
CI / quality (pull_request) Successful in 21s
CI / typecheck (pull_request) Successful in 1m0s
CI / security (pull_request) Successful in 1m14s
CI / build (pull_request) Successful in 3m18s
CI / integration_tests (pull_request) Successful in 9m38s
CI / unit_tests (pull_request) Successful in 12m14s
CI / docker (pull_request) Successful in 1m10s
CI / coverage (pull_request) Successful in 7m41s
CI / status-check (pull_request) Successful in 1s
Restores two entries that were incorrectly removed from CONTRIBUTORS.md:
- PlanResult.success derivation fix (PR #8214 / issue #7501)
- mandatory PR compliance checklist for implementation-pool-supervisor.md (#9824)

Both entries exist in origin/master and were confirmed absent from the
worktree (shown as removals in the PR diff). They are reinserted between
the implementation-supervisor.md #9824 entry and the PR #9903
milestone-docs entry, restoring the correct ordering.

ISSUES CLOSED: #8685
2026-06-19 03:11:05 -04:00
HAL9000 13f8738c54 fix(contributors): remove truncated conflict marker from line 64
CI / load-versions (pull_request) Successful in 19s
CI / push-validation (pull_request) Successful in 26s
CI / helm (pull_request) Successful in 40s
CI / build (pull_request) Successful in 52s
CI / lint (pull_request) Successful in 58s
CI / security (pull_request) Successful in 1m6s
CI / typecheck (pull_request) Successful in 1m7s
CI / quality (pull_request) Successful in 3m50s
CI / unit_tests (pull_request) Successful in 4m58s
CI / docker (pull_request) Successful in 2m14s
CI / integration_tests (pull_request) Successful in 8m41s
CI / coverage (pull_request) Successful in 9m52s
CI / status-check (pull_request) Successful in 1s
Remove leading `<<` characters from CONTRIBUTORS.md line 64 that were
a leftover artifact of an unresolved git merge conflict marker.

ISSUES CLOSED: #8685
2026-06-19 02:47:00 -04:00
controller-ci-rerun 7dc416cbf5 chore: re-trigger CI [controller] 2026-06-19 02:47:00 -04:00
HAL9000 964cd8c2d4 feat(plan-correction): implement correction data model and persistence
The correction data model and persistence feature provides a complete pipeline for
decision tree editing with revert and append correction modes. Implemented components:

- Domain models: CorrectionRequest, CorrectionImpact, CorrectionResult, CorrectionAttempt,
  CorrectionAttemptRecord, CascadeAction, CascadeResult with full Pydantic validation.
- Persistence layer: SQLAlchemy repository with CRUD operations (create, get, list_by_plan,
  update_state, delete), domain model conversion helpers (to_domain/from_domain), and session
  factory pattern consistent with other repositories in the codebase.
- State machine: CorrectionAttemptState enum (pending → executing → complete|failed) with
  validated transitions via validate_correction_state_transition().
- Migration: Alembic migration m8_001_correction_attempts creating correction_attempts table
  with check constraints on mode and state enums, indexed on plan_id.
- Event emission: CORRECTION_APPLIED domain event type added to EventType enum and emitted
  through the EventBus when corrections are successfully applied.
- BDD tests: Comprehensive Behave scenario coverage across correction flows, service coverage,
  subtree isolation, cross-plan cascading, checkpoint rollback wiring, attempt persistence, and
  model validation scenarios.

This feature enables full decision correction workflows including subgraph impact analysis via
BFS traversal, rollback tier depth computation, artifact archival, checkpoint restoration for
revert corrections, and child plan spawning for append corrections.
ISSUES CLOSED: #8685
2026-06-19 02:47:00 -04:00