File size: 3,107 Bytes
93b4026
0cc127a
93b4026
 
 
 
 
 
 
 
 
0cc127a
 
 
93b4026
 
 
0cc127a
 
 
 
 
 
93b4026
0cc127a
 
 
 
 
 
 
93b4026
0cc127a
 
 
 
 
 
 
93b4026
0cc127a
 
 
 
 
 
 
b8f6023
 
 
 
 
 
 
 
93b4026
0cc127a
 
93b4026
0cc127a
 
 
93b4026
0cc127a
 
 
fbca07e
0cc127a
 
 
93b4026
0cc127a
 
 
 
 
 
 
93b4026
0cc127a
 
 
 
 
 
 
93b4026
 
 
 
 
 
 
 
 
 
0cc127a
 
 
 
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
from typing import Annotated

from pydantic import BaseModel, ConfigDict, Field, StringConstraints, model_validator

NonBlankStr = Annotated[
    str,
    StringConstraints(
        strip_whitespace=True,
        min_length=1,
    ),
]


class CoderSummary(BaseModel):
    model_config = ConfigDict(extra="forbid")

    implementation_summary: NonBlankStr = Field(
        description=(
            "Brief factual summary of the production implementation completed "
            "by the Coder. Do not include unverified test or quality claims."
        )
    )

    completed_task_ids: list[NonBlankStr] = Field(
        default_factory=list,
        description=(
            "Identifiers of Coder-owned plan tasks that were implemented. "
            "Include only tasks supported by completed file operations."
        ),
    )

    modified_files: list[NonBlankStr] = Field(
        default_factory=list,
        description=(
            "Project-relative paths of production files created or modified "
            "by the Coder. Do not include test files."
        ),
    )

    runtime_dependencies: list[NonBlankStr] = Field(
        default_factory=list,
        description=(
            "Production runtime dependencies added to the project. "
            "Do not include testing, linting, coverage, or type-checking tools."
        ),
    )

    development_dependencies: list[NonBlankStr] = Field(
        default_factory=list,
        description=(
            "Development dependencies added or changed by the Coder. "
            "Do not include runtime dependencies or Tester-owned dependencies."
        ),
    )

    entry_points: list[NonBlankStr] = Field(
        default_factory=list,
        description=(
            "Command-line entry-point names configured under [project.scripts]."
        ),
    )

    executed_operations: list[NonBlankStr] = Field(
        default_factory=list,
        description=(
            "Operations actually executed by Coder tools and their observed "
            "outcomes, such as successful uv sync or application launch."
        ),
    )

    unresolved_issues: list[NonBlankStr] = Field(
        default_factory=list,
        description=(
            "Known implementation problems, blockers, uncertainties, or "
            "failed operations that remain unresolved."
        ),
    )

    tester_notes: list[NonBlankStr] = Field(
        default_factory=list,
        description=(
            "Concise handoff notes identifying behaviour or acceptance "
            "criteria the Tester should verify. Do not claim they already pass."
        ),
    )

    @model_validator(mode="after")  # TODO: Send error to the LLM later.
    def validate_completion_evidence(self) -> "CoderSummary":
        if not self.completed_task_ids and not self.unresolved_issues:
            raise ValueError(
                "The Coder summary must report at least one completed task "
                "or at least one unresolved issue."
            )

        return self


class CoderCycle(BaseModel):
    cycle_number: int
    coder_summary: CoderSummary