feat(correcting-plans): implement Predictive Error Prevention (Layer 4) with Error Pattern Database
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 14s
CI / build (pull_request) Successful in 16s
CI / quality (pull_request) Successful in 17s
CI / security (pull_request) Successful in 36s
CI / typecheck (pull_request) Successful in 54s
CI / unit_tests (pull_request) Successful in 2m39s
CI / integration_tests (pull_request) Successful in 3m10s
CI / docker (pull_request) Successful in 40s
CI / coverage (pull_request) Successful in 5m0s
CI / lint (push) Successful in 14s
CI / build (push) Successful in 15s
CI / quality (push) Successful in 16s
CI / security (push) Successful in 34s
CI / typecheck (push) Successful in 35s
CI / benchmark-regression (push) Has been skipped
CI / unit_tests (push) Successful in 2m23s
CI / docker (push) Successful in 38s
CI / integration_tests (push) Successful in 3m8s
CI / coverage (push) Successful in 5m10s
CI / benchmark-publish (push) Successful in 16m26s
CI / benchmark-regression (pull_request) Successful in 30m12s

Implement spec-mandated Layer 4 Predictive Error Prevention system:

- ErrorPattern domain model with pattern text, historical failures,
  preventive checks, frequency tracking, and keyword-based matching.
- ErrorPatternRepository with in-memory CRUD + context-matching query.
- ErrorPatternService with record_failure(), match_patterns(), and
  get_statistics() methods.
- Wire into plan execution via plan_lifecycle_service pre-execution hook.
- Add error pattern statistics to CLI diagnostics output.

Behave BDD: 11 scenarios covering recording, matching, formatting, stats.
Robot Framework: 3 integration smoke tests.
ASV benchmarks: pattern matching performance.

ISSUES CLOSED: #571
This commit was merged in pull request #643.
This commit is contained in:
2026-03-08 20:26:19 +00:00
parent 61fc70d84b
commit 583e6b7ea2
30 changed files with 1292 additions and 66 deletions
+11 -10
View File
@@ -14,6 +14,7 @@ from __future__ import annotations
import importlib
import sys
from pathlib import Path
from typing import ClassVar
_SRC = str(Path(__file__).resolve().parents[1] / "src")
if _SRC not in sys.path:
@@ -71,8 +72,8 @@ def _make_fragments(
class RelevanceCoherenceOrdererSuite:
"""Benchmark RelevanceCoherenceOrderer throughput."""
params: list[int] = [10, 100, 500]
param_names: list[str] = ["num_fragments"]
params: ClassVar[list[int]] = [10, 100, 500]
param_names: ClassVar[list[str]] = ["num_fragments"]
def setup(self, n: int) -> None:
self.orderer = RelevanceCoherenceOrderer()
@@ -85,8 +86,8 @@ class RelevanceCoherenceOrdererSuite:
class ProvenancePreambleGeneratorSuite:
"""Benchmark ProvenancePreambleGenerator throughput."""
params: list[int] = [10, 100, 500]
param_names: list[str] = ["num_fragments"]
params: ClassVar[list[int]] = [10, 100, 500]
param_names: ClassVar[list[str]] = ["num_fragments"]
def setup(self, n: int) -> None:
self.generator = ProvenancePreambleGenerator()
@@ -99,8 +100,8 @@ class ProvenancePreambleGeneratorSuite:
class ArceStrategySuite:
"""Benchmark ArceStrategy throughput."""
params: list[int] = [10, 100, 500]
param_names: list[str] = ["num_fragments"]
params: ClassVar[list[int]] = [10, 100, 500]
param_names: ClassVar[list[str]] = ["num_fragments"]
def setup(self, n: int) -> None:
self.strategy = ArceStrategy(max_iterations=3)
@@ -114,8 +115,8 @@ class ArceStrategySuite:
class TemporalArchaeologyStrategySuite:
"""Benchmark TemporalArchaeologyStrategy throughput."""
params: list[int] = [10, 100, 500]
param_names: list[str] = ["num_fragments"]
params: ClassVar[list[int]] = [10, 100, 500]
param_names: ClassVar[list[str]] = ["num_fragments"]
def setup(self, n: int) -> None:
self.strategy = TemporalArchaeologyStrategy()
@@ -129,8 +130,8 @@ class TemporalArchaeologyStrategySuite:
class PlanDecisionContextStrategySuite:
"""Benchmark PlanDecisionContextStrategy throughput."""
params: list[int] = [10, 100, 500]
param_names: list[str] = ["num_fragments"]
params: ClassVar[list[int]] = [10, 100, 500]
param_names: ClassVar[list[str]] = ["num_fragments"]
def setup(self, n: int) -> None:
self.strategy = PlanDecisionContextStrategy()