Skip to main content

Module pr_gate

Module pr_gate 

Source
Expand description

Pure-function module for reconciling PR gate state against branch protection requirements.

This module has zero dependency on orchestrator runtime state and performs no I/O. It reads a PrGateSnapshot capturing the current state of a PR head and produces a deterministic PrGateDecision indicating what action the reconciler should take.

See .docs/design-adf-pr-merge-progress-2026-05-01.md for the full design.

Structs§

CommitStatusSummary
One commit status entry posted against a SHA.
PrGateSnapshot
Snapshot of everything the reconciler needs to classify a PR head.

Enums§

CommitStatusState
Terminal state of a single commit status context.
PrGateDecision
Deterministic classification of a PR head’s gate state.

Constants§

STALE_PENDING_TIMEOUT_SECS
Default stale pending timeout in seconds (60 minutes).

Functions§

failed_required_contexts
Compute which required contexts have reached a failed/error terminal state. Returns (context_name, state_label) pairs.
missing_required_contexts
Compute which required contexts have no status posted at all on the head SHA.
pending_required_contexts
Compute which required contexts are posted but still pending.
reconcile_pr_gate
Reconcile the PR gate state from a snapshot. Pure function.
remediation_key
Deterministic dedup key for remediation issues.
stale_pending_contexts
Compute which required contexts have been pending longer than the timeout. Uses created_at_unix from the status entry and now_unix from the snapshot.