Files
cleveragents-core/robot/predictive_error_prevention.robot
freemo 583e6b7ea2
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
feat(correcting-plans): implement Predictive Error Prevention (Layer 4) with Error Pattern Database
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
2026-03-08 21:53:21 -04:00

49 lines
2.3 KiB
Plaintext

*** Settings ***
Documentation Layer 4 - Predictive Error Prevention integration smoke tests
Library OperatingSystem
Library Process
*** Variables ***
${ERROR_PATTERN_MODEL} ${CURDIR}/../src/cleveragents/domain/models/core/error_pattern.py
${ERROR_PATTERN_REPO} ${CURDIR}/../src/cleveragents/infrastructure/database/error_pattern_repository.py
${ERROR_PATTERN_SERVICE} ${CURDIR}/../src/cleveragents/application/services/error_pattern_service.py
*** Test Cases ***
Error Pattern Domain Model Exists
[Documentation] Verify the error pattern domain model module is present
File Should Exist ${ERROR_PATTERN_MODEL}
${content}= Get File ${ERROR_PATTERN_MODEL}
Should Contain ${content} class ErrorPattern
Should Contain ${content} class PreventiveGuidance
Should Contain ${content} pattern_id
Should Contain ${content} historical_failures
Should Contain ${content} preventive_checks
Should Contain ${content} frequency
Should Contain ${content} keywords
Should Contain ${content} format_for_context
Error Pattern Repository Module Exists
[Documentation] Verify the error pattern repository module is present
File Should Exist ${ERROR_PATTERN_REPO}
${content}= Get File ${ERROR_PATTERN_REPO}
Should Contain ${content} class ErrorPatternRepository
Should Contain ${content} def create(
Should Contain ${content} def get(
Should Contain ${content} def list_all(
Should Contain ${content} def update(
Should Contain ${content} def delete(
Should Contain ${content} def match_context(
Should Contain ${content} def count(
Should Contain ${content} def statistics(
Error Pattern Service Provides Recording Matching And Statistics
[Documentation] Verify the error pattern service has all required methods
File Should Exist ${ERROR_PATTERN_SERVICE}
${content}= Get File ${ERROR_PATTERN_SERVICE}
Should Contain ${content} class ErrorPatternService
Should Contain ${content} def record_failure(
Should Contain ${content} def match_patterns(
Should Contain ${content} def get_statistics(
Should Contain ${content} def list_patterns(
Should Contain ${content} _extract_keywords