flayer.integrations.contracts¶
flayer.integrations.contracts ¶
Consumer-neutral immutable envelopes for strictly allowlisted integration evidence.
REQUEST_ID_PATTERN
module-attribute
¶
REQUEST_ID_PATTERN = re.compile('[A-Za-z0-9][A-Za-z0-9_.-]{0,63}\\Z')
METRIC_BOUNDS
module-attribute
¶
METRIC_BOUNDS = {'duration_seconds': (0, 30), 'received_bytes': (0, 1024 * 1024), 'byte_limit': (1, 1024 * 1024), 'http_status': (100, 599), 'throughput_mbps': (0, 1000000000000)}
INTEGER_METRICS
module-attribute
¶
INTEGER_METRICS = frozenset({'received_bytes', 'byte_limit', 'http_status'})
NULLABLE_METRICS
module-attribute
¶
NULLABLE_METRICS = frozenset({'http_status', 'throughput_mbps'})
LIFECYCLE_ACTIONS
module-attribute
¶
LIFECYCLE_ACTIONS = frozenset({'status', 'create', 'destroy', 'recover'})
LIFECYCLE_STATUSES
module-attribute
¶
LIFECYCLE_STATUSES = frozenset({'complete', 'incomplete', 'uncertain', 'rolled-back', 'rollback-incomplete'})
RESOURCE_STATUSES
module-attribute
¶
RESOURCE_STATUSES = frozenset({'recorded', 'present', 'missing', 'not-recorded'})
Evidence
module-attribute
¶
Evidence: TypeAlias = DiagnosticEvidence | StateEvidence | LifecycleEvidence
IntegrationError ¶
Bases: ContractError
An envelope violates the bounded evidence contract without exposing its input.
IntegrationOperation ¶
Bases: StrEnum
Supported observations convey no infrastructure execution authorization.
IntegrationRequest
dataclass
¶
IntegrationRequest(identity: StackIdentity, request_id: str, operation: IntegrationOperation, schema_version: int = 1)
Non-authorizing observation intent bound to exact scope, owner, and correlation.
Metric
dataclass
¶
Metric(name: str, value: int | float | None)
CheckEvidence
dataclass
¶
CheckEvidence(status: DiagnosticStatus, metrics: tuple[Metric, ...] = ())
A diagnostic outcome and measurements without private names, prose, or details.
DiagnosticEvidence
dataclass
¶
DiagnosticEvidence(checks: tuple[CheckEvidence, ...])
Ordered diagnostic checks retain truthful aggregation without external text.
Status
property
¶
Status: DiagnosticStatus
Use the established severity contract, including unsupported empty evidence.
StateEvidence
dataclass
¶
StateEvidence(resource_count: int)
A local owned-state count makes no remote existence or health assertion.
ResourceCount
dataclass
¶
ResourceCount(status: str, count: int)
LifecycleEvidence
dataclass
¶
LifecycleEvidence(action: str, status: str, recovery_required: bool, resources: tuple[ResourceCount, ...])
Historical lifecycle outcome and recovery requirement convey no mutation permission.
IntegrationResult
dataclass
¶
IntegrationResult(request: IntegrationRequest, evidence: Evidence)
Allowlisted evidence bound to the exact original validated observation request.
RequireIdentity ¶
RequireIdentity(actual: StackIdentity, expected: StackIdentity) -> None
Require all ownership and provider scope fields to match independently held context.
Source code in installed/flayer/integrations/contracts.py
48 49 50 51 52 | |
ValidateCount ¶
ValidateCount(value: object) -> int
Reject coercion and bound recorded-resource and observation counts.
Source code in installed/flayer/integrations/contracts.py
55 56 57 58 59 60 61 | |