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.
Methods
Section titled “Methods”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
status
Section titled “status”@property
def status(self) -> str:
Return the wire status; it does not alone prove business success.
Source: python/yosoi/runtime_contracts.py:915
document_id
Section titled “document_id”@property
def document_id(self) -> str | None:
Return the source document identity when this status carries one.
Source: python/yosoi/runtime_contracts.py:920
completeness
Section titled “completeness”@property
def completeness(self) -> IncompleteEvidence | None:
Return incomplete-evidence details for an indeterminate result, else None.
Source: python/yosoi/runtime_contracts.py:925
reason_code
Section titled “reason_code”@property
def reason_code(self) -> str | None:
Return the indeterminate reason code, or None for other statuses.
Source: python/yosoi/runtime_contracts.py:930
failure
Section titled “failure”@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
records
Section titled “records”@property
def records(self) -> tuple[RuntimeValidatedRecord, ...]:
Return accepted records for evaluated results, otherwise an empty tuple.
Source: python/yosoi/runtime_contracts.py:942
issues
Section titled “issues”@property
def issues(self) -> tuple[RuntimeRecordIssue, ...]:
Return evaluated candidate issues, or an empty tuple otherwise.
Source: python/yosoi/runtime_contracts.py:947
extraction_diagnostics
Section titled “extraction_diagnostics”@property
def extraction_diagnostics(self) -> tuple[ExtractionDiagnostic, ...]:
Return evaluated extraction diagnostics, otherwise an empty tuple.
Source: python/yosoi/runtime_contracts.py:952
require_all
Section titled “require_all”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
to_archived
Section titled “to_archived”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
to_json
Section titled “to_json”def to_json(self) -> str:
Return the original Rust wire JSON without serializing the enriched view.
Source: python/yosoi/runtime_contracts.py:1002
model_dump
Section titled “model_dump”def model_dump(self) -> dict[str, Any]:
Decode the original wire into a new dictionary.
Source: python/yosoi/runtime_contracts.py:1006
model_dump_json
Section titled “model_dump_json”def model_dump_json(self) -> str:
Return the original Rust wire JSON without serializing the enriched view.