orchestrata_ultimate.gates

Reference › orchestrata_ultimate › gates

The Prolog gate layer — facts from the AST snapshot, policy as rules.

The gates package is the Python half of Orchestrata's Prolog gate layer. The idea is a strict split: Python extracts facts from the repository, and every policy decision is a Prolog rule, so a rule can be explained, tested and extended without touching Python. The rules themselves live in the prolog/ directory; the policy and the individual gates are described in the gate pages, starting with prolog-gate and the suite-preflight family.

The modules, in order of data flow. fact_extractor builds the ground fact base from the AST snapshot, plus freshness hashes. engine consults the rulebases over those facts and returns a verdict of pass, fail or invalid, with exit codes 0, 1 and 2. commit_review applies the same three-valued verdict to the pre-commit review: it runs the required reviewers on staged files and lets the rules decide. differential compares the Prolog findings with those of the legacy checkers it replaced and classifies every difference.

The entry point is the scripts.gate command line, with the review-staged subcommand called from the pre-commit hook. The package __init__ re-exports from the fact extractor. Start with the engine's module docstring ideas, then the fact extractor.

5 modules, 2,686 lines of code.

Modules

Module Summary LOC
__init__ The Prolog gate layer — facts from the AST snapshot, policy as rules. 20
commit_review Pre-commit review verdict — the reviewers report, Prolog decides. 530
differential Differential between the Prolog gate and the checkers it replaces (P5). 328
engine GateEngine — precondition, then rules, then a verdict that can say INVALID. 637
fact_extractor Emit the Prolog gate fact base FROM the AST snapshot. 1171

Dependency diagram

Package dependency diagram orchestrata_ultimate.gates