File size: 1,257 Bytes
4fb906a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
"""Patch validation document — results of validating a patch in isolation."""

from beanie import PydanticObjectId
from pydantic import Field

from app.models.base import BaseDocument


class PatchValidation(BaseDocument):
    """Validation result for a candidate patch.



    The Patch Validation Agent applies the patch in an isolated Docker

    sandbox, compiles, runs the failing test, runs regression, and

    checks coverage. All criteria must pass for acceptance.

    """

    patch_id: PydanticObjectId
    sandbox_id: str = Field(default="", description="Docker container used for validation")

    # Validation criteria
    compilation_success: bool = False
    failing_test_passes: bool = False
    regression_passes: bool = False
    coverage_maintained: bool = False

    # Results
    verdict: str = Field(default="pending", description="'accepted', 'rejected', or 'pending'")
    reason: str = ""
    regression_failures: list[str] = Field(default_factory=list)
    coverage_before: float = 0.0
    coverage_after: float = 0.0
    duration_ms: float = 0.0

    class Settings:
        name = "patch_validations"
        use_state_management = True
        indexes = [
            "patch_id",
        ]