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).
25 lines
1.1 KiB
Python
25 lines
1.1 KiB
Python
"""Controller package — DB-owned PR state machine.
|
|
|
|
See ``.drew/controller_state_machine.md`` for the full plan. This
|
|
package is the Phase 0+ implementation of that plan; it is being
|
|
built incrementally on the ``controller-state-machine`` branch.
|
|
|
|
The package layout mirrors the plan's responsibilities:
|
|
|
|
- ``contracts/`` — Pydantic V1 contracts for worker I/O. Strict-parse
|
|
helpers. The single source of truth for "what shape does a
|
|
reviewer / implementer / estimator / conflict-resolver / summarizer
|
|
produce."
|
|
- ``ci_summary_parsers/`` — deterministic per-CI-tool parsers that
|
|
consume raw Forgejo CI logs and produce ``CIFailure`` rows. Called
|
|
from the master's prefetch path.
|
|
- (later) ``master.py`` — singleton process: state-machine driver,
|
|
discovery, prefetch, reconciliation, Forgejo writes, merge.
|
|
- (later) ``worker.py`` — scalable process: dequeue, lock+heartbeat,
|
|
OpenCode invocation, output write.
|
|
- (later) ``state_machine.py`` — ``TRANSITIONS`` dict + property tests.
|
|
- (later) ``mcp/`` — per-role response-builder MCP servers.
|
|
"""
|
|
|
|
__all__ = ["contracts"]
|