flayer.core.contracts¶
flayer.core.contracts ¶
Validated identities shared by desired plans and persisted resource ownership.
IDENTITY_FIELDS
module-attribute
¶
IDENTITY_FIELDS = frozenset({'project', 'stack', 'provider', 'scope_id', 'owner_id'})
ContractError ¶
Bases: ValueError
An input violates a versioned core contract before any external operation.
StackIdentity
dataclass
¶
StackIdentity(project: str, stack: str, provider: str, scope_id: str, owner_id: str)
Exact ownership boundary for one provider scope and one managed stack.
OwnershipLabels ¶
OwnershipLabels() -> dict[str, str]
Return explicit labels for provider adapters to attach and verify.
Source code in installed/flayer/core/contracts.py
91 92 93 94 95 96 97 98 99 | |
ValidateName ¶
ValidateName(value: object, label: str) -> str
Require a bounded portable name without coercing invalid input types.
Source code in installed/flayer/core/contracts.py
19 20 21 22 23 24 25 | |
ValidateIdentifier ¶
ValidateIdentifier(value: object, label: str) -> str
Accept opaque provider identifiers without control characters or whitespace.
Source code in installed/flayer/core/contracts.py
28 29 30 31 32 33 34 35 36 37 38 | |
ValidateSchemaVersion ¶
ValidateSchemaVersion(value: object) -> None
Reject unknown schema versions and booleans masquerading as integers.
Source code in installed/flayer/core/contracts.py
41 42 43 44 45 | |
ValidateFields ¶
ValidateFields(data: Mapping[str, object], required: frozenset[str], optional: frozenset[str], label: str) -> None
Reject missing and unknown fields instead of silently accepting configuration typos.
Source code in installed/flayer/core/contracts.py
48 49 50 51 52 53 54 55 56 57 58 59 60 | |
RequireTable ¶
RequireTable(value: object, label: str) -> Mapping[str, object]
Require a string-keyed table at an untrusted decoding boundary.
Source code in installed/flayer/core/contracts.py
63 64 65 66 67 68 69 | |
ParseIdentity ¶
ParseIdentity(value: object) -> StackIdentity
Decode a complete identity without defaulting missing ownership information.
Source code in installed/flayer/core/contracts.py
102 103 104 105 106 107 108 109 110 111 112 113 114 | |