feat(detection-core): define per-case outcome projection

This commit is contained in:
Marius Ciepluch
2026-11-11 10:07:53 +01:00
parent 999aabd5e3
commit ffea8f615e
9 changed files with 443 additions and 3 deletions
+2 -1
View File
@@ -575,7 +575,7 @@ contract work and use synthetic/in-memory workflow boundaries only.
- Done when a canonical multi-scope release passes and a mutation matrix proves every association mismatch is invalid rather than a failed quality gate.
- _Requirements: 18.2, 18.5, 19.2, 19.10_
- _Boundary: Released Case Validation_
- [ ] 15.3 Define the closed per-case outcome projection contract
- [x] 15.3 Define the closed per-case outcome projection contract
- Add exact `UNANIMOUS_EVIDENCE` and `DECLARATIVE_COMBINATION_TABLE` policies; require component and combined configurations respectively to use the matching kind-specific policy and bind it into configuration and baseline identity.
- Derive `case_input_digest` only from the canonical nonempty set of validated change-input digests, never from caller-selected correlation metadata.
- Define one canonical projection containing the derived case-input identity, exact source-outcome digests, policy, normalized `NeutralOutcome`, and projection digest.
@@ -742,6 +742,7 @@ contract work and use synthetic/in-memory workflow boundaries only.
- Task 15.1 added exact V3 arm-case and independently reviewed release contracts that rebind the complete plan-to-spend graph, trusted observations, case cardinality, and nonzero read/execution evidence before metrics.
- Task 15.2 authenticates the reviewed multi-scope release and sealed observation graph before rederiving every case association, so fully rehashed result, push, pair, input, and cross-scope substitutions fail before metrics.
- Task 15.3 debug established that combination replay lacked a canonical authenticated component-outcome projection. The approved amendment inserts the fail-closed projection contract as Task 15.3, observation/release integration as Task 15.4, per-case table replay as Task 15.5, and proof continuity as Task 15.6.
- Task 15.3 projection derivation validates exact packet, decision, and provenance roots bottom-up before hashing change-input correlation; malformed, subclassed, or self-consistently rehashed nested aggregates fail through the contract-owned error boundary.
- The frozen migration inventory is a reviewed worklist with stable identities, not a semantic-use census. It may only close entries as `v2_migrated` or `retired`; it never grows, deletes entries, or proves absence by interpreting Python flow.
- Cutover is proved by explicit syntax checks plus deletion of the compatibility and v1 write capability. No task extends the discarded alias/data-flow interpreter.
- Task 10.5 debug established that executable owner probes cannot compensate for blanket source-closure acceptance; resumed hunt attempts also require collision-resistant attempt identity and create-only persistence before handoff validation is authoritative.
@@ -9,6 +9,7 @@ from itertools import product
from openultrasast.core import canonical
from openultrasast.core._evaluation_measurement_contracts import (
ArmScopeKey,
CaseOutcomeProjectionPolicyV3,
DenominatorPolicyV3,
EvaluationMeasurementError,
MetricId,
@@ -132,6 +133,7 @@ class ArmConfigurationV3:
registered_budget_digest: str
execution_identity: str
outcome_mapping_digest: str
case_outcome_policy: CaseOutcomeProjectionPolicyV3
combination_rule: CombinationRuleV3 | None
configuration_identity_digest: str
@@ -188,9 +190,16 @@ class ArmConfigurationV3:
_text(self.execution_identity, "execution identity")
def _validate_combination(self) -> None:
if self.kind is ArmKindV3.COMPONENT and self.combination_rule is not None:
raise EvaluationMeasurementError("component arm must not carry a combination rule")
if type(self.case_outcome_policy) is not CaseOutcomeProjectionPolicyV3:
raise EvaluationMeasurementError("case outcome policy must use the closed CaseOutcomeProjectionPolicyV3 enum")
if self.kind is ArmKindV3.COMPONENT:
if self.case_outcome_policy is not CaseOutcomeProjectionPolicyV3.UNANIMOUS_EVIDENCE:
raise EvaluationMeasurementError("component arm must use unanimous evidence outcome projection")
if self.combination_rule is not None:
raise EvaluationMeasurementError("component arm must not carry a combination rule")
if self.kind is ArmKindV3.COMBINED:
if self.case_outcome_policy is not CaseOutcomeProjectionPolicyV3.DECLARATIVE_COMBINATION_TABLE:
raise EvaluationMeasurementError("combined arm must use declarative combination-table outcome projection")
if type(self.combination_rule) is not CombinationRuleV3:
raise EvaluationMeasurementError("combined arm requires a combination rule")
self.combination_rule.__post_init__()
@@ -214,6 +223,7 @@ def derive_arm_configuration_identity_digest(value: ArmConfigurationV3) -> str:
"registered_budget_digest": value.registered_budget_digest,
"execution_identity": value.execution_identity,
"outcome_mapping_digest": value.outcome_mapping_digest,
"case_outcome_policy": value.case_outcome_policy.value,
"combination_rule_digest": None if value.combination_rule is None else value.combination_rule.rule_digest,
}
return canonical.content_digest(_value("arm_configuration", payload))
@@ -225,6 +235,7 @@ __all__ = [
"CombinationDecisionRowV3",
"CombinationOperatorV3",
"CombinationRuleV3",
"CaseOutcomeProjectionPolicyV3",
"ProofCandidatePolicyV3",
"derive_arm_configuration_identity_digest",
]
@@ -114,6 +114,11 @@ class Comparator(Enum):
AT_MOST = "at_most"
class CaseOutcomeProjectionPolicyV3(Enum):
UNANIMOUS_EVIDENCE = "unanimous_evidence"
DECLARATIVE_COMBINATION_TABLE = "declarative_combination_table"
@dataclass(frozen=True, order=True)
class ScopeKey:
family_id: str
@@ -411,6 +416,7 @@ def validate_aggregate_weights(
__all__ = [
"AggregateWeightV3",
"ArmScopeKey",
"CaseOutcomeProjectionPolicyV3",
"Comparator",
"DenominatorKind",
"DenominatorPolicyV3",
@@ -0,0 +1,153 @@
"""Fail-closed per-case outcome projection contracts for evaluation admission V3."""
from __future__ import annotations
import re
from dataclasses import dataclass
from typing import ClassVar
from openultrasast.core import canonical
from openultrasast.core._evaluation_measurement_contracts import CaseOutcomeProjectionPolicyV3
from openultrasast.core.evaluation_version import (
EVALUATION_ADMISSION_V3_SCHEMA,
EvaluationV3Contract,
NonAuthorizingV3,
require_exact_v3_contract,
)
from openultrasast.core.evidence import Decision, EvidencePacket, EvidenceRecord, NeutralOutcome, derive_record_id
from openultrasast.core.provenance import ProvenanceStamp
_DIGEST = re.compile(r"[0-9a-f]{64}")
_SCHEMA = "openultrasast.detection-core.evaluation-case-outcome.v3"
class CaseOutcomeProjectionError(ValueError):
"""A per-case outcome projection is incomplete, ambiguous, or non-canonical."""
def _digest(value: object, field: str) -> str:
if type(value) is not str or _DIGEST.fullmatch(value) is None:
raise CaseOutcomeProjectionError(f"{field} must be a full lowercase SHA-256 digest")
return value
def _value(kind: str, payload: canonical.JsonValue) -> canonical.JsonValue:
return {"schema_version": _SCHEMA, "kind": kind, "payload": payload}
def _bind(value: object, field: str, expected: str) -> None:
actual = getattr(value, field)
if actual == "":
object.__setattr__(value, field, expected)
elif _digest(actual, field) != expected:
raise CaseOutcomeProjectionError(f"{field} does not match canonical content")
def _source_digests(value: object, policy: CaseOutcomeProjectionPolicyV3) -> tuple[str, ...]:
if type(value) is not tuple or not value:
raise CaseOutcomeProjectionError("source outcome digests must be a nonempty exact tuple")
for item in value:
_digest(item, "source outcome digest")
if policy is CaseOutcomeProjectionPolicyV3.UNANIMOUS_EVIDENCE:
if len(set(value)) != len(value):
raise CaseOutcomeProjectionError("unanimous evidence source outcome digests must be unique")
if value != tuple(sorted(value)):
raise CaseOutcomeProjectionError("unanimous evidence source outcome digests must use canonical order")
return value
@dataclass(frozen=True)
class CaseOutcomeProjectionV3(EvaluationV3Contract, NonAuthorizingV3):
"""One digest-bound neutral outcome for one authenticated case input."""
__evaluation_v3_contract_schema__: ClassVar[str] = EVALUATION_ADMISSION_V3_SCHEMA
case_input_digest: str
policy: CaseOutcomeProjectionPolicyV3
source_outcome_digests: tuple[str, ...]
normalized_outcome: NeutralOutcome
projection_digest: str
def __post_init__(self) -> None:
require_exact_v3_contract(self, CaseOutcomeProjectionV3, field="case outcome projection")
_digest(self.case_input_digest, "case input digest")
if type(self.policy) is not CaseOutcomeProjectionPolicyV3:
raise CaseOutcomeProjectionError("projection policy must use exact CaseOutcomeProjectionPolicyV3")
sources = _source_digests(self.source_outcome_digests, self.policy)
if type(self.normalized_outcome) is not NeutralOutcome:
raise CaseOutcomeProjectionError("normalized outcome must use exact NeutralOutcome")
payload: canonical.JsonValue = {
"case_input_digest": self.case_input_digest,
"policy": self.policy.value,
"source_outcome_digests": sources,
"normalized_outcome": self.normalized_outcome.value,
}
_bind(self, "projection_digest", canonical.content_digest(_value("case_outcome_projection", payload)))
def _canonical_records(records: object) -> tuple[EvidenceRecord, ...]:
if type(records) is not tuple or not records:
raise CaseOutcomeProjectionError("component evidence records must be a nonempty exact tuple")
if any(type(record) is not EvidenceRecord for record in records):
raise CaseOutcomeProjectionError("component evidence records must contain exact EvidenceRecord values")
validated = records
for record in validated:
try:
if type(record.packet) is not EvidencePacket:
raise CaseOutcomeProjectionError("evidence record packet must use exact EvidencePacket")
if type(record.decision) is not Decision:
raise CaseOutcomeProjectionError("evidence record decision must use exact Decision")
if type(record.packet.provenance) is not ProvenanceStamp:
raise CaseOutcomeProjectionError("evidence record provenance change input digest must use exact ProvenanceStamp")
_digest(record.packet.provenance.change_input_digest, "change input digest")
record.packet.provenance.__post_init__()
record.packet.__post_init__()
record.decision.__post_init__()
record.__post_init__()
expected_record_id = derive_record_id(record.packet, record.decision)
except CaseOutcomeProjectionError:
raise
except (AttributeError, TypeError, ValueError) as exc:
raise CaseOutcomeProjectionError("component evidence record cannot be revalidated") from exc
if record.record_id != expected_record_id:
raise CaseOutcomeProjectionError("evidence record identity cannot be re-derived")
identities = tuple(record.record_id for record in validated)
if len(set(identities)) != len(identities):
raise CaseOutcomeProjectionError("component evidence record identities must be unique")
return tuple(sorted(validated, key=lambda item: item.record_id))
def derive_case_input_digest(records: tuple[EvidenceRecord, ...]) -> str:
"""Derive correlation identity from exact, already trust-validated evidence records."""
validated = _canonical_records(records)
change_input_digests = tuple(sorted({record.packet.provenance.change_input_digest for record in validated}))
payload: canonical.JsonValue = {"change_input_digests": change_input_digests}
return canonical.content_digest(_value("case_input", payload))
def derive_component_case_outcome_projection(
records: tuple[EvidenceRecord, ...],
) -> CaseOutcomeProjectionV3:
"""Project exact trust-validated component records only when every outcome agrees."""
validated = _canonical_records(records)
outcomes = {record.decision.outcome for record in validated}
if len(outcomes) != 1:
raise CaseOutcomeProjectionError("component evidence records must carry the same neutral outcome")
outcome = next(iter(outcomes))
return CaseOutcomeProjectionV3(
derive_case_input_digest(validated),
CaseOutcomeProjectionPolicyV3.UNANIMOUS_EVIDENCE,
tuple(record.record_id for record in validated),
outcome,
"",
)
__all__ = [
"CaseOutcomeProjectionError",
"CaseOutcomeProjectionPolicyV3",
"CaseOutcomeProjectionV3",
"derive_case_input_digest",
"derive_component_case_outcome_projection",
]
@@ -3,6 +3,7 @@
from openultrasast.core._evaluation_arm_configuration import (
ArmConfigurationV3,
ArmKindV3,
CaseOutcomeProjectionPolicyV3,
CombinationDecisionRowV3,
CombinationOperatorV3,
CombinationRuleV3,
@@ -37,6 +38,7 @@ __all__ = [
"ArmConfigurationV3",
"ArmKindV3",
"ArmScopeKey",
"CaseOutcomeProjectionPolicyV3",
"CombinationDecisionRowV3",
"CombinationOperatorV3",
"CombinationRuleV3",
@@ -12,6 +12,7 @@ from openultrasast.core.evaluation_measurement import (
ArmConfigurationV3,
ArmKindV3,
ArmScopeKey,
CaseOutcomeProjectionPolicyV3,
CombinationDecisionRowV3,
CombinationOperatorV3,
CombinationRuleV3,
@@ -27,6 +28,7 @@ from openultrasast.core.evaluation_measurement import (
ScopeKey,
ScopeSufficiencyRuleV3,
Statistic,
derive_arm_configuration_identity_digest,
standard_scoped_metric_rules,
)
@@ -108,6 +110,7 @@ def _configuration(
registered_budget_digest=_digest("budget"),
execution_identity="container@sha256:abc",
outcome_mapping_digest=_digest(outcome_mapping),
case_outcome_policy=CaseOutcomeProjectionPolicyV3.DECLARATIVE_COMBINATION_TABLE,
combination_rule=_rule() if combination_rule is None else combination_rule,
configuration_identity_digest="",
)
@@ -199,3 +202,31 @@ def test_identical_component_candidate_policy_is_the_only_proof_retention_policy
assert rule.candidate_policy is ProofCandidatePolicyV3.IDENTICAL_COMPONENT_ONLY
with pytest.raises(EvaluationMeasurementError, match="closed operator and candidate policy"):
replace(rule, candidate_policy=object(), rule_digest="")
def test_arm_kind_requires_its_exact_outcome_projection_policy() -> None:
combined = _configuration()
with pytest.raises(EvaluationMeasurementError, match="combined arm must use declarative"):
replace(
combined,
case_outcome_policy=CaseOutcomeProjectionPolicyV3.UNANIMOUS_EVIDENCE,
configuration_identity_digest="",
)
component = replace(
combined,
kind=ArmKindV3.COMPONENT,
case_outcome_policy=CaseOutcomeProjectionPolicyV3.UNANIMOUS_EVIDENCE,
combination_rule=None,
configuration_identity_digest="",
)
with pytest.raises(EvaluationMeasurementError, match="component arm must use unanimous"):
replace(
component,
case_outcome_policy=CaseOutcomeProjectionPolicyV3.DECLARATIVE_COMBINATION_TABLE,
configuration_identity_digest="",
)
original_identity = component.configuration_identity_digest
object.__setattr__(component, "case_outcome_policy", CaseOutcomeProjectionPolicyV3.DECLARATIVE_COMBINATION_TABLE)
assert derive_arm_configuration_identity_digest(component) != original_identity
+223
View File
@@ -0,0 +1,223 @@
"""Fail-closed per-case outcome projection contracts for evaluation V3."""
from __future__ import annotations
from collections.abc import Callable
from dataclasses import replace
from itertools import permutations
import pytest
from test_core_evidence import _record
from openultrasast.core import canonical
from openultrasast.core.evidence import Decision, EvidencePacket, EvidenceRecord, NeutralOutcome, derive_packet_digest, derive_record_id
def _digest(label: str) -> str:
return canonical.content_digest(label)
def _case_record(label: str, outcome: NeutralOutcome, *, change: str = "change-a") -> EvidenceRecord:
reasons = ("ambiguous",) if outcome is NeutralOutcome.INDETERMINATE else ()
base = _record(outcome=outcome, reasons=reasons)
provenance = replace(base.packet.provenance, change_input_digest=_digest(change))
packet = replace(base.packet, security_object_id=f"resource:{label}", provenance=provenance)
return _record(packet=packet, outcome=outcome, reasons=reasons)
def _rehash_record(record: EvidenceRecord) -> None:
object.__setattr__(record.decision, "packet_digest", derive_packet_digest(record.packet))
object.__setattr__(record, "record_id", derive_record_id(record.packet, record.decision))
def _projection_operations() -> tuple[Callable[[tuple[EvidenceRecord, ...]], object], ...]:
from openultrasast.core.evaluation_case_outcome import derive_case_input_digest, derive_component_case_outcome_projection
return (derive_case_input_digest, derive_component_case_outcome_projection)
def test_component_projection_derives_canonical_case_input_sources_and_outcome() -> None:
from openultrasast.core.evaluation_case_outcome import (
CaseOutcomeProjectionPolicyV3,
derive_case_input_digest,
derive_component_case_outcome_projection,
)
first = _case_record("first", NeutralOutcome.VIOLATION, change="change-b")
second = _case_record("second", NeutralOutcome.VIOLATION, change="change-a")
forward = derive_component_case_outcome_projection((first, second))
reverse = derive_component_case_outcome_projection((second, first))
assert forward == reverse
assert forward.case_input_digest == derive_case_input_digest((first, second))
assert forward.source_outcome_digests == tuple(sorted((first.record_id, second.record_id)))
assert forward.policy is CaseOutcomeProjectionPolicyV3.UNANIMOUS_EVIDENCE
assert forward.normalized_outcome is NeutralOutcome.VIOLATION
assert len(forward.projection_digest) == 64
def test_component_projection_refuses_empty_duplicate_and_mixed_record_sets() -> None:
from openultrasast.core.evaluation_case_outcome import (
CaseOutcomeProjectionError,
derive_component_case_outcome_projection,
)
violation = _case_record("violation", NeutralOutcome.VIOLATION)
satisfied = _case_record("satisfied", NeutralOutcome.SATISFIED)
indeterminate = _case_record("indeterminate", NeutralOutcome.INDETERMINATE)
with pytest.raises(CaseOutcomeProjectionError, match="nonempty"):
derive_component_case_outcome_projection(())
with pytest.raises(CaseOutcomeProjectionError, match="unique"):
derive_component_case_outcome_projection((violation, violation))
for selected in permutations((violation, satisfied, indeterminate), 2):
with pytest.raises(CaseOutcomeProjectionError, match="same neutral outcome"):
derive_component_case_outcome_projection(selected)
def test_projection_contract_refuses_noncanonical_sources_wrong_types_and_tampering() -> None:
from openultrasast.core.evaluation_case_outcome import (
CaseOutcomeProjectionError,
CaseOutcomeProjectionPolicyV3,
CaseOutcomeProjectionV3,
derive_component_case_outcome_projection,
)
first = _case_record("first", NeutralOutcome.SATISFIED, change="change-b")
second = _case_record("second", NeutralOutcome.SATISFIED, change="change-a")
projection = derive_component_case_outcome_projection((first, second))
mutations = (
{"case_input_digest": _digest("wrong")},
{"policy": "unanimous_evidence"},
{"source_outcome_digests": tuple(reversed(projection.source_outcome_digests))},
{"source_outcome_digests": (projection.source_outcome_digests[0],) * 2, "projection_digest": ""},
{"normalized_outcome": "satisfied"},
{"projection_digest": _digest("tampered")},
)
for mutation in mutations:
with pytest.raises(CaseOutcomeProjectionError):
replace(projection, **mutation)
combined = CaseOutcomeProjectionV3(
projection.case_input_digest,
CaseOutcomeProjectionPolicyV3.DECLARATIVE_COMBINATION_TABLE,
(projection.projection_digest, projection.projection_digest),
projection.normalized_outcome,
"",
)
assert combined.projection_digest != projection.projection_digest
def test_component_projection_refuses_record_subclasses_and_source_changes() -> None:
from openultrasast.core.evaluation_case_outcome import (
CaseOutcomeProjectionError,
derive_component_case_outcome_projection,
)
record = _case_record("base", NeutralOutcome.SATISFIED)
class DerivedRecord(EvidenceRecord):
pass
derived = DerivedRecord(record.packet, record.decision, record.record_id)
with pytest.raises(CaseOutcomeProjectionError, match="exact EvidenceRecord"):
derive_component_case_outcome_projection((derived,))
tampered = _case_record("tampered", NeutralOutcome.SATISFIED)
object.__setattr__(tampered, "record_id", _digest("wrong"))
with pytest.raises(CaseOutcomeProjectionError, match="revalidated"):
derive_component_case_outcome_projection((tampered,))
changed = _case_record("base", NeutralOutcome.SATISFIED, change="change-b")
assert derive_component_case_outcome_projection((record,)).case_input_digest != derive_component_case_outcome_projection(
(changed,)
).case_input_digest
def test_case_input_derivation_refuses_self_consistent_invalid_nested_change_identity() -> None:
from openultrasast.core.evaluation_case_outcome import (
CaseOutcomeProjectionError,
derive_case_input_digest,
derive_component_case_outcome_projection,
)
record = _case_record("nested", NeutralOutcome.SATISFIED)
object.__setattr__(record.packet.provenance, "change_input_digest", "caller-selected-text")
object.__setattr__(record.decision, "packet_digest", derive_packet_digest(record.packet))
object.__setattr__(record, "record_id", derive_record_id(record.packet, record.decision))
for operation in (derive_case_input_digest, derive_component_case_outcome_projection):
with pytest.raises(CaseOutcomeProjectionError, match="change input digest"):
operation((record,))
def test_case_input_derivation_wraps_plainly_wrong_nested_provenance_type() -> None:
from openultrasast.core.evaluation_case_outcome import (
CaseOutcomeProjectionError,
derive_case_input_digest,
derive_component_case_outcome_projection,
)
record = _case_record("wrong-provenance", NeutralOutcome.SATISFIED)
object.__setattr__(record.packet, "provenance", object())
for operation in (derive_case_input_digest, derive_component_case_outcome_projection):
with pytest.raises(CaseOutcomeProjectionError, match="exact ProvenanceStamp"):
operation((record,))
def test_case_input_derivation_wraps_plainly_wrong_nested_packet_type() -> None:
from openultrasast.core.evaluation_case_outcome import CaseOutcomeProjectionError
record = _case_record("wrong-packet", NeutralOutcome.SATISFIED)
object.__setattr__(record, "packet", object())
for operation in _projection_operations():
with pytest.raises(CaseOutcomeProjectionError, match="exact EvidencePacket"):
operation((record,))
@pytest.mark.parametrize("nested_kind", ("packet", "decision"))
def test_case_input_derivation_refuses_nested_aggregate_subclasses(nested_kind: str) -> None:
from openultrasast.core.evaluation_case_outcome import CaseOutcomeProjectionError
record = _case_record(f"subclass-{nested_kind}", NeutralOutcome.SATISFIED)
if nested_kind == "packet":
class DerivedPacket(EvidencePacket):
pass
packet = DerivedPacket(**vars(record.packet))
object.__setattr__(record, "packet", packet)
_rehash_record(record)
else:
class DerivedDecision(Decision):
pass
decision = DerivedDecision(**vars(record.decision))
object.__setattr__(record, "decision", decision)
object.__setattr__(record, "record_id", derive_record_id(record.packet, decision))
expected_type = "EvidencePacket" if nested_kind == "packet" else "Decision"
for operation in _projection_operations():
with pytest.raises(CaseOutcomeProjectionError, match=f"exact {expected_type}"):
operation((record,))
@pytest.mark.parametrize("nested_kind", ("packet", "decision"))
def test_case_input_derivation_revalidates_self_consistently_rehashed_aggregates(nested_kind: str) -> None:
from openultrasast.core.evaluation_case_outcome import CaseOutcomeProjectionError
record = _case_record(f"invalid-{nested_kind}", NeutralOutcome.SATISFIED)
if nested_kind == "packet":
object.__setattr__(record.packet, "family_id", "")
_rehash_record(record)
else:
object.__setattr__(record.decision, "family_code", "")
object.__setattr__(record, "record_id", derive_record_id(record.packet, record.decision))
for operation in _projection_operations():
with pytest.raises(CaseOutcomeProjectionError, match="cannot be revalidated"):
operation((record,))
@@ -15,6 +15,7 @@ from openultrasast.core.evaluation_measurement import (
ArmConfigurationV3,
ArmKindV3,
ArmScopeKey,
CaseOutcomeProjectionPolicyV3,
CombinationDecisionRowV3,
CombinationOperatorV3,
CombinationRuleV3,
@@ -109,6 +110,11 @@ def _configuration(
registered_budget_digest=_digest("budget"),
execution_identity="container@sha256:abc",
outcome_mapping_digest=_digest("outcomes"),
case_outcome_policy=(
CaseOutcomeProjectionPolicyV3.DECLARATIVE_COMBINATION_TABLE
if kind is ArmKindV3.COMBINED
else CaseOutcomeProjectionPolicyV3.UNANIMOUS_EVIDENCE
),
combination_rule=combination_rule,
configuration_identity_digest="",
)
+7
View File
@@ -12,6 +12,7 @@ from openultrasast.core.evaluation_measurement import (
ArmConfigurationV3,
ArmKindV3,
ArmScopeKey,
CaseOutcomeProjectionPolicyV3,
CombinationDecisionRowV3,
CombinationOperatorV3,
CombinationRuleV3,
@@ -99,6 +100,11 @@ def _configuration(arm_id: str, *, combined: bool = False, configuration: str =
_digest("budget"),
"container@sha256:abc",
_digest("outcomes"),
(
CaseOutcomeProjectionPolicyV3.DECLARATIVE_COMBINATION_TABLE
if combined
else CaseOutcomeProjectionPolicyV3.UNANIMOUS_EVIDENCE
),
_combination_rule() if combined else None,
"",
)
@@ -209,6 +215,7 @@ def test_combined_arm_cannot_use_another_combined_arm_as_a_component() -> None:
nested = replace(
arm_a,
kind=ArmKindV3.COMBINED,
case_outcome_policy=CaseOutcomeProjectionPolicyV3.DECLARATIVE_COMBINATION_TABLE,
combination_rule=nested_rule,
configuration_identity_digest="",
)