Skip to content
YosoiDocs

RuntimeContractOutcome

yosoi.runtime_contracts.RuntimeContractOutcome

class RuntimeContractOutcome:

Inspect runtime validation results while retaining the Rust handle.

The Python view includes empty tuples for missing candidate fields. JSON serialization preserves the original Rust wire, which may omit those entries.

Attributes: contract_schema: Schema used to interpret and complete candidate field mappings. view: Immutable status-tagged validation DTO with every schema field represented.

Source: python/yosoi/runtime_contracts.py:869

Members below are declared on this class. Inherited Pydantic methods and generated constructor signatures are not expanded.

def __init__(self, contract_schema: ContractSchema, handle: _native.ContractOutcome) -> None:

Parse a native validation result and seal the Python view.

Args: contract_schema: Schema that supplies missing candidate field entries. handle: Rust validation result retained for subsequent operations.

Raises: ValueError: Native JSON does not match the expected outcome structure.

Source: python/yosoi/runtime_contracts.py:883

@property
def status(self) -> str:

Return the wire status; it does not alone prove business success.

Source: python/yosoi/runtime_contracts.py:915

@property
def document_id(self) -> str | None:

Return the source document identity when this status carries one.

Source: python/yosoi/runtime_contracts.py:920

@property
def completeness(self) -> IncompleteEvidence | None:

Return incomplete-evidence details for an indeterminate result, else None.

Source: python/yosoi/runtime_contracts.py:925

@property
def reason_code(self) -> str | None:

Return the indeterminate reason code, or None for other statuses.

Source: python/yosoi/runtime_contracts.py:930

@property
def failure(self) -> Failure | RuntimeExtractionFailure | RuntimeValidationFailure | None:

Return the typed phase failure, or None when this status has no failure.

Source: python/yosoi/runtime_contracts.py:935

@property
def records(self) -> tuple[RuntimeValidatedRecord, ...]:

Return accepted records for evaluated results, otherwise an empty tuple.

Source: python/yosoi/runtime_contracts.py:942

@property
def issues(self) -> tuple[RuntimeRecordIssue, ...]:

Return evaluated candidate issues, or an empty tuple otherwise.

Source: python/yosoi/runtime_contracts.py:947

@property
def extraction_diagnostics(self) -> tuple[ExtractionDiagnostic, ...]:

Return evaluated extraction diagnostics, otherwise an empty tuple.

Source: python/yosoi/runtime_contracts.py:952

def require_all(self) -> list[RuntimeValidatedRecord]:

Return records only when every candidate and extraction check passed.

Complete no-match returns an empty list. This method preserves the outcome and never silently returns only the successful subset.

Returns: All accepted records as typed values with candidate evidence.

Raises: ContractIssues: Evidence is indeterminate, a phase failed or was rejected, or evaluated results contain field issues or extraction diagnostics.

Source: python/yosoi/runtime_contracts.py:960

def to_archived(self, schema: ContractSchema | None=None) -> ArchivedContractOutcome:

Convert this result to Rust’s code-independent portable archive.

Args: schema: Archive schema; None uses this outcome’s original Contract schema.

Returns: Typed archive with portable values and retained evidence.

Raises: ContractError: Rust rejects the schema or cannot archive the result.

Source: python/yosoi/runtime_contracts.py:984

def to_json(self) -> str:

Return the original Rust wire JSON without serializing the enriched view.

Source: python/yosoi/runtime_contracts.py:1002

def model_dump(self) -> dict[str, Any]:

Decode the original wire into a new dictionary.

Source: python/yosoi/runtime_contracts.py:1006

def model_dump_json(self) -> str:

Return the original Rust wire JSON without serializing the enriched view.

Source: python/yosoi/runtime_contracts.py:1010