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
This commit is contained in:
@@ -672,6 +672,21 @@ _ALL_DATA_COLUMNS + ") " "SELECT " + _ALL_DATA_COLUMNS + " FROM v3_plans"`.
|
||||
contains `{"properties": None}`. The test is tagged `@tdd_expected_fail` and will
|
||||
pass (by inversion) until the underlying bug is fixed.
|
||||
|
||||
- **Correction Data Model and Persistence** (#8685): Implemented the complete
|
||||
correction data model pipeline for decision tree editing, including: domain models
|
||||
(`CorrectionRequest`, `CorrectionImpact`, `CorrectionResult`, `CorrectionAttempt`,
|
||||
`CorrectionAttemptRecord`, `CascadeAction`, `CascadeResult`), persistence via
|
||||
SQLAlchemy repository with full CRUD operations (create, get, list_by_plan,
|
||||
update_state, delete), state transition validation (pending → executing →
|
||||
complete|failed), foreign key integrity enforcement, rollback tier depth computation,
|
||||
and automated `completed_at` timestamp population for terminal states. Includes an
|
||||
Alembic migration (`m8_001_correction_attempts`) to create the
|
||||
``correction_attempts`` table with check constraints on mode and state enums. Full
|
||||
BDD test coverage across correction flows, service coverage, subtree isolation,
|
||||
cross-plan cascading, checkpoint rollback wiring, attempt persistence, and model
|
||||
validation scenarios. Also added ``CORRECTION_APPLIED`` domain event type to the
|
||||
event bus for audit trailing of applied corrections.
|
||||
|
||||
- **Architecture Pool Supervisor Milestone Assignment** (#7521): Added a "PR Workflow
|
||||
for Major Changes" section to the `architecture-pool-supervisor` agent definition
|
||||
documenting the milestone assignment step for spec PRs. The agent now has
|
||||
|
||||
+2
-3
@@ -61,7 +61,7 @@ Below are some of the specific details of various contributions.
|
||||
* HAL 9000 has contributed the pr-review-pool-supervisor tracking prefix documentation fix (#7891): aligned all documentation references from the outdated `AUTO-REV-POOL` prefix to the correct `AUTO-REV-SUP` prefix used in production.
|
||||
* HAL 9000 has contributed the LSP transport header injection security fix (PR #10608): added strict ASCII validation to the ``_read_one_message()`` header parser to enforce US-ASCII-only headers per LSP specification, preventing malicious servers from injecting arbitrary Content-Length values that could cause the transport to read and parse unauthorized data as JSON-RPC messages.
|
||||
* HAL 9000 has contributed the file edit encoding parameter fix (PR #8258 / issue #7559).
|
||||
* HAL 9000 has contributed the architecture-pool-supervisor milestone assignment feature (PR #8188 / issue #7521): added `forgejo_update_pull_request` permission and documented the PR workflow for major spec changes, enabling automatic milestone assignment for specification PRs.
|
||||
<<* HAL 9000 has contributed the architecture-pool-supervisor milestone assignment feature (PR #8188 / issue #7521): added `forgejo_update_pull_request` permission and documented the PR workflow for major spec changes, enabling automatic milestone assignment for specification PRs.
|
||||
* HAL 9000 has contributed the git worktree TOCTOU race condition fix (PR #8178 / issue #7507): replaced the unsafe mkdtemp() + rmdir() pattern with a parent-directory approach to eliminate the race window in concurrent git worktree operations.
|
||||
* HAL 9000 has contributed CLI documentation for version, info, and diagnostics commands (PR #4211 / issue #7592): created a beginner-friendly showcase walkthrough covering fast-path eager flags, rich format output with Rich panels, machine-readable JSON envelope structure, and CI-friendly diagnostics health checks.
|
||||
|
||||
@@ -69,8 +69,6 @@ Below are some of the specific details of various contributions.
|
||||
* HAL 9000 has contributed the git_tools TOCTOU race condition fix (PR #8255 / issue #7619): eliminated the Time-Of-Check-To-Time-Of-Use race in `_get_base_env()` by adding double-checked locking with a module-level `threading.Lock`, preventing concurrent threads from writing conflicting environment snapshots.
|
||||
* HAL 9000 has contributed the ActorLoader.list_actors TOCTOU race condition fix (PR #8660 / issue #8588): moved the namespace filter inside the ``with self._lock:`` block in ``list_actors()`` so that dictionary reads and filtering are atomic, eliminating stale results and potential ``RuntimeError`` under concurrent access. Added concurrency BDD coverage via Behave test scenarios using ``threading.Barrier``.
|
||||
* HAL 9000 has contributed the mandatory PR compliance checklist to `implementation-supervisor.md` (#9824): added an 8-item checklist to the worker prompt body with concrete items covering CHANGELOG.md, CONTRIBUTORS.md, commit footer, CI verification, BDD tests, Epic reference, labels, and milestone assignment to eliminate systemic PR merge blockers.
|
||||
* HAL 9000 has contributed the PlanResult.success derivation fix (PR #8214 / issue #7501): replaced the incorrect `error_message is None` heuristic with a dedicated `result_success` column in the plans table, ensuring plans with historical build errors are not incorrectly marked as failed after a successful apply.
|
||||
* HAL 9000 has contributed the mandatory PR compliance checklist to `implementation-pool-supervisor.md` (#9824): created a new agent definition with an embedded 8-item checklist ensuring workers always update CHANGELOG.md, CONTRIBUTORS.md, include commit footers (`ISSUES CLOSED: #N`), verify CI passes, add BDD tests, reference the parent Epic, apply labels via forgejo-label-manager, and assign milestones before creating PRs. Includes concrete examples for each subsection and compliance verification pseudocode.
|
||||
* HAL 9000 has contributed comprehensive milestone documentation for v3.6.0 (Advanced Concepts & Deferred Features) and v3.7.0 (TUI Implementation) (PR #9903): split into sub-documents covering context strategies, LLM backends, resource types, A2A rename, container tool execution, scope chain resolution, cost/safety budgets, E2E workflow tests, code review examples, plugin architecture, TUI layout, persona system, reference/command input, session management, configuration, and TuiMaterializer integration.
|
||||
* HAL 9000 has contributed the concurrent ValidationPipeline stdout/stderr restoration fix (PR #7811 / issue #7623): introduced a reference-counted shared stream wrapper manager so concurrent ValidationPipeline.run() calls correctly restore the true sys.stdout/sys.stderr after all pipelines finish, preventing permanent stream wrapping under concurrent execution.
|
||||
* HAL 9000 has contributed the LLMTraceRepository data-integrity fix (PR #8185 / issue #7505): replaced the unconditional `session.commit()` in `LLMTraceRepository.save()` with a dual-path implementation that respects the UnitOfWork pattern — flushing only when an external session is provided, and flushing + committing + closing when operating standalone. This eliminates premature transaction commits, loss of rollback capability, and a docstring/implementation mismatch.
|
||||
@@ -139,3 +137,4 @@ Below are some specific details of individual PR contributions.
|
||||
* HAL 9000 has contributed the plan tree JSON/YAML spec-compliant envelope fix (issue #11041): wrapped `agents plan tree` JSON and YAML output in the spec-required command envelope (`command`, `status`, `exit_code`, `data`, `timing`, `messages`), updated BDD step definitions to validate envelope structure, and removed the `@tdd_expected_fail` tag from the previously-failing JSON tree format test (issue #4254).
|
||||
* HAL 9000 has contributed the a2a session_id validation fix (PR #11098 / issue #9250): moved the session_id validation guard to the top of `_handle_session_close()` in `A2aLocalFacade`, closing the validation bypass path where empty or null session IDs could slip through to devcontainer cleanup when `SessionService` was not wired.
|
||||
* HAL 9000 has contributed ACMS budget enforcement for per-file and cumulative size constraints (PR #9673 / issue #9583): implemented ``BudgetEnforcer``, ``BudgetViolation``, and ``ContextFile`` dataclasses in ``src/cleveragents/acms/budget_enforcement.py`` with full type annotations, ruff linting compliance, 11 BDD Behave scenarios, Robot Framework integration tests, and per-file exclusion + cumulative budget cutoff strategies for max_file_size and max_total_size limits.
|
||||
* HAL 9000 has contributed the Correction Data Model and Persistence (PR #8685 / issue #8685): complete correction data model pipeline for decision tree editing including `CorrectionRequest`, `CorrectionImpact`, `CorrectionResult`, `CorrectionAttempt`, `CorrectionAttemptRecord`, `CascadeAction`, and `CascadeResult` domain models, SQLAlchemy repository with full CRUD operations (create, get, list_by_plan, update_state, delete), state transition validation, foreign key integrity enforcement, rollback tier depth computation, automated completed_at timestamp population, Alembic migration m8_001_correction_attempts for the correction_attempts table, and comprehensive BDD test coverage across correction flows, service coverage, subtree isolation, cross-plan cascading, checkpoint rollback wiring, attempt persistence, and model validation scenarios.
|
||||
|
||||
Reference in New Issue
Block a user