Skip to main content

Module pr_review

Module pr_review 

Source
Expand description

Pure-function module for parsing structural PR review comments and evaluating whether a PR meets the auto-merge criteria.

This module intentionally has zero dependency on orchestrator runtime state and performs no I/O. It parses the output of the structural-pr-review Claude Code skill and applies a deterministic policy.

See cto-executive-system/plans/adf-rate-of-change-design.md §Step 1 (Gitea issue terraphim/adf-fleet#29).

§Expected review comment layout

The skill emits HTML <h3> section headings (not markdown ###) so that Gitea/GitHub render them consistently. The relevant anchors for this parser are:

  • <h3>Summary</h3> — summary paragraphs and optionally acceptance criteria checklist items (- [x] / - [ ]).
  • <h3>Confidence Score: N/5</h3> — integer N in 1..=5.
  • <h3>Inline Findings</h3> — finding blocks starting with **P0 , **P1 , or **P2 .
  • Footer <sub>Last reviewed commit: <short hash> | Reviews (N)</sub> — the | Reviews (N) suffix is optional for first-round reviews.

Structs§

AutoMergeCriteria
Thresholds that must be satisfied for a PR to be auto-merged.
PrMetadata
Minimum PR metadata required by evaluate.
ReviewVerdict
Parsed review verdict extracted from a single review comment body.

Enums§

AutoMergeDecision
Auto-merge decision produced by evaluate.
VerdictParseError
Errors raised when a review comment body does not conform to the structural-pr-review template.

Functions§

author_is_agent
Return true when login belongs to an automation account authorised to open auto-merge-eligible PRs.
evaluate
Evaluate whether a PR clears every auto-merge gate.
parse_verdict
Parse a review comment body emitted by the structural-pr-review skill.