a10758177c
Lays the foundation for the planned controller + DB-owned PR state machine rewrite (see .drew/controller_state_machine.md). Phase 0a — Pydantic V1 worker I/O contracts (tools/controller/contracts/): - v1.py: ImplementerInputV1/OutputV1, ReviewerInputV1/OutputV1, EstimatorOutputV1, IssueImplementerOutputV1, ConflictResolverInputV1/OutputV1, SummarizerInputV1/OutputV1. Plus CISummary / CIFailure / GateResult / FailedAssertion / FileLocation. All models use extra="forbid" + required output_version Literal discriminator (no defaults). - parse.py: strict_parse() + strict_parse_with_retry() helpers. Corrective prompt template quotes the Pydantic ValidationError + the JSON schema. TTL guard skips retry when remaining time too short. Defense-in-depth around the response-builder MCPs that arrive in Phase 1a. Phase 0b — Static CI parser-coverage discovery: - NOX_SESSION_TO_PARSER map in tools/controller/ci_summary_parsers/. Derived from .forgejo/workflows/*.yml + noxfile.py. Covers ruff, pyright, behave, robot_framework, slipcover, vulture, radon, bandit, semgrep, build. Cron-only sessions (benchmark, benchmark_regression) are in NOX_SESSIONS_SKIP_COVERAGE. - scripts/enumerate-ci-gates.py: reads the workflow YAML, joins against the map, exits non-zero on coverage gaps. Wired into tests so the actual .forgejo/ is regression-guarded. 63 new tests; full auto_agents suite still passes (2424).
75 lines
1.9 KiB
Python
75 lines
1.9 KiB
Python
"""V1 worker I/O contracts.
|
|
|
|
Strict-parse: every worker output (implementer / reviewer / estimator
|
|
/ conflict-resolver / summarizer) must conform to its ``*OutputV1``
|
|
schema. See :mod:`tools.controller.contracts.parse` for the
|
|
strict-parse + retry-once helper.
|
|
|
|
Why "V1": the ``output_version`` field is a required Literal["V1"]
|
|
discriminator. Future schema bumps land as ``V2`` models alongside
|
|
V1; workers declare which version they emit; controller routes
|
|
parsing by declared version.
|
|
|
|
Why no ``extra_context: dict[str, Any]``: that field would become
|
|
the unstable surface every worker depends on. Add fields to V2
|
|
explicitly when needed.
|
|
"""
|
|
|
|
from .v1 import (
|
|
CIFailure,
|
|
CIFailureFinding,
|
|
CISummary,
|
|
ConflictResolverInputV1,
|
|
ConflictResolverOutputV1,
|
|
EstimatorOutputV1,
|
|
FailedAssertion,
|
|
FileLocation,
|
|
GateResult,
|
|
ImplementerInputV1,
|
|
ImplementerOutputV1,
|
|
IssueImplementerOutputV1,
|
|
PriorAttemptsBlock,
|
|
Review,
|
|
ReviewerInputV1,
|
|
ReviewerOutputV1,
|
|
SummarizerInputV1,
|
|
SummarizerOutputV1,
|
|
)
|
|
from .parse import (
|
|
ContractValidationError,
|
|
strict_parse,
|
|
strict_parse_with_retry,
|
|
)
|
|
|
|
__all__ = [
|
|
# CI summary types
|
|
"CIFailure",
|
|
"CIFailureFinding",
|
|
"CISummary",
|
|
"FailedAssertion",
|
|
"FileLocation",
|
|
"GateResult",
|
|
# Worker I/O — implementer
|
|
"ImplementerInputV1",
|
|
"ImplementerOutputV1",
|
|
"IssueImplementerOutputV1",
|
|
# Worker I/O — reviewer
|
|
"ReviewerInputV1",
|
|
"ReviewerOutputV1",
|
|
"Review",
|
|
# Worker I/O — estimator
|
|
"EstimatorOutputV1",
|
|
# Worker I/O — conflict resolver
|
|
"ConflictResolverInputV1",
|
|
"ConflictResolverOutputV1",
|
|
# Worker I/O — summarizer
|
|
"SummarizerInputV1",
|
|
"SummarizerOutputV1",
|
|
# Shared
|
|
"PriorAttemptsBlock",
|
|
# Parse helpers
|
|
"ContractValidationError",
|
|
"strict_parse",
|
|
"strict_parse_with_retry",
|
|
]
|