On this page
EnforcementMixin: cost accumulation and budget events, pre/post-check execution, and mechanical constraints — tests pass, lint clean, no new deps, no removed exports, no changed signatures.
#scheduler.src.orxtra.scheduler._enforcement
#scheduler.src.orxtra.scheduler._enforcement
#EnforcementMixin
Mixin for budget enforcement, constraints, checks, and validation.
#_send_budget_events
async def _send_budget_events(self, task_id: UUID) -> NoneSend accumulated budget events to the Overseer.
#_run_mechanical_constraints
async def _run_mechanical_constraints(self, task_id: UUID) -> list[CheckResult]Run active mechanical constraints.
Cheap constraints run after every task. Expensive constraints (tests_pass, lint_clean) run only when the completing task has subtasks (workflow completion).
#_check_constraint
async def _check_constraint(self, kind: ConstraintKind, task_id: UUID, constraint_text: str='') -> CheckResultCheck a single mechanical constraint.
Dispatches to individual checker methods based on the constraint kind.
#_check_tests_pass
async def _check_tests_pass(self) -> CheckResultRun pytest and check exit code.
#_check_lint_clean
async def _check_lint_clean(self) -> CheckResultRun ruff check and check exit code.
#_check_no_new_dependencies
async def _check_no_new_dependencies(self) -> CheckResultCheck if dependency files changed.
#_check_no_new_files_outside
async def _check_no_new_files_outside(self, constraint_text: str) -> CheckResultCheck for new files outside a directory.
The directory is extracted from the constraint text, e.g. "no_new_files_outside(src/)".
#_snapshot_exports
def _snapshot_exports(self, glob_pattern: str) -> dict[str, set[str]]Extract top-level names from files matching glob.
#_snapshot_signatures
def _snapshot_signatures(self, glob_pattern: str) -> dict[str, dict[str, list[str]]]Extract function signatures from files matching glob.
#_capture_pre_task_snapshots
def _capture_pre_task_snapshots(self, task_id: UUID) -> NoneCapture export and signature snapshots before task execution.
Scans all active mechanical constraints that need snapshots and stores the data keyed by task_id.
#_check_no_removed_exports
def _check_no_removed_exports(self, task_id: UUID, constraint_text: str) -> CheckResultCheck that no exports were removed.
#_check_no_changed_signatures
def _check_no_changed_signatures(self, task_id: UUID, constraint_text: str) -> CheckResultCheck that no function signatures changed.
#_validate_output_schema
def _validate_output_schema(self, output: str | None, schema_str: str) -> CheckResultValidate agent output against a JSON schema.
#_analyze_structural_advisories
def _analyze_structural_advisories(self, task_ids: list[UUID]) -> list[dict[str, Any]]Analyze a set of tasks for structural improvements.
Detects read-only tasks that could be front-loaded for earlier execution. Advisories are stored for the Overseer to consume.