Property schemas and contract metadata
Implementation, history and tests of the sections on the reference page Property schemas and contract metadata. Text in square brackets is added here to say what a moved sentence refers to.
Property schemas
- History:
- go-kure/launcher#421 (a kurel parameter’s
Typeisstring,integer,boolean,arrayorobject). - go-kure/launcher#383 (
Typesis the union idiom: a leaf that accepts more than one scalar type). - go-kure/launcher#790 (
Exclusiveis the one-of idiom). - go-kure/launcher#635 (a reservation on an inner field of a declared array of objects is enforced wherever it is declared, not only at the top level; a reserved key authored as
config: {locked: null}is not gone beforeTransformcan refuse it). - go-kure/launcher#1231 (
spec.featureGatesoverrides a gate’s state in both directions). - go-kure/launcher#1183 (a
Gateno row names, or a row no schema uses, fails the schema tests). - go-kure/launcher#1245 (
gatedPathsis read by the gate check alone, so property validation and what a document is accepted as do not change). - go-kure/launcher#1320 (a struct that does not encode as JSON is refused, with its path, where a gate below it is off at the target).
- go-kure/launcher#1450 (a pointer type that is its own element type,
type P *P, is read through its JSON form like any other). - go-kure/launcher#1230 (
ValueGates, which maps anEnumvalue to the gate that value alone needs; likeGate, its key is rejected at the two flat call sites, so it is absent from their allow-sets). - go-kure/launcher#1330 (
ValueGatedPaths, a path that gates values; likeGate, its key is rejected at the two flat call sites). - go-kure/launcher#1580 (
BoundedBy, the refusal classes an authored value at a property can cause; its key is rejected at the two flat call sites and on a model input. Which facts a model may declare for its inputs is an open point of that issue). - go-kure/launcher#408 (
ValidateAuthoredPropertiesis the authored-path counterpart of the emitted-path check, and closes it). - go-kure/launcher#1001 (
postgresqlpoints a key itsbackupreplaced,objectStoreandobjectStoreObjectName, to where it went; and names the reasonbackup.objectStorerefusesserverName,azureCredentialsandgoogleCredentials). - The hint was asked of a terminal component
handler alone before go-kure/launcher#790; the three other positions are new. [The hint is
UnsupportedFieldHint.] - Before go-kure/launcher#790 a nested refusal carried no hint.
- go-kure/launcher#1466 (every refusal the property validators make is a
*PropertyError). - go-kure/launcher#1469 (the platform-reservation check is one of those refusals).
- go-kure/launcher#325 (the shape check is the only place an authored scalar’s type is enforced for every property).
- go-kure/launcher#1282 (the
appargument is never edited, for a plain type name and for a declared type identity alike). - go-kure/launcher#1463 (top-level
Requiredis enforced as written, and a null counts as absent). - go-kure/launcher#765 (nested
Required, inside an object the author did write, is enforced). - go-kure/launcher#750 (for a trait a binding matches, the check reads the trait’s properties as the rendering merges into them, recursively, so a required key the rendering supplies is not refused).
- go-kure/launcher#421 (a kurel parameter’s
- Tests:
- A completeness test (
pkg/cmd/kurel) enforces that every built-in schema node declares exactly one ofTypeandTypes. - A completeness test (
pkg/cmd/kurel) enforces that no built-in schema node is left without a description. TestPropertySchemaFields_FlatSiteDecisions(pkg/oam) andTestLoad_InputSchemaFieldDecisions(pkg/oam/model) read the fields ofPropertySchemaby reflection and fail for one with no recorded decision: whether a kurel parameter, a capability rendering property and a model input accept its key.- The
TestBoundedBytests (pkg/oam/builtin/registry) hold everyboundedBya registered schema publishes to a row that shows the refusal, and every row to a declaration. A declaration with no row, and a row with no declaration, both fail.
- A completeness test (
What an explicit null means on the emitted path
- History:
- go-kure/launcher#394 (aligning the parser-level layer with this contract, a separate, lower-level concern, is not closed by this).
- go-kure/launcher#431 (capability rendering,
checkCapabilityValueType, now agrees with the contract’s own behaviour). - go-kure/launcher#430 (the networkpolicy peer parser read a typed nil
namespaceSelectordifferently from an untyped one; both parsers now route their presence check throughoam.IsNullValue’s reflect-based classification).
- Tests:
- What is
asserted is the rule above:
TestBuiltinHandlerSchemaEnumMembersHoldNoNull(pkg/cmd/kurel) walks every schema that ships for a member holding a null, because the runtime arm only fires once a document validates against the property carrying theEnum. [The rule is that noEnummember holds a null.]
- What is
asserted is the rule above:
Contract metadata
- History:
- go-kure/launcher#789 (
HandlerContractSetgained thePoliciesfield, a breaking library change; every built-in handler and lowering rule implementsContractDescriber). - go-kure/launcher#1027 (
Prerequisiteslists what must be in place in the target cluster, or beside it, for the output to work once applied). - go-kure/launcher#1134 (
Readinesslists, for each kind of resource an entity of this contract provides, how a reader judges that the resource is ready). - go-kure/launcher#1144 (
postgresqldeclares readiness, one entry for each kind it lowers into). - go-kure/launcher#1611 (
PlatformNeedslists the capabilities the platform must serve for the output to work, as names;PolicyResult.PlatformNeedsreports those of the components the lowered application emits; a handler may answer per component through the optionalComponentPlatformNeeds; the CloudNativePG family kinds andpostgresqldeclare theirs).
- go-kure/launcher#789 (
Lowering targets and Seal
- History:
- go-kure/launcher#789 (a consumer that registers a built-in lowering rule without the types it lowers into now fails at
Seal, a breaking library change).
- go-kure/launcher#789 (a consumer that registers a built-in lowering rule without the types it lowers into now fails at
Lowering keys
- History:
- go-kure/launcher#1580 (
webserviceandworkerpublish where each key of their schema lands in their members, from the function the rule forwards with:roleKeysinpkg/oam/builtin/components/role_keys.go). - go-kure/launcher#1601 (the
exposetrait rule publishes its map:pkg/oam/builtin/traits/expose_keys.go).
- go-kure/launcher#1580 (
- Tests:
pkg/oam/builtin/registry/lowering_keys_expose_test.goholds theexposemap: a built-in trait lowering rule with neither a map nor a row fails; a key with no place under acontrollerTypereaches no trait of a document that builds; and it checks the member the report names for anexposetrait on awebservice, aworkerand aworkerwith an authoredserviceAccountName.pkg/oam/builtin/registry/lowering_keys_test.goauthors every key of both schemas and reads the result twice. From what the rule emits: the key changes a value at each declared place and at no other, and an unchanged place holds the authored value. From the provenance report, which names sources and holds no value: the entries the key moves sit at the declared places, and every entry of a sibling group names its member. A fill the key causes at the place of another key (a ReadWriteOnce or ReadWriteOncePod claim that is not also ReadWriteMany gives the deploymentRecreateatstrategy.type) is a row of the key’s sample; one with no row fails, and so does a row whose fill no longer happens. An entry the key removes is read the same way: it sat at a declared place, or on the member the sample says the key removes (an authoredserviceAccountNameand the generated account). It fails for a key added to a schema with no map entry or no sample, and for a built-in component lowering rule that has neither a map nor a row in its list of rules without one. The destinations of the keys a rule evaluates itself are a table beside the rule; these tests are what holds that table to the rule.pkg/oam/lowering_keys_test.goholdsComponentLoweringKeys(),ComponentPlainOwners()andTraitLoweringKeys()to the declared maps and owners and to returning a copy.pkg/oam/builtin/registry/plain_owner_test.goholds the plain owner (go-kure/launcher#1701): every type with a key map publishes one, and for documents of each type that the rule lowers (helm under both deliveries, oci with and without its own source, postgresql with and without a backup, a webservice and a worker with and without a generated account) the owner live for the document carries the component’s name in the lowered members, and some document has it alone under that name (awebservicehas none: itsservicealways shares the name). It is read from the members the rule builds, never from a table, so a rule that gives the name to another member fails it.