Enforce bounded operation guardrails
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 1s
Build and Publish Container Image / build-and-push (push) Successful in 21s

Assistant: codex
Assistant-Model: gpt-5.6-sol
Assistant-Session: 01a028de-e2c8-7732-8521-46a7fc5db82f
This commit is contained in:
tegwick 2026-08-23 12:31:13 +02:00
parent c384f60530
commit 26934e25b9
51 changed files with 1843 additions and 472 deletions

View file

@ -17,6 +17,7 @@ from typing import Any
import yaml
from activity_core.bounded_operations import validate_bounded_operations
from activity_core.glas_profile import (
ProfileRefError,
require_harness_profile,
@ -122,6 +123,28 @@ def _validate_execution_declarations(
)
def _normalise_review_advisory(
instructions: list[dict[str, Any]], file: Path
) -> None:
"""Migrate the legacy gate-sounding field to advisory-only semantics."""
for instruction in instructions:
legacy_present = "review_required" in instruction
advisory_present = "review_advisory" in instruction
if legacy_present and advisory_present and (
bool(instruction["review_required"])
!= bool(instruction["review_advisory"])
):
raise ParseError(
file,
None,
f"instruction {instruction.get('id')!r} declares conflicting "
"review_required and review_advisory values",
)
if legacy_present:
instruction.setdefault("review_advisory", bool(instruction["review_required"]))
instruction.pop("review_required", None)
def _scan_dirs() -> list[Path]:
dirs: list[Path] = []
default_dir = Path("activity-definitions")
@ -236,7 +259,12 @@ def parse_file(path: Path) -> ActivityDefinitionDef:
raise ParseError(path, None, "instruction block missing required field 'id'")
instructions.append(block_data)
_normalise_review_advisory(instructions, path)
_validate_execution_declarations(rules, instructions, path)
try:
validate_bounded_operations(context_sources, instructions)
except ValueError as exc:
raise ParseError(path, None, str(exc)) from exc
return ActivityDefinitionDef(
id=str(fm["id"]),