feat(detection-core): add benchmark readiness adapter

This commit is contained in:
Marius Ciepluch
2026-11-02 10:40:04 +01:00
parent a6990e25af
commit 362e9548c4
4 changed files with 478 additions and 2 deletions
+16 -1
View File
@@ -14,18 +14,22 @@ from __future__ import annotations
import hashlib
import json
import time
from collections.abc import Callable
from dataclasses import asdict, dataclass
from pathlib import Path
from typing import TYPE_CHECKING, Any
from typing import TYPE_CHECKING, Any, TypeVar
if TYPE_CHECKING:
from openultrasast.hunt.prover import ProverResult
from benchmarks.valid.readiness_contract import require_stage_authorized
from benchmarks.valid.run_manifests import AnalyzerBundle
from openultrasast.core.readiness import AnalysisIdentity, ReadinessResult, ReadinessStage
from openultrasast.hunt.producers import Context
from openultrasast.hunt.prover import prove_change
_STAGE_KEYS = ("entry_recognition", "resolution", "judgment")
_T = TypeVar("_T")
@dataclass(frozen=True)
@@ -118,6 +122,16 @@ def run_development(
return tuple(records)
def run_development_when_ready(
readiness_receipts: tuple[ReadinessResult, ...],
current_identity: AnalysisIdentity,
population_work: Callable[[], _T],
) -> _T:
"""Run caller-owned development work only after all prior stages pass."""
require_stage_authorized(ReadinessStage.DEVELOPMENT, readiness_receipts, current_identity)
return population_work()
class GateFailure(RuntimeError):
"""A measured change exceeded the hard runtime budget (Req 6.1)."""
@@ -247,6 +261,7 @@ __all__ = [
"four_arm_report",
"judgment_transition",
"run_development",
"run_development_when_ready",
"stage_funnel",
"summarize_development",
]